View Issue Details

IDProjectCategoryView StatusLast Update
0000542FreeCADFeaturepublic2011-12-29 17:21
Reporterdanielfalck Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Fixed in Version0.13 
Summary0000542: request for 'Draft Angle' option for extrusion
DescriptionIt would be nice to have the option of adding a 'draft angle' to the extrusion dialog in Part Design and maybe even Part. This is an option in HeeksCAD and I have used it on occasion. Dan Heeks does it like this in 'RuledSurface.cpp' with his BSD licensed code:

void CreateExtrusions(const std::list<TopoDS_Shape> &faces_or_wires, std::list<TopoDS_Shape>& new_shapes, const gp_Vec& extrude_vector, double taper_angle, bool solid_if_possible)

{

    try{

        for(std::list<TopoDS_Shape>::const_iterator It = faces_or_wires.begin(); It != faces_or_wires.end(); It++)

        {

            const TopoDS_Shape& face_or_wire = *It;

            if(fabs(taper_angle) > 0.0000001)

            {

                // make an offset face

                double distance = tan(taper_angle * Pi/180) * extrude_vector.Magnitude();

                bool wire = (face_or_wire.ShapeType() == TopAbs_WIRE);

                BRepOffsetAPI_MakeOffset offset;

                if(wire)

                    offset = BRepOffsetAPI_MakeOffset(TopoDS::Wire(face_or_wire));

                else

                    continue; // can't do CreateRuledSurface on faces yet

                offset.Perform(distance);



                // parallel

                std::list<TopoDS_Wire> wire_list;

                wire_list.push_back(TopoDS::Wire(face_or_wire));

                wire_list.push_back(TopoDS::Wire(offset.Shape()));



                gp_Trsf mat;

                mat.SetTranslation(extrude_vector);

                BRepBuilderAPI_Transform myBRepTransformation(wire_list.back(),mat);

                wire_list.back() = TopoDS::Wire(myBRepTransformation.Shape());



                TopoDS_Shape new_shape;

                if(CreateRuledSurface(wire_list, new_shape, solid_if_possible))

                {

                    new_shapes.push_back(new_shape);

                }

            }

            else

            {

                BRepPrimAPI_MakePrism generator( face_or_wire, extrude_vector );

                generator.Build();

                new_shapes.push_back(generator.Shape());

            }

        }

    }

    catch (Standard_Failure) {

        Handle_Standard_Failure e = Standard_Failure::Caught();

        wxMessageBox(wxString(_("Error making extruded solid")) + _T(": ") + Ctt(e->GetMessageString()));

    }

    catch(...)

    {

        wxMessageBox(_("Fatal error making extruded solid"));

    }



}

Additional InformationI am uploading the a screenshot of the dialog box from HeeksCAD.
TagsNo tags attached.
FreeCAD Information

Activities

2011-12-16 13:52

 

extrusion_dialog.png (Attachment missing)

2011-12-16 13:53

 

extruded_part.png (Attachment missing)

wmayer

2011-12-29 17:21

administrator   ~0001519

Added in rev 5359

Issue History

Date Modified Username Field Change
2011-12-16 13:52 danielfalck New Issue
2011-12-16 13:52 danielfalck File Added: extrusion_dialog.png
2011-12-16 13:53 danielfalck File Added: extruded_part.png
2011-12-29 17:21 wmayer Note Added: 0001519
2011-12-29 17:21 wmayer Status new => closed
2011-12-29 17:21 wmayer Resolution open => fixed
2011-12-29 17:21 wmayer Fixed in Version => 0.13