Skip to content

Conversation

aidanc-ansys
Copy link
Contributor

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.

Copy link

codecov bot commented Jun 30, 2025

Codecov Report

❌ Patch coverage is 97.14286% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.82%. Comparing base (3a8c3f3) to head (890c0b0).
⚠️ Report is 7 commits behind head on main.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aidanc-ansys aidanc-ansys self-assigned this Jul 15, 2025
@JackB-Ansys
Copy link
Collaborator

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:
`import ansys.motorcad.core as pymotorcad

mc = pymotorcad.MotorCAD()

mc.load_template("e10")

geometry_tree = mc.get_geometry_tree()`

@aidanc-ansys
Copy link
Contributor Author

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.

@JackB-Ansys
Copy link
Collaborator

JackB-Ansys commented Jul 29, 2025

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.

@aidanc-ansys
Copy link
Contributor Author

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

JackB-Ansys
JackB-Ansys previously approved these changes Jul 29, 2025
Copy link
Collaborator

@JackB-Ansys JackB-Ansys left a 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

@aidanc-ansys aidanc-ansys merged commit b2bc1bb into main Aug 6, 2025
72 of 77 checks passed
@aidanc-ansys aidanc-ansys deleted the add_get_set_tree_method branch August 6, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants