We’re putting the final touches on our new badges platform. Badge issuance remains temporarily paused, but all completions are being recorded and will be fulfilled once the platform is live. Thank you for your patience.
3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

SpaceClaim Python API: Getting the results of a Check Geometry

    • Sterling Butters
      Subscriber

      I'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?

    • mjmiddle
      Ansys Employee

      The 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

Viewing 1 reply thread
  • The topic ‘SpaceClaim Python API: Getting the results of a Check Geometry’ is closed to new replies.