-
Notifications
You must be signed in to change notification settings - Fork 22
chore: v1 implementation of bodies stub #2400
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
base: main
Are you sure you want to change the base?
Conversation
…geometry into feat/bodiesv1stub
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2400 +/- ##
==========================================
- Coverage 91.61% 88.27% -3.34%
==========================================
Files 169 167 -2
Lines 11839 11808 -31
==========================================
- Hits 10846 10424 -422
- Misses 993 1384 +391 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…geometry into feat/bodiesv1stub
jacobrkerstetter
left a comment
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.
Overall looking really good especially on the bodies.py side. Just a few small changes, nothing major
| if isinstance(input, Measurement): | ||
| # Measurement object | ||
| return GRPCQuantity(value_in_geometry_units=input.value.m_as(DEFAULT_UNITS.SERVER_ANGLE)) | ||
| else: | ||
| # Raw pint Quantity | ||
| return GRPCQuantity(value_in_geometry_units=input.m_as(DEFAULT_UNITS.SERVER_ANGLE)) |
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.
same comment here, no pint quantities in. These should be converted before sending to the _services layer
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.
like you did above, there is an Angle class
| resp = self.stub.RemoveAssignedCADMaterial(request=request) | ||
|
|
||
| # Return the response - formatted as a dictionary | ||
| return {"successfully_removed": [id for id in resp.successfully_removed_ids]} |
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.
This might need to be id.id to extract the string
| target_selection_ids=[build_grpc_id(target_body.id)], | ||
| tool_selection_ids=[build_grpc_id(body.id) for body in other_bodies], |
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.
We should be sending in just the string so no need for a .id call
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.
@umutsoysalansys - still concerned with these. This code in body.py should be updated to send self.id and other.id and then we can remove the .id call on target_body and other_bodies
response = self._template._grpc_client.services.bodies.combine(
target=self,
other=other,
type_bool_op=method,
err_msg=err_msg,
keep_other=keep_other,
transfer_named_selections=False,
)
…geometry into feat/bodiesv1stub
jacobrkerstetter
left a comment
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.
Definitely want to align the boolean call with how we handle id's before merging but other than that minor comments on conversion. Since I'm doing a cleanup PR later if these need to go in there they can.
| target_selection_ids=[build_grpc_id(target_body.id)], | ||
| tool_selection_ids=[build_grpc_id(body.id) for body in other_bodies], |
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.
@umutsoysalansys - still concerned with these. This code in body.py should be updated to send self.id and other.id and then we can remove the .id call on target_body and other_bodies
response = self._template._grpc_client.services.bodies.combine(
target=self,
other=other,
type_bool_op=method,
err_msg=err_msg,
keep_other=keep_other,
transfer_named_selections=False,
)
| from ansys.geometry.core.misc.measurements import Distance | ||
|
|
||
| # Handle both Measurement objects (which have .value attribute) | ||
| if isinstance(input, Distance): | ||
| # Measurement object | ||
| return GRPCQuantity(value_in_geometry_units=input.value.m_as(DEFAULT_UNITS.SERVER_LENGTH)) | ||
| else: | ||
| # Raw pint Quantity | ||
| return GRPCQuantity(value_in_geometry_units=input.m_as(DEFAULT_UNITS.SERVER_LENGTH)) |
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.
since you changed the input type to distance you can probably boil this down to one case
| if isinstance(input, Measurement): | ||
| # Measurement object | ||
| return GRPCQuantity(value_in_geometry_units=input.value.m_as(DEFAULT_UNITS.SERVER_ANGLE)) | ||
| else: | ||
| # Raw pint Quantity | ||
| return GRPCQuantity(value_in_geometry_units=input.m_as(DEFAULT_UNITS.SERVER_ANGLE)) |
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.
like you did above, there is an Angle class
angle conversion
…geometry into feat/bodiesv1stub
| return GRPCQuantity(value_in_geometry_units=input.value.m_as(DEFAULT_UNITS.SERVER_LENGTH)) | ||
| else: | ||
| # Raw pint Quantity | ||
| return GRPCQuantity(value_in_geometry_units=input.m_as(DEFAULT_UNITS.SERVER_LENGTH)) |
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.
@umutsoysalansys this doesn't seems to work for driving dimension's value, for it doesn't has any "m_as" member.
Description
Bodies implementation for V1.
Notes:
Current Test failures on test_design.py
Issue linked
Please mention the issue number or describe the problem this pull request addresses.
Checklist
feat: extrude circle to cylinder)