From OCP#
Conversion from OCP (OpenCASCADE Python) to volmdlr objects.
Module to translate objects in OCP to Volmdlr.
- volmdlr.from_ocp.beziercurve3d_from_ocp(cls, curve)#
Instantiate a volmdlr BezierCurve3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
curve – OCCT curve.
- Returns:
volmdlr BezierCurve3D.
- volmdlr.from_ocp.bsplinecurve2d_from_ocp(cls, curve)#
Instantiate a volmdlr BSplineCurve2D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
curve – OCCT curve.
- Returns:
volmdlr BSplineCurve2D.
- volmdlr.from_ocp.bsplinecurve3d_from_ocp(cls, curve)#
Instantiate a volmdlr BSplineCurve3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
curve – OCCT curve.
- Returns:
volmdlr BSplineCurve3D.
- volmdlr.from_ocp.bsplinecurve_from_ocp(cls, curve)#
Instantiate a volmdlr BSplineCurve, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
curve – OCCT curve.
- Returns:
volmdlr BSplineCurve2D.
- volmdlr.from_ocp.bsplinesurface_from_ocp(cls, occt_surface, **kwargs)#
Instantiate a volmdlr BSplineSurface3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
occt_surface – OCCT surface.
- Returns:
volmdlr BSplineSurface3D.
- volmdlr.from_ocp.circle2d_from_ocp(cls, curve)#
Instantiate a volmdlr Circle2D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
curve – OCCT curve.
- Returns:
volmdlr Circle2D.
- volmdlr.from_ocp.circle3d_from_ocp(cls, curve)#
Instantiate a volmdlr Circle3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
curve – OCCT curve.
- Returns:
volmdlr Circle3D.
- volmdlr.from_ocp.conicalsurface_from_ocp(cls, occt_surface, **kwargs)#
Instantiate a volmdlr ConicalSurface3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
occt_surface – OCCT surface.
- Returns:
volmdlr ConicalSurface3D.
- volmdlr.from_ocp.curve_from_ocp(occ_curve, curve_cls_dict)#
Instantiate a voldmlr equivalent curve of the given occ_curve.
- Parameters:
occ_curve – opencascade Geom_Curve
curve_cls_dict – Lookup table where the keys are occ curve type and the values the equivalent volmdlr class.
- Returns:
volmdlr.curves
- volmdlr.from_ocp.cylindricalsurface_from_ocp(cls, occt_surface, **kwargs)#
Instantiate a volmdlr CylindricalSurface3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
occt_surface – OCCT surface.
- Returns:
volmdlr CylindricalSurface3D.
- volmdlr.from_ocp.downcast(obj: TopoDS_Shape) TopoDS_Shape#
Downcast a TopoDS object to suitable specialized type.
- volmdlr.from_ocp.edge_from_ocp(ocp_edge: TopoDS_Shape, curves_lut: dict)#
Instantiate a volmdlr edge from an ocp edge.
- Parameters:
ocp_edge – ocp edge.
- Returns:
Volmdlr edge.
- volmdlr.from_ocp.ellipse2d_from_ocp(cls, curve)#
Instantiate a volmdlr Ellipse2D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
curve – OCCT curve.
- Returns:
volmdlr Ellipse2D.
- volmdlr.from_ocp.ellipse3d_from_ocp(cls, curve)#
Instantiate a volmdlr Ellipse3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
curve – OCCT curve.
- Returns:
volmdlr Ellipse3D.
- volmdlr.from_ocp.face_from_ocp(cls, occt_face: TopoDS_Shape, occt_to_volmdlr_lut: dict, surface2d_class)#
Translate an OCCT face retrieving its 2D wires into a volmdlr face.
- volmdlr.from_ocp.fix(obj: TopoDS_Shape) TopoDS_Shape#
Fix a TopoDS object to suitable specialized type.
- volmdlr.from_ocp.frame2d_from_ocp_ax22d(ax22d)#
Instantiate a volmdlr Frame2D, from occt object.
- Parameters:
ax22d – OCCT ax2 2d.
- Returns:
volmdlr Frame2D.
- volmdlr.from_ocp.frame3d_from_ocp_ax3(ax2)#
Instantiate a volmdlr Frame3D, from occt object.
- Parameters:
ax2 – OCCT ax2.
- Returns:
volmdlr Frame3D.
- volmdlr.from_ocp.get_contour2d_from_face_wire(contour2d_class, wire, face, occt_to_volmdlr)#
Get parametric representation of the face’s wires.
- volmdlr.from_ocp.get_faces(shape)#
Get faces from a shape.
- Parameters:
shape (OCP.TopoDS.TopoDS_Shape) – The shape.
- Returns:
Faces of shape.
- Return type:
list[OCP.TopoDS.TopoDS_Face]
- volmdlr.from_ocp.get_shells(shape)#
Get shells from a shape.
- Parameters:
shape (OCP.TopoDS.TopoDS_Shape) – The shape.
- Returns:
Faces of shape.
- Return type:
list[OCP.TopoDS.TopoDS_Face]
- volmdlr.from_ocp.get_wires(shape)#
Get wires from a shape.
- Parameters:
shape (OCP.TopoDS.TopoDS_Shape) – The shape.
- Returns:
Wires of shape.
- Return type:
list[OCP.TopoDS.TopoDS_Wire]
- volmdlr.from_ocp.get_wires_from_face(face)#
Return faces outer wire and a list of inner wires.
- volmdlr.from_ocp.hyperbola3d_from_ocp(cls, curve)#
Instantiate a volmdlr Hyperbola3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
curve – OCCT curve.
- Returns:
volmdlr Hyperbola3D.
- volmdlr.from_ocp.line2d_from_ocp(cls, occt_line)#
Instantiate a volmdlr Line2D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
occt_line – OCCT Line.
- Returns:
volmdlr Line2D.
- volmdlr.from_ocp.line3d_from_ocp(cls, occt_line)#
Instantiate a volmdlr Line3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
occt_line – OCCT Line 3D.
- Returns:
volmdlr Line3D.
- volmdlr.from_ocp.parabola3d_from_ocp(cls, curve)#
Instantiate a volmdlr Parabola3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
curve – OCCT curve.
- Returns:
volmdlr Parabola3D.
- volmdlr.from_ocp.plane_from_ocp(cls, occt_surface, **kwargs)#
Instantiate a volmdlr Plane3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
occt_surface – OCCT surface.
- Returns:
volmdlr Plane3D.
- volmdlr.from_ocp.point2d_from_ocp(occt_point)#
Instantiate a volmdlr Point2D, from occt object.
- Parameters:
occt_point – OCCT point.
- Returns:
volmdlr Point2D.
- volmdlr.from_ocp.point3d_from_ocp(occt_point)#
Instantiate a volmdlr Point3D, from occt object.
- Parameters:
occt_point – OCCT point.
- Returns:
volmdlr Point3D.
- volmdlr.from_ocp.point3d_from_ocp_vertex(vertex: TopoDS_Shape)#
Instantiate a volmdlr Point3D, from occt TopoDS_Vertex object.
- Parameters:
vertex – OCCT TopoDS_Shape.
- Returns:
volmdlr Point3D.
- volmdlr.from_ocp.shapetype(obj: TopoDS_Shape) TopAbs_ShapeEnum#
Return a number from 0 to 7, representing the type of the shape.
COMPOUND = 0 COMPSOLID = 1 SHELL = 2 FACE = 3 WIRE = 4 EDGE = 5 VERTEX = 6 SHAPE = 7
- volmdlr.from_ocp.sphericalsurface_from_ocp(cls, occt_surface, **kwargs)#
Instantiate a volmdlr SphericalSurface3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
occt_surface – OCCT surface.
- Returns:
volmdlr SphericalSurface3D.
- volmdlr.from_ocp.surface2d_from_ocp_face(cls, contour2d_class, face, occt_to_volmdlr)#
Build a surface 2D (Boundary representation of a face in volmdlr) from an OCP face.
- volmdlr.from_ocp.surfaceoflinearextrusion_from_ocp(cls, occt_surface, **kwargs)#
Instantiate a volmdlr ExtrusionSurface3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
occt_surface – OCCT surface.
- Returns:
volmdlr ExtrusionSurface3D.
- volmdlr.from_ocp.surfaceofrevolution_from_ocp(cls, occt_surface, **kwargs)#
Instantiate a volmdlr RevolutionSurface3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
occt_surface – OCCT surface.
- Returns:
volmdlr RevolutionSurface3D.
- volmdlr.from_ocp.toroidalsurface_from_ocp(cls, occt_surface, **kwargs)#
Instantiate a volmdlr ToroidalSurface3D, from occt object.
- Parameters:
cls – volmdlr class to be instantiated.
occt_surface – OCCT surface.
- Returns:
volmdlr ToroidalSurface3D.
- volmdlr.from_ocp.trim_bspline_curve(original_curve: Geom_BSplineCurve, u1: float, u2: float) Geom_BSplineCurve#
Trim a B-spline curve using two curve parameters and create a new B-spline curve.
- Parameters:
original_curve – The original B-spline curve to trim
u1 – The start parameter for trimming
u2 – The end parameter for trimming
- Returns:
A new trimmed B-spline curve, or None if projection fails
- volmdlr.from_ocp.trimmedcurve3d_from_ocp(cls, occt_curve)#
Intanciate an edge from a trimmed curve in OCCT.
- Parameters:
occt_curve – occt trimmed curve.
- Returns:
Volmdlr trimmed edge.
- volmdlr.from_ocp.vector2d_from_ocp(occt_vector)#
Instantiate a volmdlr Vector2D, from occt object.
- Parameters:
occt_vector – OCCT Vector.
- Returns:
volmdlr Vector2D.
- volmdlr.from_ocp.vector3d_from_ocp(occt_vector)#
Instantiate a volmdlr Vector3D, from occt object.
- Parameters:
occt_vector – OCCT Vector.
- Returns:
volmdlr Vector3D.
- volmdlr.from_ocp.volmdlr_edge2d_from_ocp_curve(cls, occt_curve, first, last, orientation)#
Instantiate a volmdlr edge form an occt curve.
- Parameters:
occt_curve – occt curve.
first – first point.
last – last point.
orientation – orientation of the curve to be considered.
- Returns:
Volmdlr trimmed edge.
- volmdlr.from_ocp.volmdlr_edge_from_ocp_curve(cls, occt_curve, first, last, orientation)#
Instantiate a volmdlr edge form an occt curve.
- Parameters:
occt_curve – occt curve.
first – first point.
last – last point.
orientation – orientation of the curve to be considered.
- Returns:
Volmdlr trimmed edge.