How can I extract basic geometry information for a body in SpaceClaim?

Options
Nikos Kallitsis
Nikos Kallitsis Member, Employee Posts: 24
First Anniversary First Comment Ansys Employee Name Dropper

I have some bodies designed in SpaceClaim and want to extract some basic geometric information like body center and bounding box.

Best Answer

  • Nikos Kallitsis
    Nikos Kallitsis Member, Employee Posts: 24
    First Anniversary First Comment Ansys Employee Name Dropper
    Answer ✓
    Options

    You can extract the requested information by using SpaceClaim scripting. Here is a sample script:

    #Body Center
    bodySelection = BodySelection.Create(GetRootPart().Bodies[0])
    designBodySelection = body.Bodies[0]
    bodyMassProp = designBodySelection.MassProperties
    bodyCenter = bodyMassProp.PrincipleAxes.Origin
    bodyCenterX = bodyCenter.X
    bodyCenterY = bodyCenter.Y
    bodyCenterZ = bodyCenter.Z
    
    #Body Bounding Box
    bodyBox = designBodySelection.Shape.GetBoundingBox(Matrix.Identity)
    bodyCenter2 = bodyBox.Center #Should be equal to bodyCenter from above
    bodyCorners = bodyBox.Corners
    bodyCornerPoint = bodyCorners[0]
    bodyCornerPointX = bodyCornerPoint.X