The Geometry
object provides an API for the
Geometry tree object.
To access the Geometry
object:
geometry = Model.Geometry
The Geometry
object exposes several convenient methods for
adding child objects. For example, you can add a point mass to the
Geometry
object by calling the method
AddPointMass
.
point_mass = geometry.AddPointMass()
For this point mass, you can assign a location:
my_selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) my_selection.Ids = [22] point_mass.Location = my_selection
For the above point mass, accessible properties include:
point_mass.Mass = Quantity("12 [kg]") point_mass.MassMomentOfInertiaX = Quantity("1.1 [kg m m]") point_mass.MassMomentOfInertiaY = Quantity("1.2 [kg m m]") point_mass.MassMomentOfInertiaZ = Quantity("1.3 [kg m m]") point_mass.Behavior = LoadBehavior.Coupled point_mass.PinballRegion = Quantity("0.2 [m]")
Combining the three previous actions, the geometry now contains a fully defined point mass.

You can export the Geometry
object to an STL
(STereoLithography) file, which is the most commonly used file format in 3D
printing. The following command exports the geometry object to an STL file.
Model.Geometry.ExportToSTL("C:\Temp\geoasstl.stl")
The result is the creation of a geometry file (geoasst1.stl) to the fully qualified directory path (C:\Temp).