-
Notifications
You must be signed in to change notification settings - Fork 3
Implement GeometryTrees to contain and handle Regions #545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# Conflicts: # src/ansys/motorcad/core/geometry.py
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #545 +/- ##
==========================================
- Coverage 88.46% 85.82% -2.64%
==========================================
Files 21 23 +2
Lines 2583 3062 +479
==========================================
+ Hits 2285 2628 +343
- Misses 298 434 +136 🚀 New features to boost your workflow:
|
When I try this in the latest v2026R1 build with the e10 template, I get an error referring to the Endcap: "ValueError: 'Endcap' is not a valid RegionType" This is the script I ran: mc = pymotorcad.MotorCAD() mc.load_template("e10") geometry_tree = mc.get_geometry_tree()` |
I think the endcap issue should be fixed now: just a region type that seems to have slipped through the cracks and had never been added to the RegionType enumeration. |
Geometry tree nodes have the protected attribute _motorcad_instance. This seems to be None. Shouldn't it be the same as the geometry tree's mc attribute? I found this because I wanted to unite some nodes, but had to set the _motorcad_instance first. |
Yes! I hadn't actually noticed that they inherited such an attribute from Regions, so hadn't been setting it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested this out and it seems to work nicely. I've implemented the geometry tree functionality in this Adaptive Templates example: #555
Implement GeometryTrees, a subclass of dict, which contain GeometryNode, a subclass of Region. Each node contains direct pointers to its parent and child nodes, avoiding additional API calls.