Profiles
Overview
Profile is the base class for 2D cross-sections defined in the xy plane. The parameterized profile shapes — RectangleShape, CircleShape, EllipseShape, and LShape — each describe a simple 2D outline with a small set of dimension properties. On their own they are flat; combined with LinearExtrusion, a profile becomes a 3D solid.
Parameterized profile shapes
Each shape exposes only the dimension properties relevant to its outline. RectangleShape takes width and depth:
from aspose.threed.entities import RectangleShape
shape = RectangleShape()
shape.width = 2.0
shape.depth = 1.0CircleShape takes a single radius; EllipseShape takes semi_axis1 and semi_axis2; LShape takes depth, width, thickness, fillet_radius, and edge_radius for an L-beam cross-section. All four support get_extent(), which returns the shape’s 2D bounding size as a Vector2, and get_bounding_box() for the 3D bounding box.
Extruding a profile into a solid
LinearExtrusion turns any Profile into a Mesh by sweeping it along a direction for a given height:
from aspose.threed import Scene
from aspose.threed.entities import RectangleShape, LinearExtrusion
scene = Scene()
shape = RectangleShape()
shape.width = 2.0
shape.depth = 1.0
extrusion = LinearExtrusion()
extrusion.shape = shape
extrusion.height = 5.0
scene.root_node.create_child_node("Beam", entity=extrusion.to_mesh())
scene.save("beam.stl")LinearExtrusion.slices controls how many cross-section slices are generated along the extrusion, center controls whether the extrusion is centered on its direction axis, and twist / twist_offset apply a rotation gradient along the length.
Tips and Best Practices
- Set every dimension property the shape needs before calling to_mesh() (directly, or indirectly through LinearExtrusion) — an unset numeric property defaults to zero and produces a degenerate shape.
- Use get_extent() to sanity-check a profile’s 2D size before extruding it, rather than discovering the mistake after exporting a file.
- LShape is the only profile shape with more than two dimension properties — set depth, width, thickness, fillet_radius, and edge_radius together so the cross-section stays geometrically consistent.
- Treat a Profile as flat, 2D data; it only becomes visible 3D geometry once it is driven through LinearExtrusion.to_mesh() (or another consumer that accepts a Profile).
Common Issues
| Issue | Cause | Fix |
|---|---|---|
| Extruded solid has zero volume | A dimension property (width, depth, radius, etc.) was left at its default | Set every required dimension property on the shape before extruding |
| LinearExtrusion.to_mesh() produces an unexpectedly twisted shape | twist or twist_offset was set unintentionally | Leave twist at 0.0 for a straight extrusion |
| Profile shape looks flipped or offset after extrusion | direction or center was not set as expected | Set LinearExtrusion.direction explicitly, and set center to match whether you want the extrusion centered on its axis |
FAQ
Can I use a Profile shape directly as a Node’s entity?
No — Profile shapes are 2D cross-section data, not geometry a Node can render directly. Drive them through LinearExtrusion.to_mesh() to get a Mesh you can attach to a node.
Which profile shape should I use for a simple rectangular beam?
RectangleShape, with width and depth set to the beam’s cross-section dimensions, extruded with LinearExtrusion to the beam’s length.
Does every parameterized profile shape support get_extent()?
Yes — RectangleShape, CircleShape, EllipseShape, and LShape all implement get_extent(), returning the shape’s 2D size as a Vector2.
API Reference Summary
| Class/Method | Description |
|---|---|
| Profile | Base class for 2D cross-sections in the xy plane |
| ParameterizedProfile | Base class for the parameter-driven profile shapes |
| RectangleShape | width, depth |
| CircleShape | radius |
| EllipseShape | semi_axis1, semi_axis2 |
| LShape | depth, width, thickness, fillet_radius, edge_radius |
| LinearExtrusion | Sweeps a Profile.shape into a Mesh via to_mesh() |
| LinearExtrusion.height / .slices / .twist | Extrusion controls |