How to check in SpaceClaim if a body is a surface body?

Options
Andrew Stankovich
Andrew Stankovich Member, Employee Posts: 10
Ansys Employee First Comment Photogenic
edited June 2023 in 3D Design

How can you use SpaceClaim scripting API to check if a body is a surface body or solid body?

Best Answer

  • Andrew Stankovich
    Andrew Stankovich Member, Employee Posts: 10
    Ansys Employee First Comment Photogenic
    Answer ✓
    Options

    In SpaceClaim and Discovery we can have a solid or surface design body. Any body with faces that form a completely closed (watertight) volume is considered a solid. Bodies with surfaces that do not "close" are considered as surface bodies.

    There is API listed below to perform this check. Note, the IsClosed property only exists in the Shape of the DesignBody and not the instance IDesignBody so the GetMaster() script command is used.

    all_bodies=GetRootPart().GetAllBodies()
    for body in all_bodies:
        is_solid=body.GetMaster().Shape.IsClosed
        body_name=body.GetName()
        print("Body name: %s is a solid body: %s"%(body_name,is_solid))