Primitives (hwx.inspire.Primitives)#

class Primitives#

Bases: object

Utilites to create parts with primitive shapes.

The supported primitive shapes are block, cone, polygon, ellipsoid, prism, sphere, torus and etc.

Method Table#

Name

Description

createCurves (self, points, **kwds)

Creates a list of SplineCurve parts that connect the points.

createEmptyPart (self, **kwds)

Creates an empty part.

createPointPart (self, **kwds)

Creates a point part.

createPolylines (self, points, **kwds)

Creates a list of Polyline parts that connect the points.

createSheetCircle (self, radius=1, **kwds)

Creates a circle centered at the origin in the XY plane.

createSheetPolygon (self, radius=1, nsides=3, **kwds)

Creates a regular polygon centered at the origin in the XY-plane.

createSheetRectangle (self, x=1, y=1, **kwds)

Creates a rectangle centered at the origin.

createSolidBlock (self, x=1, y=1, z=1, **kwds)

Creates a solid block with the center of the base at the origin.

createSolidCone (self, radius=1, height=1, semiangle=0, **kwds)

Creates a a solid cone with the base centered at the origin in the XY

createSolidCylinder (self, radius=1, height=1, **kwds)

Creates a solid cylinder with the base centered at the origin in the XY

createSolidEllipsoid (self, xRadius=1, yRadius=0.5, zRadius=0.25, **kwds)

Creates a solid ellipsoid centered at the origin.

createSolidPrism (self, radius=1, height=1, nsides=20, blendradius=0, **kwds)

Creates a solid prism with the base centered at the origin in the XY

createSolidSphere (self, radius=1, **kwds)

Creates a solid sphere with centre at origin.

createSolidTorus (self, majorRadius=1, minorRadius=0.5, **kwds)

Creates a solid torus centered at the origin, located in the XY-plane

createEmptyPart(**kwds)#

Creates an empty part.

Parameters:

**kwds – Part attributes like name, position, color…

Returns:

Part

createPointPart(**kwds)#

Creates a point part.

Parameters:

**kwds – Part attributes like name, location, color…

Returns:

Part

createPolylines(points, **kwds)#

Creates a list of Polyline parts that connect the points.

If the points don’t have intersections, creates one Polyline part. Otherwise, creates one Polyline part for each section.

Parameters:
  • points (list[math.Point]) – List of points to create the Polyline part.

  • **kwds – Part attributes like name, position, color…

Returns:

List of created parts.

Return type:

list[Part]

createCurves(points, **kwds)#

Creates a list of SplineCurve parts that connect the points.

If the points don’t have intersections, creates one SplineCurve part. Otherwise, creates one SplineCurve part for each section.

Parameters:
  • points (list[math.Point]) – List of points used to create the SplineCurve part.

  • **kwds – Part attributes like name, position, color…

Returns:

List of created parts.

Return type:

list [Part]

createSolidBlock(x=1, y=1, z=1, **kwds)#

Creates a solid block with the center of the base at the origin.

Parameters:
  • x (float) – The length.

  • y (float) – The width.

  • z (float) – The height.

  • **kwds – Part attributes like name, position, color…

Returns:

Part

createSolidCylinder(radius=1, height=1, **kwds)#

Creates a solid cylinder with the base centered at the origin in the XY plane and the height extending along the z-axis.

Parameters:
  • radius (float) – The radius in the XY-plane.

  • height (float) – The height along z-axis.

  • **kwds – Part attributes like name, position, color…

Returns:

Part

createSolidPrism(radius=1, height=1, nsides=20, blendradius=0, **kwds)#

Creates a solid prism with the base centered at the origin in the XY plane and the height extending along the z-axis.

Parameters:
  • radius (float) – The radius in the XY-plane.

  • height (float) – The height along z-axis.

  • nsides (int) – The number of facets. Must be > 2.

  • blendradius (float) – The radius used to round the corners.

  • **kwds – Part attributes like name, position, color…

Returns:

Part

createSolidCone(radius=1, height=1, semiangle=0, **kwds)#

Creates a a solid cone with the base centered at the origin in the XY plane and the height extending along the z-axis.

Parameters:
  • radius (float) – The radius in the XY-plane.

  • height (float) – The height along z-axis.

  • semiangle (float) – The angle the cone makes with the z-axis. Must be > 0 < pi/2.

  • **kwds – Part attributes like name, position, color…

Returns:

Part

createSolidSphere(radius=1, **kwds)#

Creates a solid sphere with centre at origin.

Parameters:
  • radius (float) –

  • **kwds – Part attributes like name, location, color…

Returns:

Part

createSolidTorus(majorRadius=1, minorRadius=0.5, **kwds)#

Creates a solid torus centered at the origin, located in the XY-plane with the z-axis sticking through the hole.

Parameters:
  • majorRadius (float) – The radius from the hole’s center to the rim’s midline.

  • minorRadius (float) – The radius of the cross section of the rim. Must be less than majorRadius.

  • **kwds – Part attributes like name, position, color…

Returns:

Part

createSolidEllipsoid(xRadius=1, yRadius=0.5, zRadius=0.25, **kwds)#

Creates a solid ellipsoid centered at the origin.

Parameters:
  • xRadius (float) – The radius in x-axis.

  • yRadius (float) – The radius in y-axis.

  • zRadius (float) – The radius in z-axis.

  • **kwds – Part attributes like name, position, color…

Returns:

Part

createSheetCircle(radius=1, **kwds)#

Creates a circle centered at the origin in the XY plane.

Parameters:
  • radius (float) –

  • **kwds – Part attributes like name, position, color…

Returns:

Part

createSheetPolygon(radius=1, nsides=3, **kwds)#

Creates a regular polygon centered at the origin in the XY-plane.

Parameters:
  • radius (float) – The distance from the center to a vertex.

  • nsides (int) – The number of sides. Must be > 2.

  • **kwds – Part attributes like name, position, color…

Returns:

Part

createSheetRectangle(x=1, y=1, **kwds)#

Creates a rectangle centered at the origin.

Parameters:
  • x (float) – The length.

  • y (float) – The width.

  • **kwds – Part attributes like name, position, color…

Returns:

Part