How do you flip the normal direction of a surface body via SpaceClaim scripting?

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

In SpaceClaim and Discovery the normal of a solid body is always "out" of the solid. For surface bodies the connected faces should always have consistent normal direction, but this direction can be flipped. In the interface you can flip the normal direction by using the tool in Measure - Quality - Normal, selecting a face and right-clicking and selecting "Reverse Face Normal". How can this be done via scripting?

Best Answer

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

    In SpaceClaim and Discovery API there is no direct API to perform this action, but you can use the Command method to call the same functions as the UI. See the process below based on some "Face" in the model defined as an IDesignFace.

    from SpaceClaim.Api.V22 import Command #or whatever version of the API you are using.
    Selection.Create(Face).SetActive()
    Command.Execute("AnalysisNormal")
    Command.Execute("ReverseFaceNormal")