OCC.ShapeConstruct module

This package provides new algorithms for constructingnew geometrical objects and topological shapes. Itcomplements and extends algorithms available in OpenCASCADE topological and geometrical toolkist.The functionality provided by this package are thefollowing:projecting curves on surface,adjusting curve to have given start and end points. P

class Handle_ShapeConstruct_ProjectCurveOnSurface(*args)

Bases: OCC.MMgt.Handle_MMgt_TShared

static DownCast()
GetObject()
IsNull()
Nullify()
thisown

The membership flag

class ShapeConstruct_CompBezierCurves2dToBSplineCurve2d(*args)

Bases: object

Parameters:AngularTolerance (float) – default value is 1.0e-4
Return type:None
AddCurve()
Parameters:Poles (TColgp_Array1OfPnt2d) –
Return type:None
Degree()
Return type:int
KnotsAndMults()
Parameters:
  • Knots (TColStd_Array1OfReal &) –
  • Mults (TColStd_Array1OfInteger &) –
Return type:

None

NbKnots()
Return type:int
NbPoles()
Return type:int
Perform()
  • Computes the algorithm.
Return type:None
Poles()
Parameters:Poles (TColgp_Array1OfPnt2d) –
Return type:None
thisown

The membership flag

class ShapeConstruct_CompBezierCurvesToBSplineCurve(*args)

Bases: object

Parameters:AngularTolerance (float) – default value is 1.0e-4
Return type:None
AddCurve()
Parameters:Poles (TColgp_Array1OfPnt) –
Return type:None
Degree()
Return type:int
KnotsAndMults()
Parameters:
  • Knots (TColStd_Array1OfReal &) –
  • Mults (TColStd_Array1OfInteger &) –
Return type:

None

NbKnots()
Return type:int
NbPoles()
Return type:int
Perform()
  • Computes the algorithm.
Return type:None
Poles()
Parameters:Poles (TColgp_Array1OfPnt) –
Return type:None
thisown

The membership flag

class ShapeConstruct_Curve

Bases: object

AdjustCurve()
  • Modifies a curve in order to make its bounds confused with given points. Works only on lines and B-Splines, returns True in this case, else returns False. For line considers both bounding points, for B-Splines only specified. //! Warning : Does not check if curve should be reversed
Parameters:
  • C3D (Handle_Geom_Curve &) –
  • P1 (gp_Pnt) –
  • P2 (gp_Pnt) –
  • take1 (bool) – default value is Standard_True
  • take2 (bool) – default value is Standard_True
Return type:

bool

AdjustCurve2d()
  • Modifies a curve in order to make its bounds confused with given points. Works only on lines and B-Splines, returns True in this case, else returns False. //! For line considers both bounding points, for B-Splines only specified. //! Warning : Does not check if curve should be reversed
Parameters:
  • C2D (Handle_Geom2d_Curve &) –
  • P1 (gp_Pnt2d) –
  • P2 (gp_Pnt2d) –
  • take1 (bool) – default value is Standard_True
  • take2 (bool) – default value is Standard_True
Return type:

bool

AdjustCurveSegment()
  • Modifies a curve in order to make its bounds confused with given points. Works only on lines and B-Splines. //! For lines works as previous method, B-Splines are segmented at the given values and then are adjusted to the points.
Parameters:
Return type:

bool

ConvertToBSpline()
  • Converts a curve of any type (only part from first to last) to bspline. The method of conversion depends on the type of original curve: BSpline -> C.Segment(first,last) Bezier and Line -> GeomConvert::CurveToBSplineCurve(C).Segment(first,last) Conic and Other -> Approx_Curve3d(C[first,last],prec,C1,9,1000)
Parameters:
  • C (Handle_Geom_Curve &) –
  • first (float) –
  • last (float) –
  • prec (float) –
Return type:

Handle_Geom_BSplineCurve

  • Converts a curve of any type (only part from first to last) to bspline. The method of conversion depends on the type of original curve: BSpline -> C.Segment(first,last) Bezier and Line -> GeomConvert::CurveToBSplineCurve(C).Segment(first,last) Conic and Other -> Approx_Curve2d(C[first,last],prec,C1,9,1000)
Parameters:
  • C (Handle_Geom2d_Curve &) –
  • first (float) –
  • last (float) –
  • prec (float) –
Return type:

Handle_Geom2d_BSplineCurve

static FixKnots()
Parameters:knots (Handle_TColStd_HArray1OfReal &) –
Return type:bool
  • Fix bspline knots to ensure that there is enough gap between neighbouring values Returns True if something fixed (by shifting knot)
Parameters:knots (TColStd_Array1OfReal &) –
Return type:bool
thisown

The membership flag

ShapeConstruct_Curve_FixKnots()
Parameters:knots (Handle_TColStd_HArray1OfReal &) –
Return type:bool
  • Fix bspline knots to ensure that there is enough gap between neighbouring values Returns True if something fixed (by shifting knot)
Parameters:knots (TColStd_Array1OfReal &) –
Return type:bool
class ShapeConstruct_MakeTriangulation(*args)

Bases: OCC.BRepBuilderAPI.BRepBuilderAPI_MakeShape

Parameters:
  • pnts (TColgp_Array1OfPnt) –
  • prec (float) – default value is 0.0
  • wire (TopoDS_Wire &) –
  • prec – default value is 0.0
Return type:

None

Return type:

None

thisown

The membership flag

class ShapeConstruct_ProjectCurveOnSurface(*args)

Bases: OCC.MMgt.MMgt_TShared

  • Empty constructor.
Return type:None
GetAdjustOverDegenMode()

ShapeConstruct_ProjectCurveOnSurface_GetAdjustOverDegenMode(ShapeConstruct_ProjectCurveOnSurface self) -> Standard_Integer

GetBuildCurveMode()

ShapeConstruct_ProjectCurveOnSurface_GetBuildCurveMode(ShapeConstruct_ProjectCurveOnSurface self) -> Standard_Boolean

GetHandle()
Init()
  • Initializes the object with all necessary parameters, i.e. surface and precision
Parameters:
  • surf (Handle_Geom_Surface &) –
  • preci (float) –
Return type:

void

  • Initializes the object with all necessary parameters, i.e. surface and precision
Parameters:
  • surf (Handle_ShapeAnalysis_Surface &) –
  • preci (float) –
Return type:

void

Perform()
  • Computes the projection of 3d curve onto a surface using the specialized algorithm. Returns False if projector fails, otherwise, if pcurve computed successfully, returns True. The continuity, maxdeg and nbinterval are parameters of call to Approx_CurveOnSurface. If nbinterval is equal to -1 (default), this value is computed depending on source 3d curve and surface. The output curve 2D is guaranteed to be same-parameter with input curve 3D on the interval [First, Last]. If the output curve lies on a direct line the infinite line is returned, in the case same-parameter condition is satisfied.
Parameters:
  • c3d (Handle_Geom_Curve &) –
  • First (float) –
  • Last (float) –
  • c2d (Handle_Geom2d_Curve &) –
  • continuity (GeomAbs_Shape) – default value is GeomAbs_C1
  • maxdeg (int) – default value is 12
  • nbinterval (int) – default value is -1
Return type:

bool

PerformAdvanced()
  • Computes the projection of 3d curve onto a surface using either standard projector (method PerformByProjLib()) or internal one (method Perform()). The selection is done by analyzing the surface and 3d curve and is aimed to filter the cases potentially dangerous for the standard projector. If the standard projector fails, internal one is used.
Parameters:
  • c3d (Handle_Geom_Curve &) –
  • First (float) –
  • Last (float) –
  • c2d (Handle_Geom2d_Curve &) –
Return type:

bool

PerformByProjLib()
  • Computes the projection of 3d curve onto a surface using the standard algorithm from ProjLib. Returns False if standard projector fails or raises an exception or cuts the curve by parametrical bounds of the surface. Else, if pcurve computed successfully, returns True. The continuity, maxdeg and nbinterval are parameters of call to Approx_CurveOnSurface. If nbinterval is equal to -1 (default), this value is computed depending on source 3d curve and surface.
Parameters:
  • c3d (Handle_Geom_Curve &) –
  • First (float) –
  • Last (float) –
  • c2d (Handle_Geom2d_Curve &) –
  • continuity (GeomAbs_Shape) – default value is GeomAbs_C1
  • maxdeg (int) – default value is 12
  • nbinterval (int) – default value is -1
Return type:

bool

SetAdjustOverDegenMode()

ShapeConstruct_ProjectCurveOnSurface_SetAdjustOverDegenMode(ShapeConstruct_ProjectCurveOnSurface self, Standard_Integer value)

SetBuildCurveMode()

ShapeConstruct_ProjectCurveOnSurface_SetBuildCurveMode(ShapeConstruct_ProjectCurveOnSurface self, Standard_Boolean value)

SetPrecision()
  • Sets value for current precision
Parameters:preci (float) –
Return type:None
SetSurface()
  • Loads a surface (in the form of Geom_Surface) to project on
Parameters:surf (Handle_Geom_Surface &) –
Return type:None
  • Loads a surface (in the form of ShapeAnalysis_Surface) to project on
Parameters:surf (Handle_ShapeAnalysis_Surface &) –
Return type:None
Status()
  • Returns the status of last Peform
Parameters:Status (ShapeExtend_Status) –
Return type:bool
thisown

The membership flag

class SwigPyIterator(*args, **kwargs)

Bases: object

advance()
copy()
decr()
distance()
equal()
incr()
next()
previous()
thisown

The membership flag

value()
new_instancemethod(func, inst, cls)
register_handle(handle, base_object)

Inserts the handle into the base object to prevent memory corruption in certain cases

class shapeconstruct

Bases: object

static ConvertCurveToBSpline()
  • Tool for wire triangulation
Parameters:
  • C3D (Handle_Geom_Curve &) –
  • First (float) –
  • Last (float) –
  • Tol3d (float) –
  • Continuity (GeomAbs_Shape) –
  • MaxSegments (int) –
  • MaxDegree (int) –
  • C2D (Handle_Geom2d_Curve &) –
  • First
  • Last
  • Tol2d (float) –
  • Continuity
  • MaxSegments
  • MaxDegree
Return type:

Handle_Geom_BSplineCurve

Return type:

Handle_Geom2d_BSplineCurve

static ConvertSurfaceToBSpline()
Parameters:
  • surf (Handle_Geom_Surface &) –
  • UF (float) –
  • UL (float) –
  • VF (float) –
  • VL (float) –
  • Tol3d (float) –
  • Continuity (GeomAbs_Shape) –
  • MaxSegments (int) –
  • MaxDegree (int) –
Return type:

Handle_Geom_BSplineSurface

static JoinCurves()
  • Method for joininig curves 3D. Parameters : c3d1,ac3d2 - initial curves Orient1, Orient2 - initial edges orientations. first1,last1,first2,last2 - parameters for trimming curves (re-calculate with account of orientation edges) c3dOut - result curve isRev1,isRev2 - out parameters indicative on possible errors. Return value : True - if curves were joined successfully, else - False.
Parameters:
  • c3d1 (Handle_Geom_Curve &) –
  • ac3d2 (Handle_Geom_Curve &) –
  • Orient1 (TopAbs_Orientation) –
  • Orient2 (TopAbs_Orientation) –
  • first1 (float &) –
  • last1 (float &) –
  • first2 (float &) –
  • last2 (float &) –
  • c3dOut (Handle_Geom_Curve &) –
  • isRev1 (bool) –
  • isRev2 (bool) –
Return type:

bool

  • Method for joininig curves 3D. Parameters : c3d1,ac3d2 - initial curves Orient1, Orient2 - initial edges orientations. first1,last1,first2,last2 - parameters for trimming curves (re-calculate with account of orientation edges) c3dOut - result curve isRev1,isRev2 - out parameters indicative on possible errors. isError - input parameter indicative possible errors due to that one from edges have one vertex Return value : True - if curves were joined successfully, else - False.
Parameters:
  • c2d1 (Handle_Geom2d_Curve &) –
  • ac2d2 (Handle_Geom2d_Curve &) –
  • Orient1 (TopAbs_Orientation) –
  • Orient2 (TopAbs_Orientation) –
  • first1 (float &) –
  • last1 (float &) –
  • first2 (float &) –
  • last2 (float &) –
  • c2dOut (Handle_Geom2d_Curve &) –
  • isRev1 (bool) –
  • isRev2 (bool) –
  • isError (bool) – default value is Standard_False
Return type:

bool

static JoinPCurves()
  • join pcurves of the <theEdge> on the <theFace> try to use pcurves from originas edges <theEdges> Returns false if cannot join pcurves
Parameters:
  • theEdges (Handle_TopTools_HSequenceOfShape &) –
  • theFace (TopoDS_Face &) –
  • theEdge (TopoDS_Edge &) –
Return type:

bool

thisown

The membership flag

shapeconstruct_ConvertCurveToBSpline()
  • Tool for wire triangulation
Parameters:
  • C3D (Handle_Geom_Curve &) –
  • First (float) –
  • Last (float) –
  • Tol3d (float) –
  • Continuity (GeomAbs_Shape) –
  • MaxSegments (int) –
  • MaxDegree (int) –
  • C2D (Handle_Geom2d_Curve &) –
  • First
  • Last
  • Tol2d (float) –
  • Continuity
  • MaxSegments
  • MaxDegree
Return type:

Handle_Geom_BSplineCurve

Return type:

Handle_Geom2d_BSplineCurve

shapeconstruct_ConvertSurfaceToBSpline()
Parameters:
  • surf (Handle_Geom_Surface &) –
  • UF (float) –
  • UL (float) –
  • VF (float) –
  • VL (float) –
  • Tol3d (float) –
  • Continuity (GeomAbs_Shape) –
  • MaxSegments (int) –
  • MaxDegree (int) –
Return type:

Handle_Geom_BSplineSurface

shapeconstruct_JoinCurves()
  • Method for joininig curves 3D. Parameters : c3d1,ac3d2 - initial curves Orient1, Orient2 - initial edges orientations. first1,last1,first2,last2 - parameters for trimming curves (re-calculate with account of orientation edges) c3dOut - result curve isRev1,isRev2 - out parameters indicative on possible errors. Return value : True - if curves were joined successfully, else - False.
Parameters:
  • c3d1 (Handle_Geom_Curve &) –
  • ac3d2 (Handle_Geom_Curve &) –
  • Orient1 (TopAbs_Orientation) –
  • Orient2 (TopAbs_Orientation) –
  • first1 (float &) –
  • last1 (float &) –
  • first2 (float &) –
  • last2 (float &) –
  • c3dOut (Handle_Geom_Curve &) –
  • isRev1 (bool) –
  • isRev2 (bool) –
Return type:

bool

  • Method for joininig curves 3D. Parameters : c3d1,ac3d2 - initial curves Orient1, Orient2 - initial edges orientations. first1,last1,first2,last2 - parameters for trimming curves (re-calculate with account of orientation edges) c3dOut - result curve isRev1,isRev2 - out parameters indicative on possible errors. isError - input parameter indicative possible errors due to that one from edges have one vertex Return value : True - if curves were joined successfully, else - False.
Parameters:
  • c2d1 (Handle_Geom2d_Curve &) –
  • ac2d2 (Handle_Geom2d_Curve &) –
  • Orient1 (TopAbs_Orientation) –
  • Orient2 (TopAbs_Orientation) –
  • first1 (float &) –
  • last1 (float &) –
  • first2 (float &) –
  • last2 (float &) –
  • c2dOut (Handle_Geom2d_Curve &) –
  • isRev1 (bool) –
  • isRev2 (bool) –
  • isError (bool) – default value is Standard_False
Return type:

bool

shapeconstruct_JoinPCurves()
  • join pcurves of the <theEdge> on the <theFace> try to use pcurves from originas edges <theEdges> Returns false if cannot join pcurves
Parameters:
  • theEdges (Handle_TopTools_HSequenceOfShape &) –
  • theFace (TopoDS_Face &) –
  • theEdge (TopoDS_Edge &) –
Return type:

bool