How to extract a list of all beams with their properties in my design using SpaceClaim Scripting?
I have a design in SpaceClaim that contains several beams, nested in components and subcomponents and I would like to extract a list of all the beams along with location and section properties for design validation.
Best Answer
-
Here are some options to extract a list of your beams in SpaceClaim using scripting:
Using the following will extract only top-level beams (will miss beams that are nested in components and sub-components):
all_beams = GetRootPart().Beams
You can use the following will extract all beams from your design:
all_beams = GetRootPart().GetDescendants[IBeam]()
Note that the line above will extract some beams as
BeamGeneral
object type, instead ofBeam
. The first object type is missing some properties, so it is advised to retrieve the “Beam” object out of these as well. To do this conversion you can use the.Master
routine. Here is a simple example for SpaceClaim API v22, which you can use when iterating over your list of beams before extracting properties:for beam in all_beams: if str(beam.GetType()) == "SpaceClaim.Api.V22.BeamGeneral": beam = beam.Master
Here is a list of useful beam properties you can extract with Scripting:
Beam Location Start Point (.X, .Y, or .Z will get individual corresponding coordinates) beam.Shape.StartPoint
End Point (.X, .Y, or .Z will get individual corresponding coordinates) beam.Shape.EndPoint
Beam Length beam.Shape.Length
Section Properties Beam Orientation Angle (rad) beam.SectionAngle
Section Area beam.SectionProperties.Area
Moment of Inertia (also .Ixy and .Iyy) beam.SectionProperties.Ixx
Section Centroid Point (.U and .V will report in-plane individual coordinates) beam.SectionProperties.Centroid
0