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

BUG: wrong argument name in example script #358

Closed
RemDelaporteMathurin opened this issue Oct 13, 2020 · 2 comments
Closed

BUG: wrong argument name in example script #358

RemDelaporteMathurin opened this issue Oct 13, 2020 · 2 comments

Comments

@RemDelaporteMathurin
Copy link

RemDelaporteMathurin commented Oct 13, 2020

In the following lines, the arguments poloidal_coverage_angle and poloidal_placement_angle are wrong

component = paramak.PortCutterRotated(
center_point=(450, 0),
poloidal_coverage_angle=20,
rotation_angle=10,
poloidal_placement_angle=45,
azimuth_placement_angle=0
)

This wasn't caught by the test suite for the following reason:

In the following lines, everything that is in kwargs but not in default_dict (for instance poloidal_coverage_angle and poloidal_placement_angle) is not passed to the inherited class.
And since the correct arguments ( polar_coverage_angle and polar_placement_angle) are optionnal, no error was raised.

def __init__(
self,
center_point,
polar_coverage_angle=10,
polar_placement_angle=0,
max_distance_from_center=3000,
rotation_angle=0,
stp_filename="PortCutter.stp",
stl_filename="PortCutter.stl",
color=(0.5, 0.5, 0.5),
azimuth_placement_angle=0,
name="port_cutter",
material_tag="port_cutter_mat",
**kwargs
):
default_dict = {
"points": None,
"workplane": "XZ",
"solid": None,
"intersect": None,
"cut": None,
"union": None,
"tet_mesh": None,
"physical_groups": None,
}
for arg in kwargs:
if arg in default_dict:
default_dict[arg] = kwargs[arg]
super().__init__(
name=name,
color=color,
material_tag=material_tag,
stp_filename=stp_filename,
stl_filename=stl_filename,
azimuth_placement_angle=azimuth_placement_angle,
rotation_angle=rotation_angle,
hash_value=None,
**default_dict
)

What's done in #354 and #357 allowed to catch this bug in the test suite ... 🙄

@RemDelaporteMathurin
Copy link
Author

this was fixed in #357

@shimwell
Copy link
Collaborator

Great example of why the new set up is nicer

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

No branches or pull requests

2 participants