Get bounding box of whole CAD assembly in SpaceClaim/Disovery.

Options
Rajesh Meena
Rajesh Meena Moderator, Employee Posts: 67
First Anniversary Solution Developer Community of Practice Member Ansys Employee 5 Likes

I would like to get the bounding box of the whole CAD using script. Is that any way to do that?

Best Answer

  • Rajesh Meena
    Rajesh Meena Moderator, Employee Posts: 67
    First Anniversary Solution Developer Community of Practice Member Ansys Employee 5 Likes
    Answer ✓
    Options

    You can sum the bounding boxes. I would do something like this:

    comp = ComponentSelection.Create(GetRootPart().Components[0])
    box = Box.Empty
    bodies = comp.ConvertToBodies()
    for body in bodies:
        box = box | body.Shape.GetBoundingBox(Matrix.Identity)
    
    curves = comp.ConvertToCurves()
    for curve in curves:
        box = box | curve.Shape.GetBoundingBox(Matrix.Identity)