+ fix non-parametric makeHelix() function in Part module
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5143 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#ifndef _PreComp_
|
||||
# include <cstdlib>
|
||||
# include <sstream>
|
||||
# include <BRepLib.hxx>
|
||||
# include <BSplCLib.hxx>
|
||||
# include <Bnd_Box.hxx>
|
||||
# include <BRep_Builder.hxx>
|
||||
@@ -40,9 +41,11 @@
|
||||
# include <BRepAlgoAPI_Section.hxx>
|
||||
# include <BRepBndLib.hxx>
|
||||
# include <BRepBuilderAPI_GTransform.hxx>
|
||||
# include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
# include <BRepBuilderAPI_MakeFace.hxx>
|
||||
# include <BRepBuilderAPI_MakePolygon.hxx>
|
||||
# include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
# include <BRepBuilderAPI_MakeWire.hxx>
|
||||
# include <BRepBuilderAPI_NurbsConvert.hxx>
|
||||
# include <BRepBuilderAPI_FaceError.hxx>
|
||||
# include <BRepBuilderAPI_Copy.hxx>
|
||||
@@ -66,6 +69,9 @@
|
||||
# include <BRepTools.hxx>
|
||||
# include <BRepTools_ReShape.hxx>
|
||||
# include <BRepTools_ShapeSet.hxx>
|
||||
# include <GCE2d_MakeSegment.hxx>
|
||||
# include <Geom2d_Line.hxx>
|
||||
# include <Geom2d_TrimmedCurve.hxx>
|
||||
# include <GeomLProp_SLProps.hxx>
|
||||
# include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
# include <GeomFill_CorrectedFrenet.hxx>
|
||||
@@ -1438,6 +1444,45 @@ TopoDS_Shape TopoShape::makeSweep(const TopoDS_Shape& profile, double tol, int f
|
||||
return mkBuilder.Face();
|
||||
}
|
||||
|
||||
TopoDS_Shape TopoShape::makeHelix(Standard_Real pitch, Standard_Real height,
|
||||
Standard_Real radius, Standard_Real angle) const
|
||||
{
|
||||
if (pitch < Precision::Confusion())
|
||||
Standard_Failure::Raise("Pitch of helix too small");
|
||||
|
||||
if (height < Precision::Confusion())
|
||||
Standard_Failure::Raise("Height of helix too small");
|
||||
|
||||
if (radius < Precision::Confusion())
|
||||
Standard_Failure::Raise("Radius of helix too small");
|
||||
|
||||
gp_Ax2 cylAx2(gp_Pnt(0.0,0.0,0.0) , gp::DZ());
|
||||
Handle_Geom_Surface surf;
|
||||
if (angle < Precision::Confusion()) {
|
||||
surf = new Geom_CylindricalSurface(cylAx2, radius);
|
||||
}
|
||||
else {
|
||||
angle = Base::toRadians(angle);
|
||||
if (angle < Precision::Confusion())
|
||||
Standard_Failure::Raise("Angle of helix too small");
|
||||
surf = new Geom_ConicalSurface(gp_Ax3(cylAx2), angle, radius);
|
||||
}
|
||||
|
||||
gp_Pnt2d aPnt(0, 0);
|
||||
gp_Dir2d aDir(2. * PI, pitch);
|
||||
gp_Ax2d aAx2d(aPnt, aDir);
|
||||
|
||||
Handle(Geom2d_Line) line = new Geom2d_Line(aAx2d);
|
||||
gp_Pnt2d beg = line->Value(0);
|
||||
gp_Pnt2d end = line->Value(sqrt(4.0*PI*PI+pitch*pitch)*(height/pitch));
|
||||
Handle(Geom2d_TrimmedCurve) segm = GCE2d_MakeSegment(beg , end);
|
||||
|
||||
TopoDS_Edge edgeOnSurf = BRepBuilderAPI_MakeEdge(segm , surf);
|
||||
TopoDS_Wire wire = BRepBuilderAPI_MakeWire(edgeOnSurf);
|
||||
BRepLib::BuildCurves3d(wire);
|
||||
return wire;
|
||||
}
|
||||
|
||||
TopoDS_Shape TopoShape::makeLoft(const TopTools_ListOfShape& profiles,
|
||||
Standard_Boolean isSolid,
|
||||
Standard_Boolean isRuled) const
|
||||
|
||||
Reference in New Issue
Block a user