How to Work with Profiles in Python

How to Work with Profiles in Python

A Profile in Aspose.3D for Python is a 2D shape defined in the xy plane — typically an IFC-style structural cross-section such as CShape, LShape, TShape, UShape, or ZShape. Profile extends Entity, so a profile instance can be attached to a node and carried through the scene graph like any other entity, with its own name, properties, and bounding box.

Step-by-Step Guide

Step 1: Install the Package

pip install aspose-3d-foss
python -c "import aspose.threed; print(aspose.threed.__name__)"

Step 2: Import a Profile Class

from aspose.threed import Scene
from aspose.threed.entities import CShape

Step 3: Construct and Configure a Parametric Profile

CShape models an IFC C-shape cross-section. Configure its dimensions through its properties — the centre of the profile sits at the centre of its bounding box:

from aspose.threed.entities import CShape

beam_profile = CShape("MainBeamProfile")
beam_profile.depth = 120.0
beam_profile.width = 60.0
beam_profile.girth = 20.0
beam_profile.wall_thickness = 4.0
beam_profile.internal_fillet_radius = 2.0

Step 4: Read the Profile’s 2D Extent and Bounding Box

Every parameterized profile exposes get_extent() for its raw width/depth size, and the usual get_bounding_box() inherited from Entity:

extent = beam_profile.get_extent()
print(f"extent: {extent.x} x {extent.y}")

bbox = beam_profile.get_bounding_box()
print(bbox.minimum, bbox.maximum)

Step 5: Attach the Profile to a Node

Because Profile is an Entity, attach it to the scene graph the same way as any other entity:

from aspose.threed import Scene
from aspose.threed.entities import CShape

scene = Scene()
beam_profile = CShape("MainBeamProfile")
beam_profile.depth = 120.0
beam_profile.width = 60.0

node = scene.root_node.create_child_node("BeamCrossSection", entity=beam_profile)
print(node.entity.get_extent().x)

Common Issues and Fixes

Expecting a 3D solid mesh directly from a profile. A Profile is a 2D cross-section definition only — it carries dimension data (depth, width, girth, …) and a 2D extent/bounding box, not a renderable 3D mesh. Converting a profile to a solid through extrusion (LinearExtrusion.to_mesh()) or revolution/sweep (RevolvedAreaSolid, SweptAreaSolid) is not implemented in this release — those classes exist in the API surface but raise an error at call time. Use a profile for carrying parametric cross-section data, not for generating final 3D geometry.

get_extent() returns values that don’t match what was set. For CShape, get_extent() returns (width, depth) as a Vector2 — it does not include the girth or wall-thickness properties, which describe the shape’s internal structure rather than its overall bounding size.

Constructing a profile without a name still works but makes debugging harder. The constructor’s name argument defaults to empty — pass an explicit name (as in the examples above) so the profile is identifiable later when inspecting the attached entity’s name or walking the scene graph.

Frequently Asked Questions

Which profile shapes are available besides CShape?

LShape, TShape, UShape, and ZShape follow the same IFC-style parametric pattern — each with its own dimension properties. ArbitraryProfile and MirroredProfile build profiles from arbitrary curves rather than fixed parameters, and CenterLineProfile defines a profile along a centre line.

Can a profile be used as a regular 2D curve for other geometry?

Profile and its subclasses expose get_bounding_box() and get_extent() for inspection, but there is no implemented conversion path from a profile to a usable 3D Mesh in this release — see the Common Issues note on extrusion/revolution above.

Do profiles support the generic property system like other entities?

Yes — find_property(), get_property(), set_property(), and remove_property() are available on every Profile, inherited the same way as on Mesh, Node, or any other Entity/A3DObject subclass.

Is there a rectangular or circular profile class?

Not in the current class list — the available parameterized profiles model IFC structural cross-sections (CShape, LShape, TShape, UShape, ZShape). For a simple rectangle or circle outline, build it as an ArbitraryProfile from your own curve data instead.

See Also