Skip to content
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

Feat/4010 pass primitive features #4019

Merged
merged 10 commits into from
Jan 2, 2024

Conversation

dcrawforAtAnsys
Copy link
Collaborator

No description provided.

Update GeometryModeler._create_object in Primitives.py
Add **kwargs as last argument to most primitive creation methods in Primitives3D
Addressed a defect #4017 that was identified while updating unit tests.
Added documentation and updated the unit tests to allow properties of primitives to be set using arguments when they are created.
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@github-actions github-actions bot added the enhancement New features or code improvements label Dec 29, 2023
A comma on the last line in a list of arguments is invalid Python 2.7 syntax.
Copy link

codecov bot commented Dec 29, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (a12085f) 81.41% compared to head (7bf61cd) 81.42%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4019   +/-   ##
=======================================
  Coverage   81.41%   81.42%           
=======================================
  Files         182      182           
  Lines       63313    63322    +9     
=======================================
+ Hits        51549    51558    +9     
  Misses      11764    11764           

- Address a syntax change in Maxwell 2D for primitives in Primitives2D in the plane property.
- Automate assignment of any valid property to a primitive on instantiation using kwargs.
test_09_plot() was failing because the regular polygon start and first position were along the z-axis while the polygon should have been in the XY plane.  This was also the case in the "main" branch.
@dcrawforAtAnsys
Copy link
Collaborator Author

dcrawforAtAnsys commented Dec 30, 2023

@PipKat : I've added **kwargs as an argument when primitives are created thereby making it possible to set a property when the primitive is instantiated. This will simplify syntax and improve consistency as some methods use explicit keyword arguments that have inconsistent naming. For example non_model=True which is used to set the property model to False. There is, however, a conflict between PEP and IronPython syntax.

    def create_polyhedron(
        self,
        cs_axis=None,
        center_position=[0.0, 0.0, 0.0],
        start_position=[0.0, 1.0, 0.0],
        height=1.0,
        num_sides=12,
        name=None,
        matname=None,
        **kwargs,
    ):

meets the PEP style requirement but causes the IronPython unit test to fail. If I fix this so IronPython unit test passes, then it fails the style check.

dcrawforAtAnsys and others added 4 commits December 30, 2023 21:52
There is a defect in the native API that leads to strange behavior when transparency of 2d objects is set.
Black changes syntax that causes IronPython failures. This was resolved using # fmt: on ... # fmt: off
@dcrawforAtAnsys dcrawforAtAnsys marked this pull request as ready for review December 31, 2023 17:45
pyaedt/modeler/cad/Primitives.py Show resolved Hide resolved
pyaedt/modeler/cad/Primitives.py Show resolved Hide resolved
pyaedt/modeler/cad/Primitives2D.py Show resolved Hide resolved
@gmalinve gmalinve mentioned this pull request Jan 2, 2024
2 tasks
Copy link
Collaborator

@maxcapodi78 maxcapodi78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement

@dcrawforAtAnsys dcrawforAtAnsys merged commit ba21b66 into main Jan 2, 2024
12 checks passed
@dcrawforAtAnsys dcrawforAtAnsys deleted the feat/4010_pass_primitive_features branch January 2, 2024 14:29
@dcrawforAtAnsys
Copy link
Collaborator Author

Allow primitive properties to be set on instantiation by passing named arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features or code improvements
Projects
None yet
3 participants