TAGGED: ansys-spaceclaim, api, python, script
-
-
July 5, 2023 at 9:39 pm
Sterling Butters
SubscriberI'm currently checking the geometry with:
all_bodies = GetRootPart().GetAllBodies()
selection = BodySelection.Create(all_bodies)
result = ApplicationHelper.CheckGeometry(selection)
print(result)but this simply reports "True". What does that mean (since I know that I have some bodies with geometry errors)? Ideally, the result would be a list/dictionary of all parts and the associated errors that you would normally see in the dialog. Is there another class/method I should be using to check geometry using the API?
-
July 6, 2023 at 7:49 pm
mjmiddle
Ansys EmployeeThe result of an operation returns a booean True or False when directly queried which is indicating whether the action succeded without error, but this is an object that is not boolean and will have many properties/methods below it when queried with dir(). In this case, the important object beneath result is "Messages." It will show it is type Dictionary[IDesignBody, IList[CheckMessage]].
So get messages for the first body this way:
all_bodies = GetRootPart().GetAllBodies()
selection = BodySelection.Create(all_bodies)
result = ApplicationHelper.CheckGeometry(selection)
Body1Messages = result.Messages[GetRootPart().Bodies[0]]
if Body1Messages.Count == 0:
  pass
  #no errors
else:
  for mess in Body1Messages:
    print(mess.ModelerMessage)
    # other objects under mess to get IDs of problem geometry
-
- The topic ‘SpaceClaim Python API: Getting the results of a Check Geometry’ is closed to new replies.
-
3155
-
1013
-
956
-
858
-
797
© 2025 Copyright ANSYS, Inc. All rights reserved.