OCC.ShapeCustom module

This package is intended toconvert geometrical objects and topological. Themodifications of one geometrical object to another(one) geometrical object are provided. The supportedmodifications are the following:conversion of BSpline and Bezier surfaces to analytical form,conversion of indirect elementary surfaces (with left-handedcoordinate systems) into direct ones,conversion of elementary surfaces to surfaces of revolution,conversion of surface of linear extrusion, revolution, offsetsurface to bspline,modification of parameterization, degree, number of segments of bsplinesurfaces, scale the shape.

class Handle_ShapeCustom_ConvertToBSpline(*args)

Bases: OCC.ShapeCustom.Handle_ShapeCustom_Modification

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

The membership flag

class Handle_ShapeCustom_DirectModification(*args)

Bases: OCC.ShapeCustom.Handle_ShapeCustom_Modification

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

The membership flag

class Handle_ShapeCustom_Modification(*args)

Bases: OCC.BRepTools.Handle_BRepTools_Modification

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

The membership flag

class Handle_ShapeCustom_RestrictionParameters(*args)

Bases: OCC.MMgt.Handle_MMgt_TShared

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

The membership flag

class Handle_ShapeCustom_TrsfModification(*args)

Bases: OCC.BRepTools.Handle_BRepTools_TrsfModification

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

The membership flag

class ShapeCustom_ConvertToBSpline(*args)

Bases: OCC.ShapeCustom.ShapeCustom_Modification

Return type:None
GetHandle()
SetExtrusionMode()
  • Sets mode for convertion of Surfaces of Linear extrusion.
Parameters:extrMode (bool) –
Return type:None
SetOffsetMode()
  • Sets mode for convertion of Offset surfaces.
Parameters:offsetMode (bool) –
Return type:None
SetPlaneMode()
  • Sets mode for convertion of Plane surfaces.
Parameters:planeMode (bool) –
Return type:None
SetRevolutionMode()
  • Sets mode for convertion of Surfaces of Revolution.
Parameters:revolMode (bool) –
Return type:None
thisown

The membership flag

class ShapeCustom_Curve(*args)

Bases: object

Return type:None
Parameters:C (Handle_Geom_Curve &) –
Return type:None
ConvertToPeriodic()
  • Tries to convert the Curve to the Periodic form Returns the resulting curve Works only if the Curve is BSpline and is closed with Precision::Confusion() Else, or in case of failure, returns a Null Handle
Parameters:
  • substitute (bool) –
  • preci (float) – default value is -1
Return type:

Handle_Geom_Curve

Init()
Parameters:C (Handle_Geom_Curve &) –
Return type:None
thisown

The membership flag

class ShapeCustom_Curve2d

Bases: object

static ConvertToLine2d()
  • Try to convert BSpline2d or Bezier2d to line 2d only if it is linear. Recalculate first and last parameters. Returns line2d or null curve2d.
Parameters:
  • theCurve (Handle_Geom2d_Curve &) –
  • theFirstIn (float) –
  • theLastIn (float) –
  • theTolerance (float) –
  • theNewFirst (float &) –
  • theNewLast (float &) –
  • theDeviation (float &) –
Return type:

Handle_Geom2d_Line

static IsLinear()
  • Check if poleses is in the plane with given precision Returns false if no.
Parameters:
Return type:

bool

static SimplifyBSpline2d()
  • Try to remove knots from bspline where local derivatives are the same. Remove knots with given precision. Returns false if Bsplien was not modified
Parameters:
  • theBSpline2d (Handle_Geom2d_BSplineCurve &) –
  • theTolerance (float) –
Return type:

bool

thisown

The membership flag

ShapeCustom_Curve2d_ConvertToLine2d()
  • Try to convert BSpline2d or Bezier2d to line 2d only if it is linear. Recalculate first and last parameters. Returns line2d or null curve2d.
Parameters:
  • theCurve (Handle_Geom2d_Curve &) –
  • theFirstIn (float) –
  • theLastIn (float) –
  • theTolerance (float) –
  • theNewFirst (float &) –
  • theNewLast (float &) –
  • theDeviation (float &) –
Return type:

Handle_Geom2d_Line

ShapeCustom_Curve2d_IsLinear()
  • Check if poleses is in the plane with given precision Returns false if no.
Parameters:
Return type:

bool

ShapeCustom_Curve2d_SimplifyBSpline2d()
  • Try to remove knots from bspline where local derivatives are the same. Remove knots with given precision. Returns false if Bsplien was not modified
Parameters:
  • theBSpline2d (Handle_Geom2d_BSplineCurve &) –
  • theTolerance (float) –
Return type:

bool

class ShapeCustom_DirectModification(*args)

Bases: OCC.ShapeCustom.ShapeCustom_Modification

Return type:None
GetHandle()
thisown

The membership flag

class ShapeCustom_Modification(*args, **kwargs)

Bases: OCC.BRepTools.BRepTools_Modification

GetHandle()
MsgRegistrator()
  • Returns message registrator
Return type:Handle_ShapeExtend_BasicMsgRegistrator
SendMsg()
  • Sends a message to be attached to the shape. Calls corresponding message of message registrator.
Parameters:
  • shape (TopoDS_Shape &) –
  • message (Message_Msg &) –
  • gravity (Message_Gravity) – default value is Message_Info
Return type:

None

SetMsgRegistrator()
  • Sets message registrator
Parameters:msgreg (Handle_ShapeExtend_BasicMsgRegistrator &) –
Return type:void
thisown

The membership flag

class ShapeCustom_RestrictionParameters(*args)

Bases: OCC.MMgt.MMgt_TShared

  • Sets default parameters.
Return type:None
GetConvertBezierSurf()

ShapeCustom_RestrictionParameters_GetConvertBezierSurf(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertConicalSurf()

ShapeCustom_RestrictionParameters_GetConvertConicalSurf(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertCurve2d()

ShapeCustom_RestrictionParameters_GetConvertCurve2d(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertCurve3d()

ShapeCustom_RestrictionParameters_GetConvertCurve3d(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertCylindricalSurf()

ShapeCustom_RestrictionParameters_GetConvertCylindricalSurf(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertExtrusionSurf()

ShapeCustom_RestrictionParameters_GetConvertExtrusionSurf(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertOffsetCurv2d()

ShapeCustom_RestrictionParameters_GetConvertOffsetCurv2d(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertOffsetCurv3d()

ShapeCustom_RestrictionParameters_GetConvertOffsetCurv3d(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertOffsetSurf()

ShapeCustom_RestrictionParameters_GetConvertOffsetSurf(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertPlane()

ShapeCustom_RestrictionParameters_GetConvertPlane(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertRevolutionSurf()

ShapeCustom_RestrictionParameters_GetConvertRevolutionSurf(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertSphericalSurf()

ShapeCustom_RestrictionParameters_GetConvertSphericalSurf(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetConvertToroidalSurf()

ShapeCustom_RestrictionParameters_GetConvertToroidalSurf(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

GetGMaxDegree()

ShapeCustom_RestrictionParameters_GetGMaxDegree(ShapeCustom_RestrictionParameters self) -> Standard_Integer

GetGMaxSeg()

ShapeCustom_RestrictionParameters_GetGMaxSeg(ShapeCustom_RestrictionParameters self) -> Standard_Integer

GetHandle()
GetSegmentSurfaceMode()

ShapeCustom_RestrictionParameters_GetSegmentSurfaceMode(ShapeCustom_RestrictionParameters self) -> Standard_Boolean

SetConvertBezierSurf()

ShapeCustom_RestrictionParameters_SetConvertBezierSurf(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertConicalSurf()

ShapeCustom_RestrictionParameters_SetConvertConicalSurf(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertCurve2d()

ShapeCustom_RestrictionParameters_SetConvertCurve2d(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertCurve3d()

ShapeCustom_RestrictionParameters_SetConvertCurve3d(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertCylindricalSurf()

ShapeCustom_RestrictionParameters_SetConvertCylindricalSurf(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertExtrusionSurf()

ShapeCustom_RestrictionParameters_SetConvertExtrusionSurf(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertOffsetCurv2d()

ShapeCustom_RestrictionParameters_SetConvertOffsetCurv2d(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertOffsetCurv3d()

ShapeCustom_RestrictionParameters_SetConvertOffsetCurv3d(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertOffsetSurf()

ShapeCustom_RestrictionParameters_SetConvertOffsetSurf(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertPlane()

ShapeCustom_RestrictionParameters_SetConvertPlane(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertRevolutionSurf()

ShapeCustom_RestrictionParameters_SetConvertRevolutionSurf(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertSphericalSurf()

ShapeCustom_RestrictionParameters_SetConvertSphericalSurf(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetConvertToroidalSurf()

ShapeCustom_RestrictionParameters_SetConvertToroidalSurf(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

SetGMaxDegree()

ShapeCustom_RestrictionParameters_SetGMaxDegree(ShapeCustom_RestrictionParameters self, Standard_Integer value)

SetGMaxSeg()

ShapeCustom_RestrictionParameters_SetGMaxSeg(ShapeCustom_RestrictionParameters self, Standard_Integer value)

SetSegmentSurfaceMode()

ShapeCustom_RestrictionParameters_SetSegmentSurfaceMode(ShapeCustom_RestrictionParameters self, Standard_Boolean value)

thisown

The membership flag

class ShapeCustom_Surface(*args)

Bases: object

Return type:None
Parameters:S (Handle_Geom_Surface &) –
Return type:None
ConvertToAnalytical()
  • Tries to convert the Surface to an Analytic form Returns the result Works only if the Surface is BSpline or Bezier. Else, or in case of failure, returns a Null Handle //! If <substitute> is True, the new surface replaces the actual one in <self> //! It works by analysing the case which can apply, creating the corresponding analytic surface, then checking coincidence Warning: Parameter laws are not kept, hence PCurves should be redone
Parameters:
Return type:

Handle_Geom_Surface

ConvertToPeriodic()
  • Tries to convert the Surface to the Periodic form Returns the resulting surface Works only if the Surface is BSpline and is closed with Precision::Confusion() Else, or in case of failure, returns a Null Handle
Parameters:
  • substitute (bool) –
  • preci (float) – default value is -1
Return type:

Handle_Geom_Surface

Gap()
  • Returns maximal deviation of converted surface from the original one computed by last call to ConvertToAnalytical
Return type:float
Init()
Parameters:S (Handle_Geom_Surface &) –
Return type:None
thisown

The membership flag

class ShapeCustom_TrsfModification(*args)

Bases: OCC.BRepTools.BRepTools_TrsfModification

  • Empty constructor
Parameters:T (gp_Trsf) –
Return type:None
GetHandle()
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 shapecustom

Bases: object

static ApplyModifier()
  • Applies modifier to shape and checks sharing in the case assemblies.
Parameters:
  • S (TopoDS_Shape &) –
  • M (Handle_BRepTools_Modification &) –
  • context (TopTools_DataMapOfShapeShape &) –
  • MD (BRepTools_Modifier &) –
  • aProgress (Handle_Message_ProgressIndicator &) – default value is NULL
  • aReShape (Handle_ShapeBuild_ReShape &) – default value is NULL
Return type:

TopoDS_Shape

static BSplineRestriction()
  • Returns a new shape with all surfaces, curves and pcurves which type is BSpline/Bezier or based on them converted having Degree less than <MaxDegree> or number of spans less than <NbMaxSegment> in dependence on parameter priority <Degree>. <GmaxDegree> and <GMaxSegments> are maximum possible degree and number of spans correspondingly. These values will be used in those cases when approximation with specified parameters is impossible and one of GmaxDegree or GMaxSegments is selected in dependence on priority. Note that even if approximation is impossible with <GMaxDegree> then number of spans can exceed specified <GMaxSegment> <Rational> specifies if to convert Rational BSpline/Bezier into polynomial B-Spline. If flags ConvOffSurf,ConvOffCurve3d,ConvOffCurve2d are Standard_True there are means that Offset surfaces , Offset curves 3d and Offset curves 2d are converted to BSPline correspondingly.
Parameters:
  • S (TopoDS_Shape &) –
  • Tol3d (float) –
  • Tol2d (float) –
  • MaxDegree (int) –
  • MaxNbSegment (int) –
  • Continuity3d (GeomAbs_Shape) –
  • Continuity2d (GeomAbs_Shape) –
  • Degree (bool) –
  • Rational (bool) –
  • aParameters (Handle_ShapeCustom_RestrictionParameters &) –
Return type:

TopoDS_Shape

static ConvertToBSpline()
  • Returns a new shape with all surfaces of linear extrusion, revolution, offset, and planar surfaces converted according to flags to Geom_BSplineSurface (with same parameterisation).
Parameters:
  • S (TopoDS_Shape &) –
  • extrMode (bool) –
  • revolMode (bool) –
  • offsetMode (bool) –
  • planeMode (bool) – default value is Standard_False
Return type:

TopoDS_Shape

static ConvertToRevolution()
  • Returns a new shape with all elementary periodic surfaces converted to Geom_SurfaceOfRevolution
Parameters:S (TopoDS_Shape &) –
Return type:TopoDS_Shape
static DirectFaces()
  • Returns a new shape without indirect surfaces.
Parameters:S (TopoDS_Shape &) –
Return type:TopoDS_Shape
static ScaleShape()
  • Returns a new shape which is scaled original
Parameters:
  • S (TopoDS_Shape &) –
  • scale (float) –
Return type:

TopoDS_Shape

static SweptToElementary()
  • Returns a new shape with all surfaces of revolution and linear extrusion convert to elementary periodic surfaces
Parameters:S (TopoDS_Shape &) –
Return type:TopoDS_Shape
thisown

The membership flag

shapecustom_ApplyModifier()
  • Applies modifier to shape and checks sharing in the case assemblies.
Parameters:
  • S (TopoDS_Shape &) –
  • M (Handle_BRepTools_Modification &) –
  • context (TopTools_DataMapOfShapeShape &) –
  • MD (BRepTools_Modifier &) –
  • aProgress (Handle_Message_ProgressIndicator &) – default value is NULL
  • aReShape (Handle_ShapeBuild_ReShape &) – default value is NULL
Return type:

TopoDS_Shape

shapecustom_BSplineRestriction()
  • Returns a new shape with all surfaces, curves and pcurves which type is BSpline/Bezier or based on them converted having Degree less than <MaxDegree> or number of spans less than <NbMaxSegment> in dependence on parameter priority <Degree>. <GmaxDegree> and <GMaxSegments> are maximum possible degree and number of spans correspondingly. These values will be used in those cases when approximation with specified parameters is impossible and one of GmaxDegree or GMaxSegments is selected in dependence on priority. Note that even if approximation is impossible with <GMaxDegree> then number of spans can exceed specified <GMaxSegment> <Rational> specifies if to convert Rational BSpline/Bezier into polynomial B-Spline. If flags ConvOffSurf,ConvOffCurve3d,ConvOffCurve2d are Standard_True there are means that Offset surfaces , Offset curves 3d and Offset curves 2d are converted to BSPline correspondingly.
Parameters:
  • S (TopoDS_Shape &) –
  • Tol3d (float) –
  • Tol2d (float) –
  • MaxDegree (int) –
  • MaxNbSegment (int) –
  • Continuity3d (GeomAbs_Shape) –
  • Continuity2d (GeomAbs_Shape) –
  • Degree (bool) –
  • Rational (bool) –
  • aParameters (Handle_ShapeCustom_RestrictionParameters &) –
Return type:

TopoDS_Shape

shapecustom_ConvertToBSpline()
  • Returns a new shape with all surfaces of linear extrusion, revolution, offset, and planar surfaces converted according to flags to Geom_BSplineSurface (with same parameterisation).
Parameters:
  • S (TopoDS_Shape &) –
  • extrMode (bool) –
  • revolMode (bool) –
  • offsetMode (bool) –
  • planeMode (bool) – default value is Standard_False
Return type:

TopoDS_Shape

shapecustom_ConvertToRevolution()
  • Returns a new shape with all elementary periodic surfaces converted to Geom_SurfaceOfRevolution
Parameters:S (TopoDS_Shape &) –
Return type:TopoDS_Shape
shapecustom_DirectFaces()
  • Returns a new shape without indirect surfaces.
Parameters:S (TopoDS_Shape &) –
Return type:TopoDS_Shape
shapecustom_ScaleShape()
  • Returns a new shape which is scaled original
Parameters:
  • S (TopoDS_Shape &) –
  • scale (float) –
Return type:

TopoDS_Shape

shapecustom_SweptToElementary()
  • Returns a new shape with all surfaces of revolution and linear extrusion convert to elementary periodic surfaces
Parameters:S (TopoDS_Shape &) –
Return type:TopoDS_Shape