OCC.ShapeBuild module

class OCC.ShapeBuild.Handle_ShapeBuild_ReShape(*args)

Bases: OCC.BRepTools.Handle_BRepTools_ReShape

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

The membership flag

class OCC.ShapeBuild.ShapeBuild_Edge(*args, **kwargs)

Bases: object

BuildCurve3d()
  • Calls BRepTools::BuildCurve3D
Parameters:edge (TopoDS_Edge &) –
Return type:bool
Copy()
  • Make a copy of <edge> by call to CopyReplaceVertices() (i.e. construct new TEdge with the same pcurves and vertices). If <sharepcurves> is False, pcurves are also replaced by their copies with help of method CopyPCurves
Parameters:
  • edge (TopoDS_Edge &) –
  • sharepcurves (bool) – default value is Standard_True
Return type:

TopoDS_Edge

  • Make a copy of <edge> by call to CopyReplaceVertices() (i.e. construct new TEdge with the same pcurves and vertices). If <sharepcurves> is False, pcurves are also replaced by their copies with help of method CopyPCurves
Parameters:
  • edge (TopoDS_Edge &) –
  • sharepcurves (bool) – default value is Standard_True
Return type:

TopoDS_Edge

CopyPCurves()
  • Makes a copy of pcurves from edge <fromedge> into edge <toedge>. Pcurves which are already present in <toedge>, are replaced by copies, other are copied. Ranges are also copied.
Parameters:
  • toedge (TopoDS_Edge &) –
  • fromedge (TopoDS_Edge &) –
Return type:

None

CopyRanges()
  • Copies ranges for curve3d and all common pcurves from edge <fromedge> into edge <toedge>.
Parameters:
  • toedge (TopoDS_Edge &) –
  • fromedge (TopoDS_Edge &) –
  • alpha (float) – default value is 0
  • beta (float) – default value is 1
Return type:

None

  • Copies ranges for curve3d and all common pcurves from edge <fromedge> into edge <toedge>.
Parameters:
  • toedge (TopoDS_Edge &) –
  • fromedge (TopoDS_Edge &) –
  • alpha (float) – default value is 0
  • beta (float) – default value is 1
Return type:

None

  • Copies ranges for curve3d and all common pcurves from edge <fromedge> into edge <toedge>.
Parameters:
  • toedge (TopoDS_Edge &) –
  • fromedge (TopoDS_Edge &) –
  • alpha (float) – default value is 0
  • beta (float) – default value is 1
Return type:

None

CopyReplaceVertices()
  • Copy edge and replace one or both its vertices to a given one(s). Vertex V1 replaces FORWARD vertex, and V2 - REVERSED, as they are found by TopoDS_Iterator. If V1 or V2 is NULL, the original vertex is taken
Parameters:
  • edge (TopoDS_Edge &) –
  • V1 (TopoDS_Vertex &) –
  • V2 (TopoDS_Vertex &) –
Return type:

TopoDS_Edge

MakeEdge()
  • Makes edge with curve and location
Parameters:
  • edge (TopoDS_Edge &) –
  • curve (Handle_Geom_Curve &) –
  • L (TopLoc_Location &) –
Return type:

None

  • Makes edge with curve, location and range [p1, p2]
Parameters:
  • edge (TopoDS_Edge &) –
  • curve (Handle_Geom_Curve &) –
  • L (TopLoc_Location &) –
  • p1 (float) –
  • p2 (float) –
Return type:

None

  • Makes edge with pcurve and face
Parameters:
  • edge (TopoDS_Edge &) –
  • pcurve (Handle_Geom2d_Curve &) –
  • face (TopoDS_Face &) –
Return type:

None

  • Makes edge with pcurve, face and range [p1, p2]
Parameters:
  • edge (TopoDS_Edge &) –
  • pcurve (Handle_Geom2d_Curve &) –
  • face (TopoDS_Face &) –
  • p1 (float) –
  • p2 (float) –
Return type:

None

  • Makes edge with pcurve, surface and location
Parameters:
  • edge (TopoDS_Edge &) –
  • pcurve (Handle_Geom2d_Curve &) –
  • S (Handle_Geom_Surface &) –
  • L (TopLoc_Location &) –
Return type:

None

  • Makes edge with pcurve, surface, location and range [p1, p2]
Parameters:
  • edge (TopoDS_Edge &) –
  • pcurve (Handle_Geom2d_Curve &) –
  • S (Handle_Geom_Surface &) –
  • L (TopLoc_Location &) –
  • p1 (float) –
  • p2 (float) –
Return type:

None

ReassignPCurve()
  • Reassign edge pcurve lying on face <old> to another face <sub>. If edge has two pcurves on <old> face, only one of them will be reassigned, and other will left alone. Similarly, if edge already had a pcurve on face <sub>, it will have two pcurves on it. Returns True if succeeded, False if no pcurve lying on <old> found.
Parameters:
  • edge (TopoDS_Edge &) –
  • old (TopoDS_Face &) –
  • sub (TopoDS_Face &) –
Return type:

bool

RemoveCurve3d()
  • Removes the Curve3D recorded in an Edge
Parameters:edge (TopoDS_Edge &) –
Return type:None
RemovePCurve()
  • Removes the PCurve(s) which could be recorded in an Edge for the given Face
Parameters:
  • edge (TopoDS_Edge &) –
  • face (TopoDS_Face &) –
Return type:

None

  • Removes the PCurve(s) which could be recorded in an Edge for the given Surface
Parameters:
  • edge (TopoDS_Edge &) –
  • surf (Handle_Geom_Surface &) –
Return type:

None

  • Removes the PCurve(s) which could be recorded in an Edge for the given Surface, with given Location
Parameters:
  • edge (TopoDS_Edge &) –
  • surf (Handle_Geom_Surface &) –
  • loc (TopLoc_Location &) –
Return type:

None

ReplacePCurve()
  • Replace the PCurve in an Edge for the given Face In case if edge is seam, i.e. has 2 pcurves on that face, only pcurve corresponding to the orientation of the edge is replaced
Parameters:
  • edge (TopoDS_Edge &) –
  • pcurve (Handle_Geom2d_Curve &) –
  • face (TopoDS_Face &) –
Return type:

None

SetRange3d()
  • Sets range on 3d curve only.
Parameters:
  • edge (TopoDS_Edge &) –
  • first (float) –
  • last (float) –
Return type:

None

TransformPCurve()
  • Transforms the PCurve with given matrix and affinity U factor.
Parameters:
  • pcurve (Handle_Geom2d_Curve &) –
  • trans (gp_Trsf2d) –
  • uFact (float) –
  • aFirst (float &) –
  • aLast (float &) –
Return type:

Handle_Geom2d_Curve

thisown

The membership flag

class OCC.ShapeBuild.ShapeBuild_ReShape

Bases: OCC.BRepTools.BRepTools_ReShape

Apply()
  • Applies the substitutions requests to a shape <until> gives the level of type until which requests are taken into account. For subshapes of the type <until> no rebuild and futher exploring are done. ACTUALLY, NOT IMPLEMENTED BELOW TopAbs_FACE <buildmode> says how to do on a SOLID,SHELL ... if one of its sub-shapes has been changed: 0: at least one Replace or Remove -> COMPOUND, else as such 1: at least one Remove (Replace are ignored) -> COMPOUND 2: Replace and Remove are both ignored If Replace/Remove are ignored or absent, the result as same type as the starting shape
Parameters:
  • shape (TopoDS_Shape &) –
  • until (TopAbs_ShapeEnum) –
  • buildmode (Standard_Integer) –
Return type:

TopoDS_Shape

  • Applies the substitutions requests to a shape. <until> gives the level of type until which requests are taken into account. For subshapes of the type <until> no rebuild and futher exploring are done. NOTE: each subshape can be replaced by shape of the same type or by shape containing only shapes of that type (for example, TopoDS_Edge can be replaced by TopoDS_Edge, TopoDS_Wire or TopoDS_Compound containing TopoDS_Edges). If incompatible shape type is encountered, it is ignored and flag FAIL1 is set in Status.
Parameters:
  • shape (TopoDS_Shape &) –
  • until (TopAbs_ShapeEnum) – default value is TopAbs_SHAPE
Return type:

TopoDS_Shape

  • Applies the substitutions requests to a shape. <until> gives the level of type until which requests are taken into account. For subshapes of the type <until> no rebuild and futher exploring are done. NOTE: each subshape can be replaced by shape of the same type or by shape containing only shapes of that type (for example, TopoDS_Edge can be replaced by TopoDS_Edge, TopoDS_Wire or TopoDS_Compound containing TopoDS_Edges). If incompatible shape type is encountered, it is ignored and flag FAIL1 is set in Status.
Parameters:
  • shape (TopoDS_Shape &) –
  • until (TopAbs_ShapeEnum) – default value is TopAbs_SHAPE
Return type:

TopoDS_Shape

GetHandle()

ShapeBuild_ReShape_GetHandle(ShapeBuild_ReShape self) -> Handle_ShapeBuild_ReShape

Status()
  • Returns a complete substitution status for a shape 0 : not recorded, <newsh> = original <shape> < 0: to be removed, <newsh> is NULL > 0: to be replaced, <newsh> is a new item If <last> is False, returns status and new shape recorded in the map directly for the shape, if True and status > 0 then recursively searches for the last status and new shape.
Parameters:
  • shape (TopoDS_Shape &) –
  • newsh (TopoDS_Shape &) –
  • last (bool) – default value is Standard_False
Return type:

int

  • Returns a complete substitution status for a shape 0 : not recorded, <newsh> = original <shape> < 0: to be removed, <newsh> is NULL > 0: to be replaced, <newsh> is a new item If <last> is False, returns status and new shape recorded in the map directly for the shape, if True and status > 0 then recursively searches for the last status and new shape.
Parameters:
  • shape (TopoDS_Shape &) –
  • newsh (TopoDS_Shape &) –
  • last (bool) – default value is Standard_False
Return type:

int

  • Queries the status of last call to Apply(shape,enum) OK : no (sub)shapes replaced or removed DONE1: source (starting) shape replaced DONE2: source (starting) shape removed DONE3: some subshapes replaced DONE4: some subshapes removed FAIL1: some replacements not done because of bad type of subshape
Parameters:status (ShapeExtend_Status) –
Return type:bool
thisown

The membership flag

class OCC.ShapeBuild.ShapeBuild_Vertex(*args, **kwargs)

Bases: object

CombineVertex()
  • Combines new vertex from two others. This new one is the smallest vertex which comprises both of the source vertices. The function takes into account the positions and tolerances of the source vertices. The tolerance of the new vertex will be equal to the minimal tolerance that is required to comprise source vertices multiplied by tolFactor (in order to avoid errors because of discreteness of calculations).
Parameters:
  • V1 (TopoDS_Vertex &) –
  • V2 (TopoDS_Vertex &) –
  • tolFactor (float) – default value is 1.0001
Return type:

TopoDS_Vertex

  • Combines new vertex from two others. This new one is the smallest vertex which comprises both of the source vertices. The function takes into account the positions and tolerances of the source vertices. The tolerance of the new vertex will be equal to the minimal tolerance that is required to comprise source vertices multiplied by tolFactor (in order to avoid errors because of discreteness of calculations).
Parameters:
  • V1 (TopoDS_Vertex &) –
  • V2 (TopoDS_Vertex &) –
  • tolFactor (float) – default value is 1.0001
Return type:

TopoDS_Vertex

  • The same function as above, except that it accepts two points and two tolerances instead of vertices
Parameters:
  • pnt1 (gp_Pnt) –
  • pnt2 (gp_Pnt) –
  • tol1 (float) –
  • tol2 (float) –
  • tolFactor (float) – default value is 1.0001
Return type:

TopoDS_Vertex

  • The same function as above, except that it accepts two points and two tolerances instead of vertices
Parameters:
  • pnt1 (gp_Pnt) –
  • pnt2 (gp_Pnt) –
  • tol1 (float) –
  • tol2 (float) –
  • tolFactor (float) – default value is 1.0001
Return type:

TopoDS_Vertex

thisown

The membership flag

class OCC.ShapeBuild.SwigPyIterator(*args, **kwargs)

Bases: object

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

The membership flag

value()
class OCC.ShapeBuild.shapebuild(*args, **kwargs)

Bases: object

static PlaneXOY()
  • Rebuilds a shape with substitution of some components Returns a Geom_Surface which is the Plane XOY (Z positive) This allows to consider an UV space homologous to a 3D space, with this support surface
Return type:Handle_Geom_Plane
thisown

The membership flag

OCC.ShapeBuild.shapebuild_PlaneXOY()
  • Rebuilds a shape with substitution of some components Returns a Geom_Surface which is the Plane XOY (Z positive) This allows to consider an UV space homologous to a 3D space, with this support surface
Return type:Handle_Geom_Plane