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

Rajesh Meena
Rajesh Meena Moderator, Employee Posts: 85
10 Comments 5 Answers First Anniversary Solution Developer Community of Practice Member
✭✭✭✭

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: 85
    10 Comments 5 Answers First Anniversary Solution Developer Community of Practice Member
    ✭✭✭✭
    Answer ✓

    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)