ansys/pyansys-geometry

Add ability to query the entire geometry tree from server

Closed this issue ยท 3 comments

๐Ÿ“ Description of the feature

Query the entire assembly hierarchy and populate the client-side data model with the id's of the bodies, components, etc...

This is especially important when importing geometry. If the geometry was not created using pygeometry, the data model needs to be populated so that pygeometry can be fully functional.

Other considerations:

  • If the server performs an action that makes the client "out-of-date", we need a mechanism to detect this and refresh it
  • For large models, we must ensure there are no serious performance issues, otherwise we will need to rethink our approach

๐Ÿ’ก Steps for implementing the feature

No response

๐Ÿ”— Useful links and references

No response

This one is really good (and needed). I'll assign myself to it if you don't mind @jonahrb

Starting to work on this. First use case:

  • Initiate a Geometry service
  • Connect PyGeometry to it and model a certain Design
  • Disconnect from it and create a new PyGeometry client session
  • With this new client session, try to discover the already existing design
  • Implement a test that validates this concept

Extra tasks:

  • Maybe stress out in the process and yell to the computer screen "why is this not working"
  • Have fun

Here is some pseudo code I wrote for reading a JSON component with our new refactor

  • Component (You're reading a JSON component)
    • If has a part
      • Create a Part โ€“ (we have fields for id, name, but not needed)
      • Create a TemplateBody for each body in part, add to new Part โ€“ (id, name, is_surface)
      • Create a TransformedPart for each component in part โ€“ (we have fields for id, name, but not needed)
        • TransformedPart.component_master_id <- component.id in part so we can identify this TransformedPart later
      • Find proper TransformedPart for this component by comparing this component.id to TransformedPart.component_master_id
        • TransformedPart.transform <- world/relative transform of this component
      • Create a Component with this TransformedPart โ€“ (name, parent, preexisting_id, transformed_part)
    • If no part
      • Find the TransformedPart that has the same component_master_id as this component.id
      • TransformedPart.transform <- world/relative transform of this component
      • Create a Component with this TP you found โ€“ (name, parent, preexisting_id, transformed_part)
    • Recurse for each component in components