compas_cylinder_from_occ_cylinder

compas_occ.conversions.compas_cylinder_from_occ_cylinder(cylinder: OCC.Core.gp.gp_Cylinder, cls: Optional[Type[compas.geometry.shapes.cylinder.Cylinder]] = None) compas.geometry.shapes.cylinder.Cylinder

Convert an OCC cylinder to a COMPAS cylinder.

Parameters
cylindergp_Cylinder

The OCC cylinder.

clsType[Cylinder], optional

The type of COMPAS cylinder.

Returns
Cylinder

See also

compas_sphere_from_occ_sphere()

Examples

>>> from OCC.Core.gp import gp_Pnt, gp_Dir, gp_Ax3, gp_Cylinder
>>> from compas_occ.conversions import compas_cylinder_from_occ_cylinder
>>> ax3 = gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1), gp_Dir(1, 0, 0))
>>> cylinder = gp_Cylinder(ax3, 1)
>>> compas_cylinder_from_occ_cylinder(cylinder)
Cylinder(radius=1.0, height=1.0, frame=Frame(point=Point(0.0, 0.0, z=0.0), xaxis=Vector(x=1.0, y=0.0, z=-0.0), yaxis=Vector(x=-0.0, y=1.0, z=0.0)))