From e03436cf149cfad24cb16a3b7b13029b85d6532b Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro <77293250+maxcapodi78@users.noreply.github.com> Date: Thu, 18 Apr 2024 18:02:00 +0200 Subject: [PATCH] Refactor modeler (#4512) Co-authored-by: maxcapodi78 Co-authored-by: Samuelopez-ansys Co-authored-by: Samuel Lopez <85613111+Samuelopez-ansys@users.noreply.github.com> --- _unittest/test_01_3dlayout_edb.py | 8 +- _unittest/test_01_Design.py | 4 +- _unittest/test_02_2D_modeler.py | 26 +- _unittest/test_02_3D_modeler.py | 89 +- _unittest/test_03_Materials.py | 2 +- _unittest/test_07_Object3D.py | 96 +- _unittest/test_08_Primitives3D.py | 249 ++- _unittest/test_09_Primitives2D.py | 10 +- _unittest/test_12_1_PostProcessing.py | 4 +- _unittest/test_12_PostProcessing.py | 4 +- _unittest/test_20_HFSS.py | 86 +- _unittest/test_21_Circuit.py | 55 +- _unittest/test_27_Maxwell2D.py | 16 +- _unittest/test_28_Maxwell3D.py | 59 +- _unittest/test_30_Q2D.py | 12 +- _unittest/test_41_3dlayout_modeler.py | 40 +- _unittest/test_44_TouchstoneParser.py | 4 +- _unittest/test_98_Icepak.py | 19 +- _unittest_solvers/test_00_analyze.py | 4 +- _unittest_solvers/test_31_Q3D.py | 10 +- doc/source/API/Primitives2D.rst | 2 +- doc/source/API/Primitives3D.rst | 4 +- doc/source/Getting_started/Contributing.rst | 2 +- doc/source/User_guide/modeler.rst | 6 +- examples/01-HFSS3DLayout/HFSS3DLayout_Via.py | 17 +- examples/01-HFSS3DLayout/Hfss3DComponent.py | 9 +- .../HFSS_CoordinateSystem.py | 20 +- .../01-Modeling-Setup/Polyline_Primitives.py | 90 +- .../02-HFSS/Create_3d_Component_and_use_it.py | 11 +- examples/02-HFSS/Flex_CPWG.py | 34 +- examples/02-HFSS/HFSS_Choke.py | 7 +- examples/02-HFSS/HFSS_Spiral.py | 24 +- examples/02-HFSS/Waveguide_Filter.py | 19 +- examples/02-SBR+/SBR_Doppler_Example.py | 33 +- .../03-Maxwell/Maxwell2D_Electrostatic.py | 8 +- .../Maxwell2D_PMSynchronousMotor.py | 48 +- examples/03-Maxwell/Maxwell2D_Transient.py | 2 +- examples/03-Maxwell/Maxwell3DTeam7.py | 17 +- .../03-Maxwell/Maxwell3D_Team3_bath_plate.py | 21 +- examples/03-Maxwell/Maxwell_Magnet.py | 2 +- .../04-Icepak/Icepak_3DComponents_Example.py | 15 +- examples/04-Icepak/Icepak_CSV_Import.py | 4 +- examples/04-Icepak/Sherlock_Example.py | 4 +- examples/05-Q3D/Q2D_Armoured_Cable.py | 4 +- examples/05-Q3D/Q2D_Example_CPWG.py | 32 +- examples/05-Q3D/Q2D_Example_Stripline.py | 33 +- examples/05-Q3D/Q3D_DC_IR.py | 6 +- examples/05-Q3D/Q3D_Example.py | 32 +- examples/05-Q3D/Q3D_from_EDB.py | 8 +- .../06-Multiphysics/Hfss_Icepak_Coupling.py | 12 +- .../Maxwell3D_Icepak_2Way_Coupling.py | 12 +- examples/07-Circuit/Circuit_Example.py | 14 +- .../07-Circuit/Circuit_Subcircuit_Example.py | 2 +- examples/07-Circuit/Circuit_Transient.py | 2 +- examples/07-EMIT/interference_gui.py | 2 +- .../07-TwinBuilder/02-Wiring_A_Rectifier.py | 34 +- pyaedt/application/Analysis3D.py | 8 +- pyaedt/circuit.py | 16 +- pyaedt/generic/configurations.py | 6 +- pyaedt/generic/ibis_reader.py | 15 +- pyaedt/generic/touchstone_parser.py | 4 +- pyaedt/hfss.py | 111 +- pyaedt/hfss3dlayout.py | 38 +- pyaedt/icepak.py | 65 +- pyaedt/maxwell.py | 20 +- pyaedt/modeler/advanced_cad/parts.py | 4 +- pyaedt/modeler/advanced_cad/stackup_3d.py | 83 +- pyaedt/modeler/cad/Modeler.py | 62 +- pyaedt/modeler/cad/Primitives.py | 1462 +++++++++-------- pyaedt/modeler/cad/Primitives2D.py | 83 +- pyaedt/modeler/cad/Primitives3D.py | 586 ++++--- pyaedt/modeler/cad/component_array.py | 26 +- pyaedt/modeler/cad/components_3d.py | 56 +- pyaedt/modeler/cad/elements3d.py | 16 +- pyaedt/modeler/cad/object3d.py | 90 +- pyaedt/modeler/cad/polylines.py | 81 +- pyaedt/modeler/circuits/PrimitivesCircuit.py | 173 +- .../circuits/PrimitivesMaxwellCircuit.py | 50 +- pyaedt/modeler/circuits/PrimitivesNexxim.py | 304 ++-- .../modeler/circuits/PrimitivesTwinBuilder.py | 64 +- pyaedt/modeler/circuits/object3dcircuit.py | 100 +- pyaedt/modeler/modeler2d.py | 14 +- pyaedt/modeler/modeler3d.py | 20 +- pyaedt/modeler/modelerpcb.py | 259 ++- pyaedt/modeler/pcb/Primitives3DLayout.py | 198 +-- pyaedt/modeler/pcb/object3dlayout.py | 95 +- pyaedt/modeler/schematic.py | 111 +- pyaedt/modules/Boundary.py | 16 +- pyaedt/modules/LayerStackup.py | 12 +- pyaedt/modules/Material.py | 6 +- pyaedt/modules/Mesh.py | 14 +- pyaedt/modules/monitor_icepak.py | 5 +- pyaedt/q3d.py | 16 +- 93 files changed, 2730 insertions(+), 2948 deletions(-) diff --git a/_unittest/test_01_3dlayout_edb.py b/_unittest/test_01_3dlayout_edb.py index 25e5e0bf908..680b07cd995 100644 --- a/_unittest/test_01_3dlayout_edb.py +++ b/_unittest/test_01_3dlayout_edb.py @@ -209,7 +209,7 @@ def test_05_change_property(self): def test_06_assign_spice_model(self): model_path = os.path.join(local_path, "example_models", test_subfolder, "GRM32ER72A225KA35_25C_0V.sp") assert self.aedtapp.modeler.set_spice_model( - component_name="C1", model_path=model_path, subcircuit_name="GRM32ER72A225KA35_25C_0V" + assignment="C1", input_file=model_path, subcircuit_name="GRM32ER72A225KA35_25C_0V" ) def test_07_nets(self): @@ -285,9 +285,9 @@ def test_14_set_solderball(self): def test_15_3dplacement(self): self.aedtapp.insert_design("placement_3d") - l1 = self.aedtapp.modeler.layers.add_layer("BOTTOM", "signal", thickness="5mil") - self.aedtapp.modeler.layers.add_layer("diel", "dielectric", thickness="121mil", material="FR4_epoxy") - self.aedtapp.modeler.layers.add_layer("TOP", "signal", thickness="5mil", isnegative=True) + l1 = self.aedtapp.modeler.layers.add_layer("BOTTOM", "signal") + self.aedtapp.modeler.layers.add_layer("diel", "dielectric") + self.aedtapp.modeler.layers.add_layer("TOP", "signal") tol = 1e-12 encrypted_model_path = os.path.join(local_path, "example_models", test_subfolder, "SMA_RF_Jack.a3dcomp") comp = self.aedtapp.modeler.place_3d_component( diff --git a/_unittest/test_01_Design.py b/_unittest/test_01_Design.py index 7ca301bbfb2..3cba663e92b 100644 --- a/_unittest/test_01_Design.py +++ b/_unittest/test_01_Design.py @@ -121,7 +121,9 @@ def test_09_set_objects_deformation(self): def test_09_set_objects_temperature(self): ambient_temp = 22 objects = [o for o in self.aedtapp.modeler.solid_names if self.aedtapp.modeler[o].model] - assert self.aedtapp.modeler.set_objects_temperature(objects, ambient_temp=ambient_temp, create_project_var=True) + assert self.aedtapp.modeler.set_objects_temperature( + objects, ambient_temperature=ambient_temp, create_project_var=True + ) def test_10_change_material_override(self): assert self.aedtapp.change_material_override(True) diff --git a/_unittest/test_02_2D_modeler.py b/_unittest/test_02_2D_modeler.py index 5fb8cff82cb..f4985110b52 100644 --- a/_unittest/test_02_2D_modeler.py +++ b/_unittest/test_02_2D_modeler.py @@ -42,10 +42,10 @@ def test_04_create_rectangle(self): test_color = (220, 90, 0) rect1 = self.aedtapp.modeler.create_rectangle([0, -2, -2], [3, 8]) rect2 = self.aedtapp.modeler.create_rectangle( - position=[10, -2, -2], - dimension_list=[3, 10], + origin=[10, -2, -2], + sizes=[3, 10], name="MyRectangle", - material_name="Copper", + material="Copper", color=test_color, ) assert rect1.solve_inside @@ -69,7 +69,7 @@ def test_05_create_rectangle_rz(self): self.aedtapp.solution_type = "MagnetostaticZ" rect1 = self.aedtapp.modeler.create_rectangle([1, 0, -2], [8, 3]) rect2 = self.aedtapp.modeler.create_rectangle( - position=[10, 0, -2], dimension_list=[10, 3], name="MyRectangle", matname="Copper" + origin=[10, 0, -2], sizes=[10, 3], name="MyRectangle", material="Copper" ) list_of_pos = [ver.position for ver in rect1.vertices] assert sorted(list_of_pos) == [[1.0, 0.0, -2.0], [1.0, 0.0, 6.0], [4.0, 0.0, -2.0], [4.0, 0.0, 6.0]] @@ -86,7 +86,7 @@ def test_06_create_circle(self): radius=3, num_sides=6, name="MyCircle", - matname="Copper", + material="Copper", display_wireframe=True, ) assert circle1.solve_inside @@ -130,7 +130,7 @@ def test_06b_radial_split(self): def test_07_create_ellipse(self): ellipse1 = self.aedtapp.modeler.create_ellipse([0, -2, 0], 4.0, 3) ellipse2 = self.aedtapp.modeler.create_ellipse( - position=[0, -2, 0], major_radius=4.0, ratio=3, name="MyEllipse", matname="Copper" + position=[0, -2, 0], major_radius=4.0, ratio=3, name="MyEllipse", material="Copper" ) assert ellipse1.solve_inside assert ellipse1.model @@ -145,7 +145,7 @@ def test_07_create_ellipse(self): def test_08_create_regular_polygon(self): pg1 = self.aedtapp.modeler.create_regular_polygon([0, 0, 0], [0, 0, 2]) pg2 = self.aedtapp.modeler.create_regular_polygon( - position=[0, 0, 0], start_point=[0, 0, 2], num_sides=3, name="MyPolygon", matname="Copper" + position=[0, 0, 0], start_point=[0, 0, 2], num_sides=3, name="MyPolygon", material="Copper" ) assert pg1.solve_inside assert pg1.model @@ -164,7 +164,7 @@ def test_09_plot(self): self.aedtapp.solution_type = "MagnetostaticZ" self.aedtapp.modeler.create_regular_polygon([0, 0, 0], [0, 0, 2]) self.aedtapp.modeler.create_regular_polygon( - position=[0, 0, 0], start_point=[0, 0, 2], num_sides=3, name="MyPolygon", matname="Copper" + position=[0, 0, 0], start_point=[0, 0, 2], num_sides=3, name="MyPolygon", material="Copper" ) obj = self.aedtapp.plot( show=False, @@ -219,12 +219,10 @@ def test_13_set_variable(self): def test_14_split(self): self.aedtapp.insert_design("split_test") rect1 = self.aedtapp.modeler.create_rectangle([0, -2, 0], [3, 8]) - poly1 = self.aedtapp.modeler.create_polyline( - position_list=[[-2, 2, 0], [1, 5, 0], [5, 3, 0]], segment_type="Arc" - ) - assert not self.aedtapp.modeler.split(objects=rect1) - split = self.aedtapp.modeler.split(objects=rect1, plane=self.aedtapp.PLANE.ZX) + poly1 = self.aedtapp.modeler.create_polyline(points=[[-2, 2, 0], [1, 5, 0], [5, 3, 0]], segment_type="Arc") + assert not self.aedtapp.modeler.split(assignment=rect1) + split = self.aedtapp.modeler.split(assignment=rect1, plane=self.aedtapp.PLANE.ZX) assert isinstance(split, list) assert isinstance(split[0], str) obj_split = [obj for obj in self.aedtapp.modeler.object_list if obj.name == split[1]][0] - assert not self.aedtapp.modeler.split(objects=obj_split, tool=poly1.edges[0]) + assert not self.aedtapp.modeler.split(assignment=obj_split, tool=poly1.edges[0]) diff --git a/_unittest/test_02_3D_modeler.py b/_unittest/test_02_3D_modeler.py index db48f8b0df3..761dcb94272 100644 --- a/_unittest/test_02_3D_modeler.py +++ b/_unittest/test_02_3D_modeler.py @@ -34,17 +34,17 @@ def restore_model(self): for name in self.aedtapp.modeler.get_matched_object_name("outer*"): self.aedtapp.modeler.delete(name) outer = self.aedtapp.modeler.create_cylinder( - cs_axis="X", position=[0, 0, 0], radius=1, height=20, name="outer", matname="Aluminum" + orientation="X", origin=[0, 0, 0], radius=1, height=20, name="outer", material="Aluminum" ) for name in self.aedtapp.modeler.get_matched_object_name("Core*"): self.aedtapp.modeler.delete(name) core = self.aedtapp.modeler.create_cylinder( - cs_axis="X", position=[0, 0, 0], radius=0.8, height=20, name="Core", matname="teflon_based" + orientation="X", origin=[0, 0, 0], radius=0.8, height=20, name="Core", material="teflon_based" ) for name in self.aedtapp.modeler.get_matched_object_name("inner*"): self.aedtapp.modeler.delete(name) inner = self.aedtapp.modeler.create_cylinder( - cs_axis="X", position=[0, 0, 0], radius=0.3, height=20, name="inner", matname="Aluminum" + orientation="X", origin=[0, 0, 0], radius=0.3, height=20, name="inner", material="Aluminum" ) for name in self.aedtapp.modeler.get_matched_object_name("Poly1*"): @@ -84,7 +84,9 @@ def test_05_split(self): split = self.aedtapp.modeler.split(box1.name, 2) assert isinstance(split, list) assert isinstance(split[0], str) - split2 = box2.split(1) + split2 = box2.split( + 1, + ) assert isinstance(split2, list) assert box2.name in split2[0] box3 = self.aedtapp.modeler.create_box([10, 10, 10], [20, 20, 20], "box_to_split3", display_wireframe=True) @@ -95,40 +97,40 @@ def test_05_split(self): assert rect1.transparency == 0.5 assert rect1.display_wireframe assert rect1.name == "rect1" - split = self.aedtapp.modeler.split(objects=box3, sides="Both", tool=rect1.id) + split = self.aedtapp.modeler.split(assignment=box3, sides="Both", tool=rect1.id) assert isinstance(split, list) assert isinstance(split[0], str) obj_split = [obj for obj in self.aedtapp.modeler.object_list if obj.name == split[1]][0] rect2 = self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.XY, [10, 8, 14], [20, 30], name="rect2") - split = self.aedtapp.modeler.split(objects=obj_split, sides="Both", tool=rect2.faces[0]) + split = self.aedtapp.modeler.split(assignment=obj_split, sides="Both", tool=rect2.faces[0]) assert isinstance(split, list) assert isinstance(split[0], str) obj_split = [obj for obj in self.aedtapp.modeler.object_list if obj.name == split[1]][0] self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.XY, [10, 8, 12], [20, 30], name="rect3") - split = self.aedtapp.modeler.split(objects=obj_split, sides="Both", tool="rect3") + split = self.aedtapp.modeler.split(assignment=obj_split, sides="Both", tool="rect3") assert isinstance(split, list) assert isinstance(split[0], str) obj_split = [obj for obj in self.aedtapp.modeler.object_list if obj.name == split[1]][0] - assert not self.aedtapp.modeler.split(objects=obj_split) + assert not self.aedtapp.modeler.split(assignment=obj_split) box4 = self.aedtapp.modeler.create_box([20, 20, 20], [20, 20, 20], "box_to_split4") poly2 = self.aedtapp.modeler.create_polyline( - position_list=[[35, 16, 30], [30, 25, 30], [30, 45, 30]], segment_type="Arc" + points=[[35, 16, 30], [30, 25, 30], [30, 45, 30]], segment_type="Arc" ) - split = self.aedtapp.modeler.split(objects=box4, sides="Both", tool=poly2.name) + split = self.aedtapp.modeler.split(assignment=box4, sides="Both", tool=poly2.name) assert isinstance(split, list) assert isinstance(split[0], str) obj_split = [obj for obj in self.aedtapp.modeler.object_list if obj.name == split[1]][0] poly3 = self.aedtapp.modeler.create_polyline( - position_list=[[35, 16, 35], [30, 25, 35], [30, 45, 35]], segment_type="Arc" + points=[[35, 16, 35], [30, 25, 35], [30, 45, 35]], segment_type="Arc" ) - split = self.aedtapp.modeler.split(objects=obj_split, sides="Both", tool=poly3) + split = self.aedtapp.modeler.split(assignment=obj_split, sides="Both", tool=poly3) assert isinstance(split, list) assert isinstance(split[0], str) obj_split = [obj for obj in self.aedtapp.modeler.object_list if obj.name == split[1]][0] poly4 = self.aedtapp.modeler.create_polyline( - position_list=[[35, 16, 37], [30, 25, 37], [30, 45, 37]], segment_type="Arc" + points=[[35, 16, 37], [30, 25, 37], [30, 45, 37]], segment_type="Arc" ) - split = self.aedtapp.modeler.split(objects=obj_split, sides="Both", tool=poly4.edges[0]) + split = self.aedtapp.modeler.split(assignment=obj_split, sides="Both", tool=poly4.edges[0]) assert isinstance(split, list) assert isinstance(split[0], str) @@ -177,17 +179,14 @@ def test_09_thicken_sheet(self): def test_11_split(self): self.restore_model() - assert self.aedtapp.modeler.split( - "Poly1", - self.aedtapp.PLANE.XY, - ) + assert self.aedtapp.modeler.split("Poly1", self.aedtapp.PLANE.XY) def test_12_separate_bodies(self): self.aedtapp.modeler.create_cylinder( - cs_axis="Z", position=[0, -20, 15], radius=40, height=20, name="SearchCoil", matname="copper" + orientation="Z", origin=[0, -20, 15], radius=40, height=20, name="SearchCoil", material="copper" ) self.aedtapp.modeler.create_cylinder( - cs_axis="Z", position=[0, -20, 15], radius=20, height=20, name="Bore", matname="copper" + orientation="Z", origin=[0, -20, 15], radius=20, height=20, name="Bore", material="copper" ) self.aedtapp.modeler.subtract("SearchCoil", "Bore", keep_originals=False) self.aedtapp.modeler.section("SearchCoil", "YZ") @@ -214,7 +213,12 @@ def test_16_get_model_bounding_box(self): def test_17_unite(self): o1 = self.aedtapp.modeler["outer"].clone() o2 = self.aedtapp.modeler["inner"].clone() - assert self.aedtapp.modeler.unite([o1, o2], purge=True) == o1.name + assert ( + self.aedtapp.modeler.unite( + [o1, o2], + ) + == o1.name + ) def test_18_chamfer(self): o1 = self.aedtapp.modeler["box_to_split"] @@ -231,7 +235,12 @@ def test_20_intersect(self): udp = [0, 0, 0] o1 = self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.XY, udp, [5, 10], name="Rect1") o2 = self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.XY, udp, [3, 12], name="Rect2") - assert self.aedtapp.modeler.intersect([o1, o2]) == o1.name + assert ( + self.aedtapp.modeler.intersect( + [o1, o2], + ) + == o1.name + ) def test_21_connect(self): udp = [0, 0, 0] @@ -344,7 +353,7 @@ def test_33_duplicate_around_axis(self): id1 = self.aedtapp.modeler.create_box([10, 10, 10], [4, 5, 5]) axis = self.aedtapp.AXIS.X _, obj_list = self.aedtapp.modeler.duplicate_around_axis( - id1, cs_axis=axis, angle="180deg", nclones=2, create_new_objects=False + id1, axis=axis, angle="180deg", clones=2, create_new_objects=False ) # if create_new_objects is set to False, there should be no new objects assert not obj_list @@ -408,7 +417,7 @@ def test_40_create_coordinate_system(self): assert cs5.delete() def test_40a_create_face_coordinate_system(self): - box = self.aedtapp.modeler.create_box(position=[0, 0, 0], dimensions_list=[2, 2, 2], name="box_cs") + box = self.aedtapp.modeler.create_box(origin=[0, 0, 0], sizes=[2, 2, 2], name="box_cs") face = box.faces[0] fcs = self.aedtapp.modeler.create_face_coordinate_system(face, face.edges[0], face.edges[1]) assert fcs @@ -471,7 +480,7 @@ def test_40a_create_face_coordinate_system(self): def test_40b_create_object_coordinate_system(self): box = self.aedtapp.modeler.objects_by_name["box_cs"] cs = self.aedtapp.modeler.create_object_coordinate_system( - obj=box, origin=box.faces[0], x_axis=box.edges[0], y_axis=[0, 0, 0], name="obj_cs" + assignment=box, origin=box.faces[0], x_axis=box.edges[0], y_axis=[0, 0, 0], name="obj_cs" ) assert cs assert cs.name == "obj_cs" @@ -485,7 +494,7 @@ def test_40b_create_object_coordinate_system(self): assert cs.update() cs.delete() cs = self.aedtapp.modeler.create_object_coordinate_system( - obj=box.name, origin=box.edges[0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs" + assignment=box.name, origin=box.edges[0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs" ) assert cs assert cs.name == "obj_cs" @@ -502,7 +511,7 @@ def test_40b_create_object_coordinate_system(self): assert cs.update() cs.delete() cs = self.aedtapp.modeler.create_object_coordinate_system( - obj=box.name, origin=[0, 0.8, 0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs" + assignment=box.name, origin=[0, 0.8, 0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs" ) cs.props["Origin"]["XPosition"] = 1 cs.props["Origin"]["XPosition"] = "1" @@ -514,7 +523,7 @@ def test_40b_create_object_coordinate_system(self): assert cs.update() cs.delete() cs = self.aedtapp.modeler.create_object_coordinate_system( - obj=box.name, origin=box.vertices[1], x_axis=box.faces[2], y_axis=box.faces[4], name="obj_cs" + assignment=box.name, origin=box.vertices[1], x_axis=box.faces[2], y_axis=box.faces[4], name="obj_cs" ) cs.props["Origin"]["XPosition"] = 1 cs.props["Origin"]["XPosition"] = "1" @@ -545,7 +554,7 @@ def test_41a_rename_face_coordinate(self): def test_41b_rename_object_coordinate(self): box = self.aedtapp.modeler.create_box([0, 0, 0], [2, 2, 2]) cs = self.aedtapp.modeler.create_object_coordinate_system( - obj=box, origin=box.faces[0], x_axis=box.edges[0], y_axis=[0, 0, 0], name="obj_cs" + assignment=box, origin=box.faces[0], x_axis=box.edges[0], y_axis=[0, 0, 0], name="obj_cs" ) assert cs.name == "obj_cs" assert cs.rename("new_obj_cs") @@ -622,10 +631,10 @@ def test_43c_set_as_working_object_cs(self): cs.delete() box = self.aedtapp.modeler.objects_by_name["box_cs"] obj_cs = self.aedtapp.modeler.create_object_coordinate_system( - obj=box.name, origin=box.edges[0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs" + assignment=box.name, origin=box.edges[0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs" ) obj_cs_1 = self.aedtapp.modeler.create_object_coordinate_system( - obj=box.name, origin=box.edges[0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs_1" + assignment=box.name, origin=box.edges[0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs_1" ) assert obj_cs.set_as_working_cs() assert obj_cs_1.set_as_working_cs() @@ -674,7 +683,7 @@ def test_47_sweep_along_vector(self): self.aedtapp.PLANE.YZ, [0, 80, 0], [20, 20], "rectangle_to_vector3" ) rect_list = [rect2, rect3] - assert self.aedtapp.modeler.sweep_along_vector(objid=rect_list, sweep_vector=sweep_vector) + assert self.aedtapp.modeler.sweep_along_vector(assignment=rect_list, sweep_vector=sweep_vector) def test_48_coordinate_systems_parametric(self): self.aedtapp["var1"] = "5mm" @@ -694,7 +703,7 @@ def test_49_sweep_along_path(self): self.aedtapp.modeler.set_working_coordinate_system("Global") first_points = [[1.0, 1.0, 0], [1.0, 2.0, 1.0], [1.0, 3.0, 1.0]] first_line = self.aedtapp.modeler.create_polyline([[0.0, 0.0, 0.0], first_points[0]]) - assert first_line.insert_segment(position_list=first_points, segment=PolylineSegment("Spline", num_points=3)) + assert first_line.insert_segment(points=first_points, segment=PolylineSegment("Spline", num_points=3)) assert ( self.aedtapp.get_oo_property_value( @@ -717,10 +726,10 @@ def test_49_sweep_along_path(self): second_points = [[3.0, 2.0, 0], [3.0, 3.0, 1.0], [3.0, 4.0, 1.0]] second_line = self.aedtapp.modeler.create_polyline([[0, 0, 0], second_points[0]]) - assert second_line.insert_segment(position_list=second_points, segment=PolylineSegment("Spline", num_points=3)) + assert second_line.insert_segment(points=second_points, segment=PolylineSegment("Spline", num_points=3)) assert second_line.insert_segment( - position_list=[[-3.0, 4.0, 1.0], [-3.0, 5.0, 3.0], [-3.0, 6.0, 1.0], [-3.0, 7.0, 2.0], [0, 0, 0]], + points=[[-3.0, 4.0, 1.0], [-3.0, 5.0, 3.0], [-3.0, 6.0, 1.0], [-3.0, 7.0, 2.0], [0, 0, 0]], segment=PolylineSegment("Spline", num_points=5), ) @@ -946,28 +955,28 @@ def test_57_duplicate_coordinate_system_to_global(self): assert new_fcs.props["YOffset"] == fcs.props["YOffset"] assert new_fcs.props["AutoAxis"] == fcs.props["AutoAxis"] obj_cs = self.aedtapp.modeler.create_object_coordinate_system( - obj=box, origin=box.faces[0], x_axis=box.edges[0], y_axis=[0, 0, 0], name="obj_cs" + assignment=box, origin=box.faces[0], x_axis=box.edges[0], y_axis=[0, 0, 0], name="obj_cs" ) new_obj_cs = self.aedtapp.modeler.duplicate_coordinate_system_to_global(obj_cs) assert new_obj_cs.props == obj_cs.props assert new_obj_cs.entity_id == obj_cs.entity_id obj_cs.delete() obj_cs = self.aedtapp.modeler.create_object_coordinate_system( - obj=box.name, origin=box.edges[0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs" + assignment=box.name, origin=box.edges[0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs" ) new_obj_cs = self.aedtapp.modeler.duplicate_coordinate_system_to_global(obj_cs) assert new_obj_cs.props == obj_cs.props assert new_obj_cs.entity_id == obj_cs.entity_id obj_cs.delete() obj_cs = self.aedtapp.modeler.create_object_coordinate_system( - obj=box.name, origin=[0, 0.8, 0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs" + assignment=box.name, origin=[0, 0.8, 0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs" ) new_obj_cs = self.aedtapp.modeler.duplicate_coordinate_system_to_global(obj_cs) assert new_obj_cs.props == obj_cs.props assert new_obj_cs.entity_id == obj_cs.entity_id obj_cs.delete() obj_cs = self.aedtapp.modeler.create_object_coordinate_system( - obj=box.name, origin=box.vertices[1], x_axis=box.faces[2], y_axis=box.faces[4], name="obj_cs" + assignment=box.name, origin=box.vertices[1], x_axis=box.faces[2], y_axis=box.faces[4], name="obj_cs" ) new_obj_cs = self.aedtapp.modeler.duplicate_coordinate_system_to_global(obj_cs) assert new_obj_cs.props == obj_cs.props @@ -1083,7 +1092,7 @@ def test_62_copy_solid_bodies_udm_3dcomponent(self, add_app): my_udmPairs.append(mypair) obj_udm = self.aedtapp.modeler.create_udm( - udmfullname="Maxwell3D/OnDieSpiralInductor.py", udm_params_list=my_udmPairs, udm_library="syslib" + udm_full_name="Maxwell3D/OnDieSpiralInductor.py", parameters=my_udmPairs, library="syslib" ) assert len(obj_udm.parts) == 5 names = [p.name for p in obj_udm.parts.values()] diff --git a/_unittest/test_03_Materials.py b/_unittest/test_03_Materials.py index c3d5c1943a0..ae16883465e 100644 --- a/_unittest/test_03_Materials.py +++ b/_unittest/test_03_Materials.py @@ -238,7 +238,7 @@ def test_09_non_linear_materials(self, add_app): assert app.materials["myMat"].permeability.bunit == "tesla" mat2 = app.materials.add_material("myMat2") assert not mat2.is_used - assert app.modeler.create_box([0, 0, 0], [10, 10, 10], matname="myMat2") + assert app.modeler.create_box([0, 0, 0], [10, 10, 10], material="myMat2") assert app.materials.material_keys["mymat2"].is_used def test_10_add_material_sweep(self): diff --git a/_unittest/test_07_Object3D.py b/_unittest/test_07_Object3D.py index ce038e5dd3a..defe68471da 100644 --- a/_unittest/test_07_Object3D.py +++ b/_unittest/test_07_Object3D.py @@ -47,7 +47,7 @@ def create_example_coil(self, name=None): if self.aedtapp.modeler[name]: self.aedtapp.modeler.delete(name) - return self.aedtapp.modeler.create_polyline(position_list=pointsList1, name=name) + return self.aedtapp.modeler.create_polyline(points=pointsList1, name=name) def create_copper_box(self, name=None): if not name: @@ -66,7 +66,7 @@ def create_copper_sphere(self, name=None): name = "Mysphere" if self.aedtapp.modeler[name]: self.aedtapp.modeler.delete(name) - return self.aedtapp.modeler.create_sphere([0, 0, 0], radius=4, name=name, matname="Copper") + return self.aedtapp.modeler.create_sphere([0, 0, 0], radius=4, name=name, material="Copper") def create_copper_cylinder(self, name=None): if not name: @@ -74,7 +74,7 @@ def create_copper_cylinder(self, name=None): if self.aedtapp.modeler[name]: self.aedtapp.modeler.delete(name) return self.aedtapp.modeler.create_cylinder( - cs_axis="Y", position=[0, 0, 0], radius=1, height=20, numSides=8, name=name, matname="Copper" + orientation="Y", origin=[0, 0, 0], radius=1, height=20, num_sides=8, name=name, material="Copper" ) def test_00_uname(self): @@ -183,7 +183,7 @@ def test_04c_material_name_setter(self): self.aedtapp["mat_sweep_test"] = '["myMat", "myMat2"]' box = self.aedtapp.modeler["MyBox"] box.material_name = "mat_sweep_test[0]" - assert self.aedtapp.modeler.get_objects_by_material(materialname="myMat")[0].name == "MyBox" + assert self.aedtapp.modeler.get_objects_by_material(material="myMat")[0].name == "MyBox" def test_05_object3d_properties_transparency(self): o = self.create_copper_box("TransparencyBox") @@ -361,16 +361,20 @@ def test_13_delete_self(self): def test_14_translate_delete_self(self): o = self.create_copper_box() v0 = o.vertices[0].position - o.move([1, 0, 0]) + o.move( + [1, 0, 0], + ) v1 = o.vertices[0].position assert v1[0] == v0[0] + 1.0 assert v1[1] == v0[1] assert v1[2] == v0[2] - assert o.move([1, 0, 0]) + assert o.move( + [1, 0, 0], + ) def test_15_duplicate_around_axis_and_unite(self): turn = self.create_example_coil("single_turn") - added_objects = turn.duplicate_around_axis(cs_axis="Z", angle=8, nclones=19) + added_objects = turn.duplicate_around_axis(axis="Z", angle=8, clones=19) turn.unite(added_objects) assert len(added_objects) == 18 assert "single_turn" in self.aedtapp.modeler.line_names @@ -393,7 +397,7 @@ def test_18_create_spiral(self): def test_19_rotate(self): o = self.aedtapp.modeler.create_box([-10, 0, 0], [10, 10, 5], "RotateBox", "Copper") - assert o.rotate(cs_axis="Y", angle=180) + assert o.rotate(axis="Y", angle=180) def test_20_mirror(self): o = self.aedtapp.modeler.create_box([-10, 0, 0], [10, 10, 5], "MirrorBox", "Copper") @@ -413,10 +417,10 @@ def test_21_groups(self): def test_22_mass(self): self.aedtapp.modeler.model_units = "meter" - box1 = self.aedtapp.modeler.create_box([0, 0, 0], [5, 10, 2], matname="Copper") + box1 = self.aedtapp.modeler.create_box([0, 0, 0], [5, 10, 2], material="Copper") assert box1.mass == 893300.0 new_material = self.aedtapp.materials.add_material("MyMaterial") - box2 = self.aedtapp.modeler.create_box([0, 0, 0], [10, 10, 10], matname="MyMaterial") + box2 = self.aedtapp.modeler.create_box([0, 0, 0], [10, 10, 10], material="MyMaterial") assert box2.mass == 0.0 new_material.mass_density = 1 assert isclose(box2.mass, 1000.0) @@ -426,7 +430,7 @@ def test_22_mass(self): assert rec.mass == 0.0 def test_23_volume(self): - box3 = self.aedtapp.modeler.create_box([10, 10, 10], [5, 10, 2], matname="Copper") + box3 = self.aedtapp.modeler.create_box([10, 10, 10], [5, 10, 2], material="Copper") assert isclose(box3.volume, 100) rec = self.aedtapp.modeler.create_rectangle(0, [0, 0, 0], [5, 10]) assert rec.volume == 0.0 @@ -532,7 +536,9 @@ def test_25_edges_by_length(self): def test_26_unclassified_object(self): box1 = self.aedtapp.modeler.create_box([0, 0, 0], [2, 2, 2]) box2 = self.aedtapp.modeler.create_box([2, 2, 2], [2, 2, 2]) - self.aedtapp.modeler.intersect([box1, box2]) + self.aedtapp.modeler.intersect( + [box1, box2], + ) vArg1 = ["NAME:Selections", "Selections:=", ", ".join([box1.name, box2.name])] vArg2 = ["NAME:IntersectParameters", "KeepOriginals:=", False] @@ -546,20 +552,20 @@ def test_26a_delete_unclassified_object(self): assert len(self.aedtapp.modeler.unclassified_objects) == 0 def test_27_get_object_history_properties(self): - box = self.aedtapp.modeler.create_box([10, 10, 10], [15, 15, 15], "box_history", matname="Copper") + box = self.aedtapp.modeler.create_box([10, 10, 10], [15, 15, 15], "box_history", material="Copper") cylinder = self.aedtapp.modeler.create_cylinder( - cs_axis="Y", - position=[10, 10, 10], + orientation="Y", + origin=[10, 10, 10], radius=5, height=20, - numSides=4, + num_sides=4, name="cylinder_history", - matname="Copper", + material="Copper", ) box_clone = box.clone() box_subtract = box_clone.subtract(cylinder) - box_subtract.rotate(cs_axis="Y", angle=180) + box_subtract.rotate(axis="Y", angle=180) box_subtract.split("XY") box_history = box.history() box_clone_history = box_clone.history() @@ -632,9 +638,9 @@ def test_28_set_object_history_properties(self): def test_29_test_nets(self): self.aedtapp.insert_design("nets") - self.aedtapp.modeler.create_box([0, 0, 0], [5, 10, 10], matname="copper") - self.aedtapp.modeler.create_box([30, 0, 0], [5, 10, 10], matname="copper") - self.aedtapp.modeler.create_box([60, 0, 0], [5, 10, 10], matname="vacuum") + self.aedtapp.modeler.create_box([0, 0, 0], [5, 10, 10], material="copper") + self.aedtapp.modeler.create_box([30, 0, 0], [5, 10, 10], material="copper") + self.aedtapp.modeler.create_box([60, 0, 0], [5, 10, 10], material="vacuum") nets = self.aedtapp.identify_touching_conductors() assert len(nets) == 2 @@ -642,32 +648,32 @@ def test_62_heal_objects(self): self.aedtapp.insert_design("Heal_Objects") self.aedtapp.modeler.create_box([0, 1.5, 0], [1, 2.5, 5], name="box_1") self.aedtapp.modeler.create_box([0, 1.5, 0], [1, 2.5, 5], name="box_2") - assert self.aedtapp.modeler.heal_objects(input_objects_list="box_1") - assert self.aedtapp.modeler.heal_objects(input_objects_list="box_1,box_2") - assert self.aedtapp.modeler.heal_objects(input_objects_list="box_1, box_2 ") - assert not self.aedtapp.modeler.heal_objects(input_objects_list=["box_1", "box_2"]) - assert not self.aedtapp.modeler.heal_objects(input_objects_list="box_1", simplify_type=3) - assert self.aedtapp.modeler.heal_objects(input_objects_list="box_1", max_stitch_tolerance="0.01") - assert self.aedtapp.modeler.heal_objects(input_objects_list="box_1", max_stitch_tolerance=0.01) - assert self.aedtapp.modeler.heal_objects(input_objects_list="box_1", geometry_simplification_tolerance=1.2) - assert self.aedtapp.modeler.heal_objects(input_objects_list="box_1", geometry_simplification_tolerance="1.2") - assert self.aedtapp.modeler.heal_objects(input_objects_list="box_1", tighten_gaps_width=0.001) - assert self.aedtapp.modeler.heal_objects(input_objects_list="box_1", tighten_gaps_width="0.001") - assert self.aedtapp.modeler.heal_objects(input_objects_list="box_1", silver_face_tolerance=1.2) - assert self.aedtapp.modeler.heal_objects(input_objects_list="box_1", silver_face_tolerance="1.2") - assert not self.aedtapp.modeler.heal_objects(input_objects_list=None) - assert not self.aedtapp.modeler.heal_objects(input_objects_list=1) + assert self.aedtapp.modeler.heal_objects(assignment="box_1") + assert self.aedtapp.modeler.heal_objects(assignment="box_1,box_2") + assert self.aedtapp.modeler.heal_objects(assignment="box_1, box_2 ") + assert not self.aedtapp.modeler.heal_objects(assignment=["box_1", "box_2"]) + assert not self.aedtapp.modeler.heal_objects(assignment="box_1", simplify_type=3) + assert self.aedtapp.modeler.heal_objects(assignment="box_1", max_stitch_tolerance="0.01") + assert self.aedtapp.modeler.heal_objects(assignment="box_1", max_stitch_tolerance=0.01) + assert self.aedtapp.modeler.heal_objects(assignment="box_1", geometry_simplification_tolerance=1.2) + assert self.aedtapp.modeler.heal_objects(assignment="box_1", geometry_simplification_tolerance="1.2") + assert self.aedtapp.modeler.heal_objects(assignment="box_1", tighten_gaps_width=0.001) + assert self.aedtapp.modeler.heal_objects(assignment="box_1", tighten_gaps_width="0.001") + assert self.aedtapp.modeler.heal_objects(assignment="box_1", silver_face_tolerance=1.2) + assert self.aedtapp.modeler.heal_objects(assignment="box_1", silver_face_tolerance="1.2") + assert not self.aedtapp.modeler.heal_objects(assignment=None) + assert not self.aedtapp.modeler.heal_objects(assignment=1) @pytest.mark.skipif(is_linux, reason="Crashing in linux") def test_20_simplify_objects(self): - assert self.aedtapp.modeler.simplify_objects(input_objects_list="box_1") - assert self.aedtapp.modeler.simplify_objects(input_objects_list="box_1,box_2") - assert self.aedtapp.modeler.simplify_objects(input_objects_list="box_1, box_2") - assert not self.aedtapp.modeler.simplify_objects(input_objects_list=["box_1", "box_2"]) - assert self.aedtapp.modeler.simplify_objects(input_objects_list="box_1", simplify_type="Primitive Fit") - assert not self.aedtapp.modeler.simplify_objects(input_objects_list="box_1", simplify_type="Invalid") + assert self.aedtapp.modeler.simplify_objects(assignment="box_1") + assert self.aedtapp.modeler.simplify_objects(assignment="box_1,box_2") + assert self.aedtapp.modeler.simplify_objects(assignment="box_1, box_2") + assert not self.aedtapp.modeler.simplify_objects(assignment=["box_1", "box_2"]) + assert self.aedtapp.modeler.simplify_objects(assignment="box_1", simplify_type="Primitive Fit") + assert not self.aedtapp.modeler.simplify_objects(assignment="box_1", simplify_type="Invalid") assert not self.aedtapp.modeler.simplify_objects( - input_objects_list="box_1", simplify_type="Polygon Fit", extrusion_axis="U" + assignment="box_1", simplify_type="Polygon Fit", extrusion_axis="U" ) - assert not self.aedtapp.modeler.simplify_objects(input_objects_list=None) - assert not self.aedtapp.modeler.simplify_objects(input_objects_list=1) + assert not self.aedtapp.modeler.simplify_objects(assignment=None) + assert not self.aedtapp.modeler.simplify_objects(assignment=1) diff --git a/_unittest/test_08_Primitives3D.py b/_unittest/test_08_Primitives3D.py index 08407b71e86..04b1c1403a6 100644 --- a/_unittest/test_08_Primitives3D.py +++ b/_unittest/test_08_Primitives3D.py @@ -107,7 +107,7 @@ def create_copper_sphere(self, name=None): name = "Mysphere" if self.aedtapp.modeler[name]: self.aedtapp.modeler.delete(name) - return self.aedtapp.modeler.create_sphere([0, 0, 0], radius="1mm", name=name, matname="Copper") + return self.aedtapp.modeler.create_sphere([0, 0, 0], radius="1mm", name=name, material="Copper") def create_copper_cylinder(self, name=None): if not name: @@ -115,7 +115,7 @@ def create_copper_cylinder(self, name=None): if self.aedtapp.modeler[name]: self.aedtapp.modeler.delete(name) return self.aedtapp.modeler.create_cylinder( - cs_axis="Y", position=[20, 20, 0], radius=5, height=20, numSides=8, name=name, matname="Copper" + orientation="Y", origin=[20, 20, 0], radius=5, height=20, num_sides=8, name=name, material="Copper" ) def create_rectangle(self, name=None): @@ -132,7 +132,7 @@ def create_copper_torus(self, name=None): if self.aedtapp.modeler[name]: self.aedtapp.modeler.delete(name) return self.aedtapp.modeler.create_torus( - [30, 30, 0], major_radius=1.2, minor_radius=0.5, axis="Z", name=name, material_name="Copper" + [30, 30, 0], major_radius=1.2, minor_radius=0.5, axis="Z", name=name, material="Copper" ) def create_polylines(self, name=None): @@ -147,9 +147,9 @@ def create_polylines(self, name=None): if self.aedtapp.modeler[name + "compound"]: self.aedtapp.modeler.delete(name + "compound") - p1 = self.aedtapp.modeler.create_polyline(position_list=test_points, name=name + "segmented") + p1 = self.aedtapp.modeler.create_polyline(points=test_points, name=name + "segmented") p2 = self.aedtapp.modeler.create_polyline( - position_list=test_points, segment_type=["Line", "Arc"], name=name + "compound" + points=test_points, segment_type=["Line", "Arc"], name=name + "compound" ) return p1, p2, test_points @@ -192,13 +192,13 @@ def test_03_create_polyhedron(self): assert o1.solve_inside o2 = self.aedtapp.modeler.create_polyhedron( - cs_axis=AXIS.Z, - center_position=[0, 0, 0], - start_position=[0, 1, 0], + orientation=AXIS.Z, + center=[0, 0, 0], + origin=[0, 1, 0], height=2.0, num_sides=5, name="MyPolyhedron", - matname="Aluminum", + material="Aluminum", ) assert o2.id > 0 assert o2.object_type == "Solid" @@ -211,33 +211,33 @@ def test_03_create_polyhedron(self): assert len(self.aedtapp.modeler.object_names) == len(self.aedtapp.modeler.objects) assert not self.aedtapp.modeler.create_polyhedron( - cs_axis=AXIS.Z, - center_position=[0, 0], - start_position=[0, 1, 0], + orientation=AXIS.Z, + center=[0, 0], + origin=[0, 1, 0], height=2.0, num_sides=5, name="MyPolyhedron", - matname="Aluminum", + material="Aluminum", ) assert not self.aedtapp.modeler.create_polyhedron( - cs_axis=AXIS.Z, - center_position=[0, 0, 0], - start_position=[0, 1], + orientation=AXIS.Z, + center=[0, 0, 0], + origin=[0, 1], height=2.0, num_sides=5, name="MyPolyhedron", - matname="Aluminum", + material="Aluminum", ) assert not self.aedtapp.modeler.create_polyhedron( - cs_axis=AXIS.Z, - center_position=[0, 0, 0], - start_position=[0, 0, 0], + orientation=AXIS.Z, + center=[0, 0, 0], + origin=[0, 0, 0], height=2.0, num_sides=5, name="MyPolyhedron", - matname="Aluminum", + material="Aluminum", ) def test_05_center_and_centroid(self): @@ -301,7 +301,7 @@ def test_12_get_objects_in_group(self): def test_13_create_circle(self): udp = self.aedtapp.modeler.Position(5, 3, 8) plane = self.aedtapp.PLANE.XY - o = self.aedtapp.modeler.create_circle(plane, udp, 2, name="MyCircle", matname="Copper") + o = self.aedtapp.modeler.create_circle(plane, udp, 2, name="MyCircle", material="Copper") assert o.id > 0 assert o.name.startswith("MyCircle") assert o.object_type == "Sheet" @@ -335,14 +335,14 @@ def test_15_create_cylinder(self): def test_16_create_ellipse(self): udp = self.aedtapp.modeler.Position(5, 3, 8) plane = self.aedtapp.PLANE.XY - o1 = self.aedtapp.modeler.create_ellipse(plane, udp, 5, 1.5, True, name="MyEllpise01", matname="Copper") + o1 = self.aedtapp.modeler.create_ellipse(plane, udp, 5, 1.5, True, name="MyEllpise01", material="Copper") assert o1.id > 0 assert o1.name.startswith("MyEllpise01") assert o1.object_type == "Sheet" assert o1.is3d is False assert not o1.solve_inside - o2 = self.aedtapp.modeler.create_ellipse(plane, udp, 5, 1.5, True, name="MyEllpise01", matname="Vacuum") + o2 = self.aedtapp.modeler.create_ellipse(plane, udp, 5, 1.5, True, name="MyEllpise01", material="Vacuum") assert o2.id > 0 assert o2.name.startswith("MyEllpise01") assert o2.object_type == "Sheet" @@ -402,7 +402,7 @@ def test_19_create_polyline(self): udp3 = [5, 5, 0] udp4 = [2, 5, 3] arrofpos = [udp1, udp4, udp2, udp3, udp1] - P = self.aedtapp.modeler.create_polyline(arrofpos, cover_surface=True, name="Poly1", matname="Copper") + P = self.aedtapp.modeler.create_polyline(arrofpos, cover_surface=True, name="Poly1", material="Copper") assert isinstance(P, Polyline) assert isinstance(P, Object3d) assert P.object_type == "Sheet" @@ -411,7 +411,7 @@ def test_19_create_polyline(self): get_P = self.aedtapp.modeler["Poly1"] assert isinstance(get_P, Polyline) P2 = self.aedtapp.modeler.create_polyline( - arrofpos, cover_surface=False, name="Poly_nonmodel", matname="Copper", non_model=True + arrofpos, cover_surface=False, name="Poly_nonmodel", material="Copper", non_model=True ) assert P2.model == False @@ -450,32 +450,37 @@ def test_22_sweep_along_vector(self): def test_23_create_rectangle(self): udp = self.aedtapp.modeler.Position(5, 3, 8) plane = self.aedtapp.PLANE.XY - o = self.aedtapp.modeler.create_rectangle(plane, udp, [4, 5], name="MyRectangle", matname="Copper") + o = self.aedtapp.modeler.create_rectangle(plane, udp, [4, 5], name="MyRectangle", material="Copper") assert o.id > 0 assert o.name.startswith("MyRectangle") assert o.object_type == "Sheet" assert o.is3d is False - assert not self.aedtapp.modeler.create_rectangle(plane, udp, [4, 5, 10], name="MyRectangle", matname="Copper") + assert not self.aedtapp.modeler.create_rectangle(plane, udp, [4, 5, 10], name="MyRectangle", material="Copper") def test_24_create_cone(self): udp = self.aedtapp.modeler.Position(5, 3, 8) axis = self.aedtapp.AXIS.Z - o = self.aedtapp.modeler.create_cone(axis, udp, 20, 10, 5, name="MyCone", matname="Copper") + o = self.aedtapp.modeler.create_cone(axis, udp, 20, 10, 5, name="MyCone", material="Copper") assert o.id > 0 assert o.name.startswith("MyCone") assert o.object_type == "Solid" assert o.is3d is True - assert not self.aedtapp.modeler.create_cone(axis, [1, 1], 20, 10, 5, name="MyCone", matname="Copper") - assert not self.aedtapp.modeler.create_cone(axis, udp, 20, 20, 5, name="MyCone", matname="Copper") - assert not self.aedtapp.modeler.create_cone(axis, udp, -20, 20, 5, name="MyCone", matname="Copper") - assert not self.aedtapp.modeler.create_cone(axis, udp, 20, -20, 5, name="MyCone", matname="Copper") - assert not self.aedtapp.modeler.create_cone(axis, udp, 20, 20, -5, name="MyCone", matname="Copper") + assert not self.aedtapp.modeler.create_cone(axis, [1, 1], 20, 10, 5, name="MyCone", material="Copper") + assert not self.aedtapp.modeler.create_cone(axis, udp, 20, 20, 5, name="MyCone", material="Copper") + assert not self.aedtapp.modeler.create_cone(axis, udp, -20, 20, 5, name="MyCone", material="Copper") + assert not self.aedtapp.modeler.create_cone(axis, udp, 20, -20, 5, name="MyCone", material="Copper") + assert not self.aedtapp.modeler.create_cone(axis, udp, 20, 20, -5, name="MyCone", material="Copper") def test_25_get_object_id(self): udp = self.aedtapp.modeler.Position(5, 3, 8) plane = self.aedtapp.PLANE.XY o = self.aedtapp.modeler.create_rectangle(plane, udp, [4, 5], name="MyRectangle5") - assert self.aedtapp.modeler.get_obj_id(o.name) == o.id + assert ( + self.aedtapp.modeler.get_obj_id( + o.name, + ) + == o.id + ) def test_26_get_object_names(self): p1, p2, points = self.create_polylines() @@ -599,7 +604,7 @@ def test_36_get_face_center(self): listfaces = self.aedtapp.modeler.get_object_faces("rect_for_get2") center = self.aedtapp.modeler.get_face_center(listfaces[0]) assert center == [4.5, 8.5, 3.0] - cylinder = self.aedtapp.modeler.create_cylinder(cs_axis=1, position=[0, 0, 0], radius=10, height=10) + cylinder = self.aedtapp.modeler.create_cylinder(orientation=1, origin=[0, 0, 0], radius=10, height=10) if config["desktopVersion"] >= "2023.1": centers = [[0, 10, 0], [0, 0, 0], [0, 5, 10]] else: @@ -668,13 +673,13 @@ def test_41b_create_rect_sheet_to_groundplane(self): def test_41c_get_edges_for_circuit_port(self): udp = self.aedtapp.modeler.Position(0, 0, 8) plane = self.aedtapp.PLANE.XY - o = self.aedtapp.modeler.create_rectangle(plane, udp, [3, 10], name="MyGND", matname="Copper") + o = self.aedtapp.modeler.create_rectangle(plane, udp, [3, 10], name="MyGND", material="Copper") face_id = o.faces[0].id edges1 = self.aedtapp.modeler.get_edges_for_circuit_port( - face_id, XY_plane=True, YZ_plane=False, XZ_plane=False, allow_perpendicular=True, tol=1e-6 + face_id, xy_plane=True, yz_plane=False, xz_plane=False, allow_perpendicular=True, tolerance=1e-6 ) edges2 = self.aedtapp.modeler.get_edges_for_circuit_port_from_sheet( - "MyGND", XY_plane=True, YZ_plane=False, XZ_plane=False, allow_perpendicular=True, tol=1e-6 + "MyGND", xy_plane=True, yz_plane=False, xz_plane=False, allow_perpendicular=True, tolerance=1e-6 ) def test_42_chamfer(self): @@ -703,30 +708,30 @@ def test_44_create_polyline_basic_segments(self): self.aedtapp["p2"] = "71mm" test_points = [["0mm", "p1", "0mm"], ["-p1", "0mm", "0mm"], ["-p1/2", "-p1/2", "0mm"], ["0mm", "0mm", "0mm"]] - p1 = prim3D.create_polyline(position_list=test_points[0:2], name="PL01_line") + p1 = prim3D.create_polyline(points=test_points[0:2], name="PL01_line") assert len(p1.start_point) == 3 assert len(p1.end_point) == 3 - assert prim3D.create_polyline(position_list=test_points[0:3], segment_type="Arc", name="PL02_arc") + assert prim3D.create_polyline(points=test_points[0:3], segment_type="Arc", name="PL02_arc") assert prim3D.create_polyline( - position_list=test_points, segment_type=PolylineSegment("Spline", num_points=4), name="PL03_spline_4pt" + points=test_points, segment_type=PolylineSegment("Spline", num_points=4), name="PL03_spline_4pt" ) assert prim3D.create_polyline( - position_list=test_points, segment_type=PolylineSegment("Spline", num_points=3), name="PL03_spline_3pt" + points=test_points, segment_type=PolylineSegment("Spline", num_points=3), name="PL03_spline_3pt" ) with pytest.raises(ValueError) as execinfo: - prim3D.create_polyline(position_list=test_points[0:3], segment_type="Spline", name="PL03_spline_str_3pt") + prim3D.create_polyline(points=test_points[0:3], segment_type="Spline", name="PL03_spline_str_3pt") assert ( str(execinfo) == "The 'position_list' argument must contain at least four points for segment of type 'Spline'." ) assert prim3D.create_polyline( - position_list=[[100, 100, 0]], + points=[[100, 100, 0]], segment_type=PolylineSegment("AngularArc", arc_center=[0, 0, 0], arc_angle="30deg"), name="PL04_center_point_arc", ) assert prim3D.create_polyline( - position_list=[[100, 100, 0]], + points=[[100, 100, 0]], segment_type=PolylineSegment("AngularArc", arc_angle="30deg"), name="PL04_center_point_arc", ) @@ -734,12 +739,12 @@ def test_44_create_polyline_basic_segments(self): def test_45_create_circle_from_2_arc_segments(self): prim3D = self.aedtapp.modeler assert prim3D.create_polyline( - position_list=[[34.1004, 14.1248, 0], [27.646, 16.7984, 0], [24.9725, 10.3439, 0], [31.4269, 7.6704, 0]], + points=[[34.1004, 14.1248, 0], [27.646, 16.7984, 0], [24.9725, 10.3439, 0], [31.4269, 7.6704, 0]], segment_type=["Arc", "Arc"], cover_surface=True, close_surface=True, name="Rotor_Subtract_25_0", - matname="vacuum", + material="vacuum", ) def test_46_compound_polylines_segments(self): @@ -748,23 +753,19 @@ def test_46_compound_polylines_segments(self): self.aedtapp["p2"] = "71mm" test_points = [["0mm", "p1", "0mm"], ["-p1", "0mm", "0mm"], ["-p1/2", "-p1/2", "0mm"], ["0mm", "0mm", "0mm"]] - assert prim3D.create_polyline(position_list=test_points, name="PL06_segmented_compound_line") - assert prim3D.create_polyline( - position_list=test_points, segment_type=["Line", "Arc"], name="PL05_compound_line_arc" - ) + assert prim3D.create_polyline(points=test_points, name="PL06_segmented_compound_line") + assert prim3D.create_polyline(points=test_points, segment_type=["Line", "Arc"], name="PL05_compound_line_arc") assert prim3D.create_polyline( - position_list=test_points, close_surface=True, name="PL07_segmented_compound_line_closed" - ) - assert prim3D.create_polyline( - position_list=test_points, cover_surface=True, name="SPL01_segmented_compound_line" + points=test_points, close_surface=True, name="PL07_segmented_compound_line_closed" ) + assert prim3D.create_polyline(points=test_points, cover_surface=True, name="SPL01_segmented_compound_line") def test_47_insert_polylines_segments_test1(self): self.aedtapp["p1"] = "100mm" self.aedtapp["p2"] = "71mm" test_points = [["0mm", "p1", "0mm"], ["-p1", "0mm", "0mm"], ["-p1/2", "-p1/2", "0mm"], ["0mm", "0mm", "0mm"]] P = self.aedtapp.modeler.create_polyline( - position_list=test_points, close_surface=False, name="PL08_segmented_compound_insert_segment" + points=test_points, close_surface=False, name="PL08_segmented_compound_insert_segment" ) assert P assert len(P.points) == 4 @@ -777,7 +778,7 @@ def test_47_insert_polylines_segments_test1(self): start_point = P.start_point insert_point = ["90mm", "20mm", "0mm"] insert_point2 = ["95mm", "20mm", "0mm"] - assert P.insert_segment(position_list=[start_point, insert_point]) + assert P.insert_segment(points=[start_point, insert_point]) assert len(P.points) == 5 assert P.points == [ ["0mm", "p1", "0mm"], @@ -786,7 +787,7 @@ def test_47_insert_polylines_segments_test1(self): ["-p1/2", "-p1/2", "0mm"], ["0mm", "0mm", "0mm"], ] - assert P.insert_segment(position_list=[insert_point, insert_point2]) + assert P.insert_segment(points=[insert_point, insert_point2]) assert len(P.points) == 6 assert P.points == [ ["0mm", "p1", "0mm"], @@ -796,7 +797,7 @@ def test_47_insert_polylines_segments_test1(self): ["-p1/2", "-p1/2", "0mm"], ["0mm", "0mm", "0mm"], ] - assert P.insert_segment(position_list=[["-p1", "0mm", "0mm"], ["-110mm", "-35mm", "0mm"]]) + assert P.insert_segment(points=[["-p1", "0mm", "0mm"], ["-110mm", "-35mm", "0mm"]]) assert len(P.points) == 7 assert P.points == [ ["0mm", "p1", "0mm"], @@ -807,7 +808,7 @@ def test_47_insert_polylines_segments_test1(self): ["-p1/2", "-p1/2", "0mm"], ["0mm", "0mm", "0mm"], ] - assert P.insert_segment(position_list=[["-80mm", "10mm", "0mm"], ["-p1", "0mm", "0mm"]]) + assert P.insert_segment(points=[["-80mm", "10mm", "0mm"], ["-p1", "0mm", "0mm"]]) assert len(P.points) == 8 assert P.points == [ ["0mm", "p1", "0mm"], @@ -819,7 +820,7 @@ def test_47_insert_polylines_segments_test1(self): ["-p1/2", "-p1/2", "0mm"], ["0mm", "0mm", "0mm"], ] - assert P.insert_segment(position_list=[["0mm", "0mm", "0mm"], ["10mm", "10mm", "0mm"]]) + assert P.insert_segment(points=[["0mm", "0mm", "0mm"], ["10mm", "10mm", "0mm"]]) assert len(P.points) == 9 assert P.points == [ ["0mm", "p1", "0mm"], @@ -832,7 +833,7 @@ def test_47_insert_polylines_segments_test1(self): ["0mm", "0mm", "0mm"], ["10mm", "10mm", "0mm"], ] - assert P.insert_segment(position_list=[["10mm", "5mm", "0mm"], ["0mm", "0mm", "0mm"]]) + assert P.insert_segment(points=[["10mm", "5mm", "0mm"], ["0mm", "0mm", "0mm"]]) assert len(P.points) == 10 assert P.points == [ ["0mm", "p1", "0mm"], @@ -853,20 +854,18 @@ def test_48_insert_polylines_segments_test2(self): self.aedtapp["p2"] = "71mm" test_points = [["0mm", "p1", "0mm"], ["-p1", "0mm", "0mm"], ["-p1/2", "-p1/2", "0mm"], ["0mm", "0mm", "0mm"]] - P = prim3D.create_polyline( - position_list=test_points, close_surface=False, name="PL08_segmented_compound_insert_arc" - ) + P = prim3D.create_polyline(points=test_points, close_surface=False, name="PL08_segmented_compound_insert_arc") start_point = P.points[1] insert_point1 = ["-120mm", "-25mm", "0mm"] insert_point2 = [-115, -40, 0] - P.insert_segment(position_list=[start_point, insert_point1, insert_point2], segment="Arc") + P.insert_segment(points=[start_point, insert_point1, insert_point2], segment="Arc") def test_49_modify_crossection(self): P = self.aedtapp.modeler.create_polyline( - position_list=[[34.1004, 14.1248, 0], [27.646, 16.7984, 0], [24.9725, 10.3439, 0]], + points=[[34.1004, 14.1248, 0], [27.646, 16.7984, 0], [24.9725, 10.3439, 0]], name="Rotor_Subtract_25_0", - matname="copper", + material="copper", ) P1 = P.clone() P2 = P.clone() @@ -890,7 +889,7 @@ def test_50_remove_vertex_from_polyline(self): p1, p2, test_points = self.create_polylines("Poly_remove_") P = self.aedtapp.modeler["Poly_remove_segmented"] - P.remove_vertex(test_points[2]) + P.remove_point(test_points[2]) time.sleep(0.1) P1 = self.aedtapp.modeler.create_polyline([[0, 1, 2], [0, 2, 3], [2, 1, 4]]) P1.remove_point([0, 1, 2]) @@ -905,44 +904,44 @@ def test_50_remove_vertex_from_polyline(self): time.sleep(0.1) P4 = self.aedtapp.modeler.create_polyline([[0, 1, 2], [0, 2, 3], [2, 1, 4]]) - P4.remove_point(["0mm", "1mm", "2mm"], abstol=1e-6) + P4.remove_point(["0mm", "1mm", "2mm"], tolerance=1e-6) def test_51_remove_edges_from_polyline(self): modeler = self.aedtapp.modeler P = modeler.create_polyline([[0, 1, 2], [0, 2, 3], [2, 1, 4]]) - P.remove_edges(edge_id=0) + P.remove_edges(assignment=0) assert P.points == [[0, 2, 3], [2, 1, 4]] assert len(P.segment_types) == 1 assert P.name in self.aedtapp.modeler.line_names P = modeler.create_polyline([[0, 1, 2], [0, 2, 3], [2, 1, 4], [3, 1, 6]]) - P.remove_segments(segment_id=[0, 1]) + P.remove_segments(assignment=[0, 1]) assert P.points == [[2, 1, 4], [3, 1, 6]] assert len(P.segment_types) == 1 assert P.name in self.aedtapp.modeler.line_names P = modeler.create_polyline([[0, 1, 2], [0, 2, 3], [2, 1, 4], [3, 1, 6]]) - P.remove_segments(segment_id=1) + P.remove_segments(assignment=1) assert P.points == [[0, 1, 2], [2, 1, 4], [3, 1, 6]] assert len(P.segment_types) == 2 assert P.name in self.aedtapp.modeler.line_names P = modeler.create_polyline([[0, 1, 2], [0, 2, 3], [2, 1, 4], [2, 2, 5], [3, 1, 6]]) - P.remove_segments(segment_id=[1, 3]) + P.remove_segments(assignment=[1, 3]) assert P.points == [[0, 1, 2], [2, 1, 4], [2, 2, 5]] assert len(P.segment_types) == 2 assert P.name in self.aedtapp.modeler.line_names P = modeler.create_polyline([[0, 1, 2], [0, 2, 3], [2, 1, 4], [3, 1, 6]]) - P.remove_segments(segment_id=[1, 2]) + P.remove_segments(assignment=[1, 2]) assert P.points == [[0, 1, 2], [0, 2, 3]] assert len(P.segment_types) == 1 assert P.name in self.aedtapp.modeler.line_names P = modeler.create_polyline([[0, 1, 2], [0, 2, 3], [2, 1, 4], [3, 1, 6]]) - P.remove_segments(segment_id=2) + P.remove_segments(assignment=2) assert P.points == [[0, 1, 2], [0, 2, 3], [2, 1, 4]] assert len(P.segment_types) == 2 assert P.name in self.aedtapp.modeler.line_names def test_52_remove_edges_from_polyline_invalid(self): P = self.aedtapp.modeler.create_polyline([[0, 1, 2], [0, 2, 3], [2, 1, 4]]) - P.remove_edges(edge_id=[0, 1]) + P.remove_edges(assignment=[0, 1]) assert not P.name in self.aedtapp.modeler.line_names def test_53_duplicate_polyline_and_manipulate(self): @@ -1074,23 +1073,23 @@ def test_55_create_bond_wires(self): self.aedtapp["$bondHeight1"] = "0.15mm" self.aedtapp["$bondHeight2"] = "0mm" b0 = self.aedtapp.modeler.create_bondwire( - [0, 0, 0], [10, 10, 2], h1=0.15, h2=0, diameter=0.034, facets=8, matname="copper", name="jedec51" + [0, 0, 0], [10, 10, 2], h1=0.15, h2=0, diameter=0.034, facets=8, name="jedec51", material="copper" ) assert b0 b1 = self.aedtapp.modeler.create_bondwire( - [0, 0, 0], [10, 10, 2], h1=0.15, h2=0, diameter=0.034, bond_type=1, matname="copper", name="jedec41" + [0, 0, 0], [10, 10, 2], h1=0.15, h2=0, bond_type=1, diameter=0.034, name="jedec41", material="copper" ) assert b1 b2 = self.aedtapp.modeler.create_bondwire( - [0, 0, 0], [10, 10, 2], h1=0.15, h2=0, diameter=0.034, bond_type=2, matname="copper", name="low" + [0, 0, 0], [10, 10, 2], h1=0.15, h2=0, bond_type=2, diameter=0.034, name="low", material="copper" ) assert b2 b3 = self.aedtapp.modeler.create_bondwire( - [0, 0, 0], [10, 10, 2], h1=0.15, h2=0, diameter=0.034, bond_type=3, matname="copper", name="jedec41" + [0, 0, 0], [10, 10, 2], h1=0.15, h2=0, bond_type=3, diameter=0.034, name="jedec41", material="copper" ) assert not b3 b4 = self.aedtapp.modeler.create_bondwire( - (2, 2, 0), (0, 0, 0), h1=0.15, h2=0, diameter=0.034, bond_type=1, matname="copper", name="jedec41" + (2, 2, 0), (0, 0, 0), h1=0.15, h2=0, bond_type=1, diameter=0.034, name="jedec41", material="copper" ) assert b4 b5 = self.aedtapp.modeler.create_bondwire( @@ -1098,10 +1097,10 @@ def test_55_create_bond_wires(self): ("$Endx", "$Endy", "$Endz"), h1=0.15, h2=0, - diameter=0.034, bond_type=1, - matname="copper", + diameter=0.034, name="jedec41", + material="copper", ) assert b5 b6 = self.aedtapp.modeler.create_bondwire( @@ -1109,17 +1108,17 @@ def test_55_create_bond_wires(self): [10, 10, 2], h1="$bondHeight1", h2="$bondHeight2", - diameter=0.034, bond_type=2, - matname="copper", + diameter=0.034, name="low", + material="copper", ) assert b6 assert not self.aedtapp.modeler.create_bondwire( - [0, 0], [10, 10, 2], h1=0.15, h2=0, diameter=0.034, facets=8, matname="copper", name="jedec51" + [0, 0], [10, 10, 2], h1=0.15, h2=0, diameter=0.034, facets=8, name="jedec51", material="copper" ) assert not self.aedtapp.modeler.create_bondwire( - [0, 0, 0], [10, 10], h1=0.15, h2=0, diameter=0.034, facets=8, matname="copper", name="jedec51" + [0, 0, 0], [10, 10], h1=0.15, h2=0, diameter=0.034, facets=8, name="jedec51", material="copper" ) def test_56_create_group(self): @@ -1141,9 +1140,11 @@ def test_59_lines(self): def test_60_get_edges_on_bounding_box(self): self.aedtapp.close_project(name=self.aedtapp.project_name, save_project=False) self.aedtapp.load_project(self.test_99_project) - edges = self.aedtapp.modeler.get_edges_on_bounding_box(["Port1", "Port2"], return_colinear=True, tol=1e-6) + edges = self.aedtapp.modeler.get_edges_on_bounding_box(["Port1", "Port2"], return_colinear=True, tolerance=1e-6) assert len(edges) == 2 - edges = self.aedtapp.modeler.get_edges_on_bounding_box(["Port1", "Port2"], return_colinear=False, tol=1e-6) + edges = self.aedtapp.modeler.get_edges_on_bounding_box( + ["Port1", "Port2"], return_colinear=False, tolerance=1e-6 + ) assert len(edges) == 4 def test_61_get_closest_edge_to_position(self): @@ -1277,9 +1278,9 @@ def test_66d_component_bounding_box(self): mypair = ["Port_Gap_Width", "8.1mm"] my_udmPairs.append(mypair) self.aedtapp.modeler.create_udm( - udmfullname="HFSS/Antenna Toolkit/Log Periodic/Log Tooth.py", - udm_params_list=my_udmPairs, - udm_library="syslib", + udm_full_name="HFSS/Antenna Toolkit/Log Periodic/Log Tooth.py", + parameters=my_udmPairs, + library="syslib", name="test_udm_83", ) assert ( @@ -1305,8 +1306,8 @@ def test_66d_component_bounding_box(self): def test_67_assign_material(self): box1 = self.aedtapp.modeler.create_box([60, 60, 60], [4, 5, 5]) box2 = self.aedtapp.modeler.create_box([50, 50, 50], [2, 3, 4]) - cyl1 = self.aedtapp.modeler.create_cylinder(cs_axis="X", position=[50, 0, 0], radius=1, height=20) - cyl2 = self.aedtapp.modeler.create_cylinder(cs_axis="Z", position=[0, 0, 50], radius=1, height=10) + cyl1 = self.aedtapp.modeler.create_cylinder(orientation="X", origin=[50, 0, 0], radius=1, height=20) + cyl2 = self.aedtapp.modeler.create_cylinder(orientation="Z", origin=[0, 0, 50], radius=1, height=10) objects_list = [box1, box2, cyl1, cyl2] self.aedtapp.assign_material(objects_list, "copper") @@ -1335,10 +1336,10 @@ def test_69_create_torus(self): def test_70_create_torus_exceptions(self): assert self.aedtapp.modeler.create_torus( - [30, 30, 0], major_radius=1.3, minor_radius=0.5, axis="Z", name="torus", material_name="Copper" + [30, 30, 0], major_radius=1.3, minor_radius=0.5, axis="Z", name="torus", material="Copper" ) assert not self.aedtapp.modeler.create_torus( - [30, 30], major_radius=1.3, minor_radius=0.5, axis="Z", name="torus", material_name="Copper" + [30, 30], major_radius=1.3, minor_radius=0.5, axis="Z", name="torus", material="Copper" ) def test_71_create_point(self): @@ -1552,12 +1553,12 @@ def test_77_create_helix(self): ) helix_right_turn = self.aedtapp.modeler.create_helix( - polyline_name=polyline.name, - position=[0, 0, 0], + assignment=polyline.name, + origin=[0, 0, 0], x_start_dir=0, y_start_dir=1.0, z_start_dir=1.0, - num_thread=1, + turns=1, right_hand=True, radius_increment=0.0, thread=1.0, @@ -1575,8 +1576,8 @@ def test_77_create_helix(self): ) assert self.aedtapp.modeler.create_helix( - polyline_name=polyline_left.name, - position=[0, 0, 0], + assignment=polyline_left.name, + origin=[0, 0, 0], x_start_dir=1.0, y_start_dir=1.0, z_start_dir=1.0, @@ -1584,16 +1585,12 @@ def test_77_create_helix(self): ) assert not self.aedtapp.modeler.create_helix( - polyline_name="", - position=[0, 0, 0], - x_start_dir=1.0, - y_start_dir=1.0, - z_start_dir=1.0, + assignment="", origin=[0, 0, 0], x_start_dir=1.0, y_start_dir=1.0, z_start_dir=1.0 ) assert not self.aedtapp.modeler.create_helix( - polyline_name=polyline_left.name, - position=[0, 0], + assignment=polyline_left.name, + origin=[0, 0], x_start_dir=1.0, y_start_dir=1.0, z_start_dir=1.0, @@ -1601,8 +1598,8 @@ def test_77_create_helix(self): ) def test_78_get_touching_objects(self): - box1 = self.aedtapp.modeler.create_box([-20, -20, -20], [1, 1, 1], matname="copper") - box2 = self.aedtapp.modeler.create_box([-20, -20, -19], [0.2, 0.2, 0.2], matname="copper") + box1 = self.aedtapp.modeler.create_box([-20, -20, -20], [1, 1, 1], material="copper") + box2 = self.aedtapp.modeler.create_box([-20, -20, -19], [0.2, 0.2, 0.2], material="copper") assert box2.name in box1.touching_objects assert box2.name in box1.touching_conductors() assert box1.name in box2.touching_objects @@ -1653,10 +1650,10 @@ def test_79_3dcomponent_operations(self): self.aedtapp.modeler.set_working_coordinate_system("Global") obj_3dcomp = self.aedtapp.modeler["Dipole_Antenna2"] assert obj_3dcomp.mirror(udp, udp2) - assert obj_3dcomp.rotate(cs_axis="Y", angle=180) + assert obj_3dcomp.rotate(axis="Y", angle=180) assert obj_3dcomp.move(udp2) - new_comps = obj_3dcomp.duplicate_around_axis(cs_axis="Z", angle=8, nclones=3) + new_comps = obj_3dcomp.duplicate_around_axis(axis="Z", angle=8, clones=3) assert new_comps[0] in self.aedtapp.modeler.user_defined_component_names udp = self.aedtapp.modeler.Position(5, 5, 5) @@ -1686,9 +1683,9 @@ def test_80_udm_operations(self): mypair = ["Port_Gap_Width", "8.1mm"] my_udmPairs.append(mypair) obj_udm = self.aedtapp.modeler.create_udm( - udmfullname="HFSS/Antenna Toolkit/Log Periodic/Log Tooth.py", - udm_params_list=my_udmPairs, - udm_library="syslib", + udm_full_name="HFSS/Antenna Toolkit/Log Periodic/Log Tooth.py", + parameters=my_udmPairs, + library="syslib", name="test_udm", ) assert isinstance(obj_udm, UserDefinedComponent) @@ -1721,15 +1718,15 @@ def test_80_udm_operations(self): udp = self.aedtapp.modeler.Position(0, 0, 0) udp2 = self.aedtapp.modeler.Position(30, 40, 40) obj_udm = self.aedtapp.modeler.create_udm( - udmfullname="HFSS/Antenna Toolkit/Log Periodic/Log Tooth.py", - udm_params_list=my_udmPairs, - udm_library="syslib", + udm_full_name="HFSS/Antenna Toolkit/Log Periodic/Log Tooth.py", + parameters=my_udmPairs, + library="syslib", name="test_udm", ) assert obj_udm.mirror(udp, udp2) - assert obj_udm.rotate(cs_axis="Y", angle=180) + assert obj_udm.rotate(axis="Y", angle=180) assert obj_udm.move(udp2) - assert not obj_udm.duplicate_around_axis(cs_axis="Z", angle=8, nclones=3) + assert not obj_udm.duplicate_around_axis(axis="Z", angle=8, clones=3) udp = self.aedtapp.modeler.Position(5, 5, 5) num_clones = 5 assert not obj_udm.duplicate_along_line(udp, num_clones) @@ -1751,13 +1748,13 @@ def test_81_operations_3dcomponent(self): mypair = ["Port_Gap_Width", "8.1mm"] my_udmPairs.append(mypair) obj_udm = self.aedtapp.modeler.create_udm( - udmfullname="HFSS/Antenna Toolkit/Log Periodic/Log Tooth.py", - udm_params_list=my_udmPairs, - udm_library="syslib", + udm_full_name="HFSS/Antenna Toolkit/Log Periodic/Log Tooth.py", + parameters=my_udmPairs, + library="syslib", name="test_udm2", ) assert self.aedtapp.modeler.duplicate_and_mirror( - self.aedtapp.modeler.user_defined_component_names[0], [0, 0, 0], [1, 0, 0], is_3d_comp=True + self.aedtapp.modeler.user_defined_component_names[0], [0, 0, 0], [1, 0, 0] ) def test_82_flatten_3d_components(self): diff --git a/_unittest/test_09_Primitives2D.py b/_unittest/test_09_Primitives2D.py index 9951658bc03..4cd695c39d1 100644 --- a/_unittest/test_09_Primitives2D.py +++ b/_unittest/test_09_Primitives2D.py @@ -41,25 +41,25 @@ def create_rectangle(self, name=None): def test_02_create_primitive(self): udp = self.aedtapp.modeler.Position(0, 0, 0) - o = self.aedtapp.modeler.create_rectangle(udp, [5, 3], name="Rectangle1", matname="copper") + o = self.aedtapp.modeler.create_rectangle(udp, [5, 3], name="Rectangle1", material="copper") assert isinstance(o.id, int) assert o.solve_inside def test_03_create_circle(self): udp = self.aedtapp.modeler.Position(0, 0, 0) - o1 = self.aedtapp.modeler.create_circle(udp, 3, 0, name="Circle1", matname="copper") + o1 = self.aedtapp.modeler.create_circle(udp, 3, 0, name="Circle1", material="copper") assert isinstance(o1.id, int) - o2 = self.aedtapp.modeler.create_circle(udp, 3, 8, name="Circle2", matname="copper") + o2 = self.aedtapp.modeler.create_circle(udp, 3, 8, name="Circle2", material="copper") assert isinstance(o2.id, int) def test_04_create_ellipse(self): udp = self.aedtapp.modeler.Position(0, 0, 0) - o = self.aedtapp.modeler.create_ellipse(udp, 3, 2, name="Ellipse1", matname="copper") + o = self.aedtapp.modeler.create_ellipse(udp, 3, 2, name="Ellipse1", material="copper") assert isinstance(o.id, int) def test_05_create_poly(self): udp = [self.aedtapp.modeler.Position(0, 0, 0), self.aedtapp.modeler.Position(10, 5, 0)] - o = self.aedtapp.modeler.create_polyline(udp, name="Ellipse1", matname="copper") + o = self.aedtapp.modeler.create_polyline(udp, name="Ellipse1", material="copper") assert isinstance(o, Polyline) def test_chamfer_vertex(self): diff --git a/_unittest/test_12_1_PostProcessing.py b/_unittest/test_12_1_PostProcessing.py index 8866fe26f03..2160bf977d8 100644 --- a/_unittest/test_12_1_PostProcessing.py +++ b/_unittest/test_12_1_PostProcessing.py @@ -143,9 +143,7 @@ def test_02_export_fields(self): os.path.join(self.local_scratch.path, "prova2.jpg"), plot2.name, plot2.plot_folder ) assert os.path.exists(os.path.join(self.local_scratch.path, "prova2.jpg")) - assert os.path.exists( - plot2.export_image(os.path.join(self.local_scratch.path, "test_x.jpg"), orientation="top") - ) + assert os.path.exists(plot2.export_image(os.path.join(self.local_scratch.path, "test_x.jpg"))) def test_03_create_scattering(self): setup_name = "Setup1 : Sweep" diff --git a/_unittest/test_12_PostProcessing.py b/_unittest/test_12_PostProcessing.py index fe62f2c793c..178257a0ae9 100644 --- a/_unittest/test_12_PostProcessing.py +++ b/_unittest/test_12_PostProcessing.py @@ -812,7 +812,7 @@ def test_73_ami_solution_data(self, ami_test): def test_75_plot_field_line_traces(self, m2dtest): m2dtest.modeler.model_units = "mm" rect = m2dtest.modeler.create_rectangle( - position=["1mm", "5mm", "0mm"], dimension_list=["-1mm", "-10mm", 0], name="Ground", matname="copper" + origin=["1mm", "5mm", "0mm"], sizes=["-1mm", "-10mm", 0], name="Ground", material="copper" ) rect.solve_inside = False circle = m2dtest.modeler.create_circle( @@ -821,7 +821,7 @@ def test_75_plot_field_line_traces(self, m2dtest): num_sides="0", is_covered=True, name="Electrode", - matname="copper", + material="copper", ) circle.solve_inside = False m2dtest.modeler.create_region([20, 100, 20, 100]) diff --git a/_unittest/test_20_HFSS.py b/_unittest/test_20_HFSS.py index 06bfa1f9c8b..bc7a6d1e34c 100644 --- a/_unittest/test_20_HFSS.py +++ b/_unittest/test_20_HFSS.py @@ -66,7 +66,7 @@ def test_02_create_primitive(self): inner_1 = self.aedtapp.modeler.create_cylinder(self.aedtapp.AXIS.X, coax1_origin, r1, coax1_len, 0, "inner_1") assert isinstance(inner_1.id, int) inner_2 = self.aedtapp.modeler.create_cylinder( - self.aedtapp.AXIS.Z, coax2_origin, r1, coax2_len, 0, "inner_2", matname="copper" + self.aedtapp.AXIS.Z, coax2_origin, r1, coax2_len, 0, "inner_2", material="copper" ) assert len(inner_2.faces) == 3 # Cylinder has 3 faces. # Check area of circular face. @@ -77,8 +77,12 @@ def test_02_create_primitive(self): # Check the area of the outer surface of the cylinder "outer_2". assert abs(max([f.area for f in outer_2.faces]) - 2 * coax2_len * r2 * math.pi) < small_number - inner = self.aedtapp.modeler.unite(["inner_1", "inner_2"]) - outer = self.aedtapp.modeler.unite(["outer_1", "outer_2"]) + inner = self.aedtapp.modeler.unite( + ["inner_1", "inner_2"], + ) + outer = self.aedtapp.modeler.unite( + ["outer_1", "outer_2"], + ) assert outer == "outer_1" assert inner == "inner_1" assert self.aedtapp.modeler.subtract(outer_1, inner_1, keep_originals=True) @@ -94,7 +98,9 @@ def test_03_2_assign_material(self): assert cyl_1.material_name == "teflon_based" def test_04_assign_coating(self): - id = self.aedtapp.modeler.get_obj_id("inner_1") + id = self.aedtapp.modeler.get_obj_id( + "inner_1", + ) args = { "mat": "aluminum", "usethickness": True, @@ -182,8 +188,8 @@ def test_05_create_wave_port_from_sheets(self): assert port.name in [i.name for i in self.aedtapp.boundaries] assert port.props["RenormalizeAllTerminals"] is True - id6 = self.aedtapp.modeler.create_box([20, 20, 20], [10, 10, 2], matname="Copper", name="My_Box") - id7 = self.aedtapp.modeler.create_box([20, 25, 30], [10, 2, 2], matname="Copper") + id6 = self.aedtapp.modeler.create_box([20, 20, 20], [10, 10, 2], name="My_Box", material="Copper") + id7 = self.aedtapp.modeler.create_box([20, 25, 30], [10, 2, 2], material="Copper") rect = self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.YZ, [20, 25, 20], [2, 10]) port3 = self.aedtapp.wave_port( assignment=rect, @@ -565,10 +571,10 @@ def test_09_create_waveport_on_objects(self): def test_09a_create_waveport_on_true_surface_objects(self): cs = self.aedtapp.PLANE.XY o1 = self.aedtapp.modeler.create_cylinder( - cs, [0, 0, 0], radius=5, height=100, numSides=0, name="inner", matname="Copper" + cs, [0, 0, 0], radius=5, height=100, num_sides=0, name="inner", material="Copper" ) o3 = self.aedtapp.modeler.create_cylinder( - cs, [0, 0, 0], radius=10, height=100, numSides=0, name="outer", matname="Copper" + cs, [0, 0, 0], radius=10, height=100, num_sides=0, name="outer", material="Copper" ) port1 = self.aedtapp.wave_port( assignment=o1.name, @@ -681,7 +687,7 @@ def test_14_create_lumpedrlc_on_objects(self): def test_15_create_perfects_on_sheets(self): rect = self.aedtapp.modeler.create_rectangle( - self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="RectBound", matname="Copper" + self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="RectBound", material="Copper" ) pe = self.aedtapp.assign_perfecte_to_sheets(rect.name) assert pe.name in self.aedtapp.modeler.get_boundaries_name() @@ -698,7 +704,7 @@ def test_15_create_perfects_on_sheets(self): def test_16_create_impedance_on_sheets(self): rect = self.aedtapp.modeler.create_rectangle( - self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="ImpBound", matname="Copper" + self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="ImpBound", material="Copper" ) imp1 = self.aedtapp.assign_impedance_to_sheet(rect.name, "TL2", 50, 25) assert imp1.name in self.aedtapp.modeler.get_boundaries_name() @@ -711,7 +717,7 @@ def test_16_create_impedance_on_sheets(self): assert imp2.name in self.aedtapp.modeler.get_boundaries_name() rect2 = self.aedtapp.modeler.create_rectangle( - self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="AniImpBound", matname="Copper" + self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="AniImpBound", material="Copper" ) assert not self.aedtapp.assign_impedance_to_sheet(rect2.name, "TL3", [50, 20, 0, 0], [25, 0, 5]) imp2 = self.aedtapp.assign_impedance_to_sheet(rect2.name, "TL3", [50, 20, 0, 0], [25, 0, 5, 0]) @@ -721,7 +727,7 @@ def test_16_create_impedance_on_sheets(self): def test_17_create_lumpedrlc_on_sheets(self): rect = self.aedtapp.modeler.create_rectangle( - self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="rlcBound", matname="Copper" + self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="rlcBound", material="Copper" ) imp = self.aedtapp.assign_lumped_rlc_to_sheet( rect.name, self.aedtapp.AxisDir.XPos, resistance=50, inductance=1e-9 @@ -730,7 +736,7 @@ def test_17_create_lumpedrlc_on_sheets(self): assert imp.name in self.aedtapp.modeler.get_boundaries_name() rect2 = self.aedtapp.modeler.create_rectangle( - self.aedtapp.PLANE.XY, [0, 0, 10], [10, 2], name="rlcBound2", matname="Copper" + self.aedtapp.PLANE.XY, [0, 0, 10], [10, 2], name="rlcBound2", material="Copper" ) imp = self.aedtapp.assign_lumped_rlc_to_sheet( rect.name, self.aedtapp.AxisDir.XPos, rlc_type="Serial", resistance=50, inductance=1e-9 @@ -760,7 +766,7 @@ def test_18_create_sources_on_objects(self): def test_19_create_lumped_on_sheet(self): rect = self.aedtapp.modeler.create_rectangle( - self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="lump_port", matname="Copper" + self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="lump_port", material="Copper" ) port = self.aedtapp.lumped_port( assignment=rect.name, @@ -806,7 +812,7 @@ def test_19_create_lumped_on_sheet(self): def test_20_create_voltage_on_sheet(self): rect = self.aedtapp.modeler.create_rectangle( - self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="lump_volt", matname="Copper" + self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="lump_volt", material="Copper" ) port = self.aedtapp.assign_voltage_source_to_sheet(rect.name, self.aedtapp.AxisDir.XNeg, "LumpVolt1") assert port.name in self.aedtapp.excitations @@ -887,9 +893,9 @@ def test_30a_add_mesh_link(self): def test_31_create_microstrip_port(self): self.aedtapp.insert_design("Microstrip") self.aedtapp.solution_type = "Modal" - ms = self.aedtapp.modeler.create_box([4, 5, 0], [1, 100, 0.2], name="MS1", matname="copper") - sub = self.aedtapp.modeler.create_box([0, 5, -2], [20, 100, 2], name="SUB1", matname="FR4_epoxy") - gnd = self.aedtapp.modeler.create_box([0, 5, -2.2], [20, 100, 0.2], name="GND1", matname="FR4_epoxy") + ms = self.aedtapp.modeler.create_box([4, 5, 0], [1, 100, 0.2], name="MS1", material="copper") + sub = self.aedtapp.modeler.create_box([0, 5, -2], [20, 100, 2], name="SUB1", material="FR4_epoxy") + gnd = self.aedtapp.modeler.create_box([0, 5, -2.2], [20, 100, 0.2], name="GND1", material="FR4_epoxy") port = self.aedtapp.wave_port( assignment=gnd.name, reference=ms.name, @@ -922,7 +928,7 @@ def test_31_create_microstrip_port(self): def test_32_get_property_value(self): rect = self.aedtapp.modeler.create_rectangle( - self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="RectProp", matname="Copper" + self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="RectProp", material="Copper" ) pe = self.aedtapp.assign_perfecte_to_sheets(rect.name, "PerfectE_1") setup = self.aedtapp.create_setup("MySetup2") @@ -943,7 +949,7 @@ def test_33_copy_solid_bodies(self, add_app): def test_34_object_material_properties(self): self.aedtapp.insert_design("ObjMat") self.aedtapp.solution_type = "Modal" - ms = self.aedtapp.modeler.create_box([4, 5, 0], [1, 100, 0.2], name="MS1", matname="copper") + ms = self.aedtapp.modeler.create_box([4, 5, 0], [1, 100, 0.2], name="MS1", material="copper") props = self.aedtapp.get_object_material_properties("MS1", "conductivity") assert props @@ -968,7 +974,7 @@ def test_38_get_all_sources(self): def test_40_assign_current_source_to_sheet(self): sheet = self.aedtapp.modeler.create_rectangle( - self.aedtapp.PLANE.XY, [0, 0, 0], [5, 1], name="RectangleForSource", matname="Copper" + self.aedtapp.PLANE.XY, [0, 0, 0], [5, 1], name="RectangleForSource", material="Copper" ) assert self.aedtapp.assign_current_source_to_sheet(sheet.name) assert self.aedtapp.assign_current_source_to_sheet( @@ -994,7 +1000,7 @@ def test_42_floquet_port(self): box1.faces[1], modes=7, deembed_distance=1, reporter_filter=[False, True, False, False, False, False, False] ) sheet = self.aedtapp.modeler.create_rectangle( - self.aedtapp.PLANE.XY, [-100, -100, -100], [200, 200], name="RectangleForSource", matname="Copper" + self.aedtapp.PLANE.XY, [-100, -100, -100], [200, 200], name="RectangleForSource", material="Copper" ) bound = self.aedtapp.create_floquet_port(sheet, modes=4, deembed_distance=1, reporter_filter=False) assert bound @@ -1027,7 +1033,7 @@ def test_43_autoassign_pairs(self): def test_44_create_infinite_sphere(self): self.aedtapp.insert_design("InfSphere") - air = self.aedtapp.modeler.create_box([0, 0, 0], [20, 20, 20], name="rad", matname="vacuum") + air = self.aedtapp.modeler.create_box([0, 0, 0], [20, 20, 20], name="rad", material="vacuum") self.aedtapp.assign_radiation_boundary_to_objects(air) bound = self.aedtapp.insert_infinite_sphere( definition="El Over Az", @@ -1071,8 +1077,8 @@ def test_45_set_autoopen(self): def test_45_terminal_port(self): self.aedtapp.insert_design("Design_Terminal") self.aedtapp.solution_type = "Terminal" - box1 = self.aedtapp.modeler.create_box([-100, -100, 0], [200, 200, 5], name="gnd", matname="copper") - box2 = self.aedtapp.modeler.create_box([-100, -100, 20], [200, 200, 25], name="sig", matname="copper") + box1 = self.aedtapp.modeler.create_box([-100, -100, 0], [200, 200, 5], name="gnd", material="copper") + box2 = self.aedtapp.modeler.create_box([-100, -100, 20], [200, 200, 25], name="sig", material="copper") sheet = self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.YZ, [-100, -100, 5], [200, 15], "port") port = self.aedtapp.lumped_port( assignment=box1, @@ -1111,10 +1117,10 @@ def test_45_terminal_port(self): def test_45B_terminal_port(self): self.aedtapp.insert_design("Design_Terminal_2") self.aedtapp.solution_type = "Terminal" - box1 = self.aedtapp.modeler.create_box([-100, -100, 0], [200, 200, 5], name="gnd2z", matname="copper") - box2 = self.aedtapp.modeler.create_box([-100, -100, 20], [200, 200, 25], name="sig2z", matname="copper") - box3 = self.aedtapp.modeler.create_box([-40, -40, -20], [80, 80, 10], name="box3", matname="copper") - box4 = self.aedtapp.modeler.create_box([-40, -40, 10], [80, 80, 10], name="box4", matname="copper") + box1 = self.aedtapp.modeler.create_box([-100, -100, 0], [200, 200, 5], name="gnd2z", material="copper") + box2 = self.aedtapp.modeler.create_box([-100, -100, 20], [200, 200, 25], name="sig2z", material="copper") + box3 = self.aedtapp.modeler.create_box([-40, -40, -20], [80, 80, 10], name="box3", material="copper") + box4 = self.aedtapp.modeler.create_box([-40, -40, 10], [80, 80, 10], name="box4", material="copper") box1.display_wireframe = True box2.display_wireframe = True box3.display_wireframe = True @@ -1126,8 +1132,8 @@ def test_45B_terminal_port(self): n_boundaries = len(self.aedtapp.boundaries) assert n_boundaries == 4 - box5 = self.aedtapp.modeler.create_box([-50, -15, 200], [150, -10, 200], name="gnd2y", matname="copper") - box6 = self.aedtapp.modeler.create_box([-50, 10, 200], [150, 15, 200], name="sig2y", matname="copper") + box5 = self.aedtapp.modeler.create_box([-50, -15, 200], [150, -10, 200], name="gnd2y", material="copper") + box6 = self.aedtapp.modeler.create_box([-50, 10, 200], [150, 15, 200], name="sig2y", material="copper") box5.display_wireframe = True box6.display_wireframe = True self.aedtapp.modeler.fit_all() @@ -1137,8 +1143,8 @@ def test_45B_terminal_port(self): n_boundaries = len(self.aedtapp.boundaries) assert n_boundaries == 8 - box7 = self.aedtapp.modeler.create_box([-15, 300, 0], [-10, 200, 100], name="gnd2x", matname="copper") - box8 = self.aedtapp.modeler.create_box([15, 300, 0], [10, 200, 100], name="sig2x", matname="copper") + box7 = self.aedtapp.modeler.create_box([-15, 300, 0], [-10, 200, 100], name="gnd2x", material="copper") + box8 = self.aedtapp.modeler.create_box([15, 300, 0], [10, 200, 100], name="sig2x", material="copper") box7.display_wireframe = True box8.display_wireframe = True self.aedtapp.modeler.fit_all() @@ -1155,16 +1161,16 @@ def test_45B_terminal_port(self): # Rotate box3 so that, box3 and box4 are not collinear anymore. # Spiral lumped port can only be created based on 2 collinear objects. - box3.rotate(cs_axis="X", angle=90) + box3.rotate(axis="X", angle=90) with pytest.raises(AttributeError) as execinfo: self.aedtapp.create_spiral_lumped_port(box3, box4) assert execinfo.args[0] == "The two objects must have parallel adjacent faces." # Rotate back box3 # rotate them slightly so that they are still parallel, but not aligned anymore with main planes. - box3.rotate(cs_axis="X", angle=-90) - box3.rotate(cs_axis="Y", angle=5) - box4.rotate(cs_axis="Y", angle=5) + box3.rotate(axis="X", angle=-90) + box3.rotate(axis="Y", angle=5) + box4.rotate(axis="Y", angle=5) with pytest.raises(AttributeError) as execinfo: self.aedtapp.create_spiral_lumped_port(box3, box4) assert ( @@ -1186,8 +1192,8 @@ def test_48_traces(self): assert len(self.aedtapp.get_traces_for_plot()) > 0 def test_49_port_creation_exception(self): - box1 = self.aedtapp.modeler.create_box([-400, -40, -20], [80, 80, 10], name="gnd49", matname="copper") - box2 = self.aedtapp.modeler.create_box([-400, -40, 10], [80, 80, 10], name="sig49", matname="copper") + box1 = self.aedtapp.modeler.create_box([-400, -40, -20], [80, 80, 10], name="gnd49", material="copper") + box2 = self.aedtapp.modeler.create_box([-400, -40, 10], [80, 80, 10], name="sig49", material="copper") self.aedtapp.solution_type = "Modal" # Spiral lumped port can only be created in a 'Terminal' solution. @@ -1325,7 +1331,7 @@ def test_54_assign_symmetry(self, add_app): aedtapp.close_project(save_project=False) def test_55_create_near_field_sphere(self): - air = self.aedtapp.modeler.create_box([0, 0, 0], [20, 20, 20], name="rad", matname="vacuum") + air = self.aedtapp.modeler.create_box([0, 0, 0], [20, 20, 20], name="rad", material="vacuum") self.aedtapp.assign_radiation_boundary_to_objects(air) bound = self.aedtapp.insert_near_field_sphere( radius=20, diff --git a/_unittest/test_21_Circuit.py b/_unittest/test_21_Circuit.py index a9620f5139d..3127d33b886 100644 --- a/_unittest/test_21_Circuit.py +++ b/_unittest/test_21_Circuit.py @@ -109,7 +109,7 @@ def test_05b_add_pin_iport(self): def test_05c_create_component(self): assert self.aedtapp.modeler.schematic.create_new_component_from_symbol("Test", ["1", "2"]) assert self.aedtapp.modeler.schematic.create_new_component_from_symbol( - "Test1", [1, 2], parameter_list=["Author:=", "NumTerminals:="], parameter_value=["pyaedt", 2] + "Test1", [1, 2], parameters=["Author:=", "NumTerminals:="], values=["pyaedt", 2] ) def test_06a_create_setup(self): @@ -155,7 +155,7 @@ def test_12_connect_components(self): assert "Port1" in portname.name assert myind.pins[0].connect_to_component(portname.pins[0]) assert myind.pins[1].connect_to_component(myres.pins[1], use_wire=True) - assert self.aedtapp.modeler.connect_schematic_components(myres.id, mycap.id, pinnum_first=1) + assert self.aedtapp.modeler.connect_schematic_components(myres.id, mycap.id, pin_starting=1) gnd = self.aedtapp.modeler.schematic.create_gnd() assert mycap.pins[1].connect_to_component(gnd.pins[0]) # create_interface_port @@ -182,14 +182,13 @@ def test_14_move(self): assert self.aedtapp.modeler.move("L14", [0, -0.00508]) assert myind.location == [0.01016, 0.00508] self.aedtapp.modeler.schematic_units = "mil" - assert self.aedtapp.modeler.move( - "L14", - [0, 200], - ) + assert self.aedtapp.modeler.move("L14", [0, 200]) assert myind.location == [400.0, 400.0] def test_15_rotate(self): - assert self.aedtapp.modeler.rotate("IPort@Port1") + assert self.aedtapp.modeler.rotate( + "IPort@Port1", + ) def test_16_read_touchstone(self): from pyaedt.generic.touchstone_parser import read_touchstone @@ -378,13 +377,13 @@ def test_29_create_circuit_from_spice(self): def test_29a_create_circuit_from_spice_edit_symbol(self): model = os.path.join(local_path, "example_models", test_subfolder, "test.lib") assert self.aedtapp.modeler.schematic.create_component_from_spicemodel( - model_path=model, model_name="GRM5678", symbol_name="nexx_cap" + input_file=model, model="GRM5678", symbol="nexx_cap" ) assert self.aedtapp.modeler.schematic.create_component_from_spicemodel( - model_path=model, model_name="GRM6789", symbol_name="nexx_inductor" + input_file=model, model="GRM6789", symbol="nexx_inductor" ) assert self.aedtapp.modeler.schematic.create_component_from_spicemodel( - model_path=model, model_name="GRM9012", symbol_name="nexx_res" + input_file=model, model="GRM9012", symbol="nexx_res" ) def test_30_create_subcircuit(self): @@ -465,7 +464,7 @@ def test_35_netlist_data_block(self): assert self.aedtapp.analyze() def test_36_create_voltage_probe(self): - myprobe = self.aedtapp.modeler.components.create_voltage_probe(probe_name="test_probe", location=[0.4, 0.2]) + myprobe = self.aedtapp.modeler.components.create_voltage_probe(name="test_probe", location=[0.4, 0.2]) assert type(myprobe.id) is int def test_37_draw_graphical_primitives(self): @@ -708,16 +707,16 @@ def test_42_create_wire(self): myres = self.aedtapp.modeler.schematic.create_resistor("R101", location=[0.0, 0.0]) myres2 = self.aedtapp.modeler.components.get_component(myres.composed_name) self.aedtapp.modeler.schematic.create_wire( - [myind.pins[0].location, myres.pins[1].location], wire_name="wire_name_test" + [myind.pins[0].location, myres.pins[1].location], name="wire_name_test" ) wire_names = [] for key in self.aedtapp.modeler.schematic.wires.keys(): wire_names.append(self.aedtapp.modeler.schematic.wires[key].name) assert "wire_name_test" in wire_names assert not self.aedtapp.modeler.schematic.create_wire( - [["100mil", "0"], ["100mil", "100mil"]], wire_name="wire_name_test1" + [["100mil", "0"], ["100mil", "100mil"]], name="wire_name_test1" ) - self.aedtapp.modeler.schematic.create_wire([[0.02, 0.02], [0.04, 0.02]], wire_name="wire_test1") + self.aedtapp.modeler.schematic.create_wire([[0.02, 0.02], [0.04, 0.02]], name="wire_test1") wire_keys = [key for key in self.aedtapp.modeler.schematic.wires] for key in wire_keys: if self.aedtapp.modeler.schematic.wires[key].name == "wire_test1": @@ -737,13 +736,13 @@ def test_42_create_wire(self): def test_43_display_wire_properties(self): self.aedtapp.set_active_design("CreateWireTest") assert self.aedtapp.modeler.wire.display_wire_properties( - wire_name="wire_name_test", property_to_display="NetName", visibility="Value", location="Top" + name="wire_name_test", property_to_display="NetName", visibility="Value", location="Top" ) assert not self.aedtapp.modeler.wire.display_wire_properties( - wire_name="invalid", property_to_display="NetName", visibility="Value", location="Top" + name="invalid", property_to_display="NetName", visibility="Value", location="Top" ) assert not self.aedtapp.modeler.wire.display_wire_properties( - wire_name="invalid", property_to_display="NetName", visibility="Value", location="invalid" + name="invalid", property_to_display="NetName", visibility="Value", location="invalid" ) def test_44_auto_wire(self): @@ -767,19 +766,7 @@ def test_44_auto_wire(self): def test_43_create_and_change_prop_text(self): self.aedtapp.insert_design("text") self.aedtapp.modeler.schematic_units = "mil" - text = self.aedtapp.modeler.create_text( - "text test", - 100, - 300, - text_size=14, - text_angle=45, - text_color=[255, 0, 0], - show_rect=True, - rect_line_width=3, - rect_border_color=[0, 255, 0], - rect_fill=1, - rect_color=[0, 0, 255], - ) + text = self.aedtapp.modeler.create_text("text test", 100, 300) assert isinstance(text, str) assert text in self.aedtapp.oeditor.GetAllGraphics() assert self.aedtapp.modeler.create_text("text test", "1000mil", "-2000mil") @@ -814,7 +801,7 @@ def test_45_create_circuit_from_multizone_layout(self, add_edb): def test_46_create_vpwl(self): # default inputs - myres = self.aedtapp.modeler.schematic.create_voltage_pwl(compname="V1") + myres = self.aedtapp.modeler.schematic.create_voltage_pwl(name="V1") assert myres.refdes != "" assert type(myres.id) is int assert myres.parameters["time1"] == "0s" @@ -822,9 +809,7 @@ def test_46_create_vpwl(self): assert myres.parameters["val1"] == "0V" assert myres.parameters["val2"] == "0V" # time and voltage input list - myres = self.aedtapp.modeler.schematic.create_voltage_pwl( - compname="V2", time_list=[0, "1u"], voltage_list=[0, 1] - ) + myres = self.aedtapp.modeler.schematic.create_voltage_pwl(name="V2", time_list=[0, "1u"], voltage_list=[0, 1]) assert myres.refdes != "" assert type(myres.id) is int assert myres.parameters["time1"] == "0" @@ -832,7 +817,7 @@ def test_46_create_vpwl(self): assert myres.parameters["val1"] == "0" assert myres.parameters["val2"] == "1" # time and voltage different length - myres = self.aedtapp.modeler.schematic.create_voltage_pwl(compname="V3", time_list=[0], voltage_list=[0, 1]) + myres = self.aedtapp.modeler.schematic.create_voltage_pwl(name="V3", time_list=[0], voltage_list=[0, 1]) assert myres is False def test_47_automatic_lna(self): diff --git a/_unittest/test_27_Maxwell2D.py b/_unittest/test_27_Maxwell2D.py index c7de0e95245..785541d64f9 100644 --- a/_unittest/test_27_Maxwell2D.py +++ b/_unittest/test_27_Maxwell2D.py @@ -51,7 +51,7 @@ def test_03_assign_initial_mesh_from_slider(self): def test_04_create_winding(self): bounds = self.aedtapp.assign_winding(assignment=["Coil"], current=20e-3) assert bounds - o = self.aedtapp.modeler.create_rectangle([0, 0, 0], [3, 1], name="Rectangle2", matname="copper") + o = self.aedtapp.modeler.create_rectangle([0, 0, 0], [3, 1], name="Rectangle2", material="copper") bounds = self.aedtapp.assign_winding(assignment=o.id, current=20e-3) assert bounds bounds = self.aedtapp.assign_winding(assignment=["Coil"], current="20e-3A") @@ -130,7 +130,7 @@ def test_11_assign_force(self): def test_12_assign_current_source(self): coil = self.aedtapp.modeler.create_circle( - position=[0, 0, 0], radius=5, num_sides="8", is_covered=True, name="Coil", matname="Copper" + position=[0, 0, 0], radius=5, num_sides="8", is_covered=True, name="Coil", material="Copper" ) assert self.aedtapp.assign_current([coil]) assert not self.aedtapp.assign_current([coil.faces[0].id]) @@ -189,8 +189,8 @@ def test_17_mesh_settings(self): def test_18_end_connection(self): self.aedtapp.insert_design("EndConnection") self.aedtapp.solution_type = SOLUTIONS.Maxwell2d.TransientXY - rect = self.aedtapp.modeler.create_rectangle([0, 0, 0], [5, 5], matname="aluminum") - rect2 = self.aedtapp.modeler.create_rectangle([15, 20, 0], [5, 5], matname="aluminum") + rect = self.aedtapp.modeler.create_rectangle([0, 0, 0], [5, 5], material="aluminum") + rect2 = self.aedtapp.modeler.create_rectangle([15, 20, 0], [5, 5], material="aluminum") bound = self.aedtapp.assign_end_connection([rect, rect2]) assert bound assert bound.props["ResistanceValue"] == "0ohm" @@ -203,10 +203,10 @@ def test_18_end_connection(self): def test_19_matrix(self): self.aedtapp.insert_design("Matrix") self.aedtapp.solution_type = SOLUTIONS.Maxwell2d.MagnetostaticXY - self.aedtapp.modeler.create_rectangle([0, 1.5, 0], [8, 3], is_covered=True, name="Coil_1", matname="vacuum") - self.aedtapp.modeler.create_rectangle([8.5, 1.5, 0], [8, 3], is_covered=True, name="Coil_2", matname="vacuum") - self.aedtapp.modeler.create_rectangle([16, 1.5, 0], [8, 3], is_covered=True, name="Coil_3", matname="vacuum") - self.aedtapp.modeler.create_rectangle([32, 1.5, 0], [8, 3], is_covered=True, name="Coil_4", matname="vacuum") + self.aedtapp.modeler.create_rectangle([0, 1.5, 0], [8, 3], is_covered=True, name="Coil_1", material="vacuum") + self.aedtapp.modeler.create_rectangle([8.5, 1.5, 0], [8, 3], is_covered=True, name="Coil_2", material="vacuum") + self.aedtapp.modeler.create_rectangle([16, 1.5, 0], [8, 3], is_covered=True, name="Coil_3", material="vacuum") + self.aedtapp.modeler.create_rectangle([32, 1.5, 0], [8, 3], is_covered=True, name="Coil_4", material="vacuum") self.aedtapp.assign_current("Coil_1", amplitude=1, swap_direction=False, name="Current1") self.aedtapp.assign_current("Coil_2", amplitude=1, swap_direction=True, name="Current2") self.aedtapp.assign_current("Coil_3", amplitude=1, swap_direction=True, name="Current3") diff --git a/_unittest/test_28_Maxwell3D.py b/_unittest/test_28_Maxwell3D.py index d72aee67611..a877e656bf1 100644 --- a/_unittest/test_28_Maxwell3D.py +++ b/_unittest/test_28_Maxwell3D.py @@ -87,7 +87,7 @@ def test_01_display(self): def test_01A_litz_wire(self): cylinder = self.aedtapp.modeler.create_cylinder( - cs_axis="X", position=[50, 0, 0], radius=0.8, height=20, name="Wire", matname="magnesium" + orientation="X", origin=[50, 0, 0], radius=0.8, height=20, name="Wire", material="magnesium" ) self.aedtapp.materials["magnesium"].stacking_type = "Litz Wire" self.aedtapp.materials["magnesium"].wire_type = "Round" @@ -116,7 +116,7 @@ def test_01A_litz_wire(self): def test_01B_lamination(self): cylinder = self.aedtapp.modeler.create_cylinder( - cs_axis="X", position=[2000, 0, 0], radius=0.8, height=20, name="Lamination_model", matname="titanium" + orientation="X", origin=[2000, 0, 0], radius=0.8, height=20, name="Lamination_model", material="titanium" ) self.aedtapp.materials["titanium"].stacking_type = "Lamination" self.aedtapp.materials["titanium"].stacking_factor = "0.99" @@ -312,10 +312,7 @@ def test_26_create_udp(self): # Test udp with a custom name. my_udpName = "MyClawPoleCore" udp = self.aedtapp.modeler.create_udp( - udp_dll_name="RMxprt/ClawPoleCore", - udp_parameters_list=my_udpPairs, - upd_library="syslib", - name=my_udpName, + dll="RMxprt/ClawPoleCore", parameters=my_udpPairs, library="syslib", name=my_udpName ) assert udp @@ -325,9 +322,7 @@ def test_26_create_udp(self): # Modify one of the 'MyClawPoleCore' udp properties. assert self.aedtapp.modeler.update_udp( - object_name="MyClawPoleCore", - operation_name="CreateUserDefinedPart", - udp_parameters_list=[["Length", "110mm"]], + assignment="MyClawPoleCore", operation="CreateUserDefinedPart", parameters=[["Length", "110mm"]] ) assert int(udp.bounding_dimension[0]) == 102 @@ -336,9 +331,7 @@ def test_26_create_udp(self): # Test udp with default name -None-. second_udp = self.aedtapp.modeler.create_udp( - udp_dll_name="RMxprt/ClawPoleCore", - udp_parameters_list=my_udpPairs, - upd_library="syslib", + dll="RMxprt/ClawPoleCore", parameters=my_udpPairs, library="syslib" ) assert second_udp @@ -347,9 +340,9 @@ def test_26_create_udp(self): # Modify two of the 'MyClawPoleCore' udp properties. assert self.aedtapp.modeler.update_udp( - object_name="ClawPoleCore", - operation_name="CreateUserDefinedPart", - udp_parameters_list=[["Length", "110mm"], ["DiaGap", "125mm"]], + assignment="ClawPoleCore", + operation="CreateUserDefinedPart", + parameters=[["Length", "110mm"], ["DiaGap", "125mm"]], ) assert int(second_udp.bounding_dimension[0]) == 125 @@ -374,9 +367,7 @@ def test_26_create_udp(self): python_udp_parameters.append(mypair) udp_from_python = self.aedtapp.modeler.create_udp( - udp_dll_name="Examples/RectangularSpiral.py", - udp_parameters_list=python_udp_parameters, - name="PythonSpiral", + dll="Examples/RectangularSpiral.py", parameters=python_udp_parameters, name="PythonSpiral" ) assert udp_from_python @@ -413,7 +404,7 @@ def test_27_create_udm(self): my_udmPairs.append(mypair) assert self.aedtapp.modeler.create_udm( - udmfullname="Maxwell3D/OnDieSpiralInductor.py", udm_params_list=my_udmPairs, udm_library="syslib" + udm_full_name="Maxwell3D/OnDieSpiralInductor.py", parameters=my_udmPairs, library="syslib" ) def test_28_assign_torque(self): @@ -458,10 +449,10 @@ def test_31_core_losses(self, add_app): def test_32_matrix(self, add_app): m3d = add_app(application=Maxwell3d, design_name="Matrix1") m3d.solution_type = SOLUTIONS.Maxwell3d.ElectroStatic - m3d.modeler.create_box([0, 1.5, 0], [1, 2.5, 5], name="Coil_1", matname="aluminum") - m3d.modeler.create_box([8.5, 1.5, 0], [1, 2.5, 5], name="Coil_2", matname="aluminum") - m3d.modeler.create_box([16, 1.5, 0], [1, 2.5, 5], name="Coil_3", matname="aluminum") - m3d.modeler.create_box([32, 1.5, 0], [1, 2.5, 5], name="Coil_4", matname="aluminum") + m3d.modeler.create_box([0, 1.5, 0], [1, 2.5, 5], name="Coil_1", material="aluminum") + m3d.modeler.create_box([8.5, 1.5, 0], [1, 2.5, 5], name="Coil_2", material="aluminum") + m3d.modeler.create_box([16, 1.5, 0], [1, 2.5, 5], name="Coil_3", material="aluminum") + m3d.modeler.create_box([32, 1.5, 0], [1, 2.5, 5], name="Coil_4", material="aluminum") rectangle1 = m3d.modeler.create_rectangle(0, [0.5, 1.5, 0], [2.5, 5], name="Sheet1") rectangle2 = m3d.modeler.create_rectangle(0, [9, 1.5, 0], [2.5, 5], name="Sheet2") @@ -491,10 +482,10 @@ def test_32_matrix(self, add_app): def test_32B_matrix(self, add_app): m3d = add_app(application=Maxwell3d, design_name="Matrix2") m3d.solution_type = SOLUTIONS.Maxwell3d.EddyCurrent - m3d.modeler.create_box([0, 1.5, 0], [1, 2.5, 5], name="Coil_1", matname="aluminum") - m3d.modeler.create_box([8.5, 1.5, 0], [1, 2.5, 5], name="Coil_2", matname="aluminum") - m3d.modeler.create_box([16, 1.5, 0], [1, 2.5, 5], name="Coil_3", matname="aluminum") - m3d.modeler.create_box([32, 1.5, 0], [1, 2.5, 5], name="Coil_4", matname="aluminum") + m3d.modeler.create_box([0, 1.5, 0], [1, 2.5, 5], name="Coil_1", material="aluminum") + m3d.modeler.create_box([8.5, 1.5, 0], [1, 2.5, 5], name="Coil_2", material="aluminum") + m3d.modeler.create_box([16, 1.5, 0], [1, 2.5, 5], name="Coil_3", material="aluminum") + m3d.modeler.create_box([32, 1.5, 0], [1, 2.5, 5], name="Coil_4", material="aluminum") rectangle1 = m3d.modeler.create_rectangle(0, [0.5, 1.5, 0], [2.5, 5], name="Sheet1") rectangle2 = m3d.modeler.create_rectangle(0, [9, 1.5, 0], [2.5, 5], name="Sheet2") @@ -683,9 +674,9 @@ def test_40_assign_impedance(self): @pytest.mark.skipif(desktop_version < "2023.1", reason="Method implemented in AEDT 2023R1") def test_41_conduction_paths(self): self.aedtapp.insert_design("conduction") - box1 = self.aedtapp.modeler.create_box([0, 0, 0], [10, 10, 1], matname="copper") - box1 = self.aedtapp.modeler.create_box([0, 0, 0], [-10, 10, 1], matname="copper") - box3 = self.aedtapp.modeler.create_box([-50, -50, -50], [1, 1, 1], matname="copper") + box1 = self.aedtapp.modeler.create_box([0, 0, 0], [10, 10, 1], material="copper") + box1 = self.aedtapp.modeler.create_box([0, 0, 0], [-10, 10, 1], material="copper") + box3 = self.aedtapp.modeler.create_box([-50, -50, -50], [1, 1, 1], material="copper") assert len(self.aedtapp.get_conduction_paths()) == 2 def test_43_eddy_effect_transient(self, m3dtransient): @@ -913,10 +904,10 @@ def test_56_zero_tangential_h_field(self, add_app): def test_57_radiation(self): self.aedtapp.insert_design("Radiation") self.aedtapp.solution_type = SOLUTIONS.Maxwell3d.EddyCurrent - rect = self.aedtapp.modeler.create_rectangle(0, [0, 0, 0], [5, 5], matname="aluminum") - rect2 = self.aedtapp.modeler.create_rectangle(0, [15, 20, 0], [5, 5], matname="aluminum") - box = self.aedtapp.modeler.create_box([15, 20, 0], [5, 5, 5], matname="aluminum") - box2 = self.aedtapp.modeler.create_box([150, 20, 0], [50, 5, 10], matname="aluminum") + rect = self.aedtapp.modeler.create_rectangle(0, [0, 0, 0], [5, 5], material="aluminum") + rect2 = self.aedtapp.modeler.create_rectangle(0, [15, 20, 0], [5, 5], material="aluminum") + box = self.aedtapp.modeler.create_box([15, 20, 0], [5, 5, 5], material="aluminum") + box2 = self.aedtapp.modeler.create_box([150, 20, 0], [50, 5, 10], material="aluminum") bound = self.aedtapp.assign_radiation([rect, rect2, box, box2.faces[0]]) assert bound bound2 = self.aedtapp.assign_radiation([rect, rect2, box, box2.faces[0]], "my_rad") diff --git a/_unittest/test_30_Q2D.py b/_unittest/test_30_Q2D.py index a87266d1d8a..e7e6ed8bf5c 100644 --- a/_unittest/test_30_Q2D.py +++ b/_unittest/test_30_Q2D.py @@ -67,14 +67,14 @@ def test_07_single_signal_line(self): assert self.aedtapp.assign_single_conductor(target_objects=o, solve_option="SolveOnBoundary") def test_08_assign_huray_finitecond_to_edges(self): - o = self.aedtapp.create_rectangle([6, 6], [5, 3], name="Rectangle1", matname="Copper") + o = self.aedtapp.create_rectangle([6, 6], [5, 3], name="Rectangle1", material="Copper") self.aedtapp.assign_single_conductor(target_objects=o, solve_option="SolveOnBoundary") assert self.aedtapp.assign_huray_finitecond_to_edges(o.edges, radius=0.5, ratio=2.9) def test_09_auto_assign(self): self.aedtapp.insert_design("test_auto") - o = self.aedtapp.create_rectangle([6, 6], [5, 3], name="Rectangle1", matname="Copper") - o = self.aedtapp.create_rectangle([0, 0], [5, 3], name="Rectangle2", matname="Copper") + o = self.aedtapp.create_rectangle([6, 6], [5, 3], name="Rectangle1", material="Copper") + o = self.aedtapp.create_rectangle([0, 0], [5, 3], name="Rectangle2", material="Copper") assert self.aedtapp.auto_assign_conductors() assert self.aedtapp.boundaries[0].object_properties assert len(self.aedtapp.boundaries) == 2 @@ -123,9 +123,9 @@ def test_12_edit_sources(self, add_app): def test_13_get_all_conductors(self): self.aedtapp.insert_design("condcutors") - o = self.aedtapp.create_rectangle([6, 6], [5, 3], name="Rectangle1", matname="Copper") - o1 = self.aedtapp.create_rectangle([7, 5], [5, 3], name="Rectangle2", matname="aluminum") - o3 = self.aedtapp.create_rectangle([27, 5], [5, 3], name="Rectangle3", matname="air") + o = self.aedtapp.create_rectangle([6, 6], [5, 3], name="Rectangle1", material="Copper") + o1 = self.aedtapp.create_rectangle([7, 5], [5, 3], name="Rectangle2", material="aluminum") + o3 = self.aedtapp.create_rectangle([27, 5], [5, 3], name="Rectangle3", material="air") conductors = self.aedtapp.get_all_conductors_names() assert sorted(conductors) == ["Rectangle1", "Rectangle2"] assert self.aedtapp.get_all_dielectrics_names() == ["Rectangle3"] diff --git a/_unittest/test_41_3dlayout_modeler.py b/_unittest/test_41_3dlayout_modeler.py index 457f9bebea4..6af2ec8d4f9 100644 --- a/_unittest/test_41_3dlayout_modeler.py +++ b/_unittest/test_41_3dlayout_modeler.py @@ -61,7 +61,7 @@ def test_01_creatematerial(self): def test_02_stackup(self): s1 = self.aedtapp.modeler.layers.add_layer( - layername="Bottom", layertype="signal", thickness="0.035mm", elevation="0mm", material="iron" + layer="Bottom", layer_type="signal", thickness="0.035mm", elevation="0mm", material="iron" ) s1.color = [220, 10, 10] s1.is_visible = False @@ -159,7 +159,7 @@ def test_02_stackup(self): assert s1._BNR == 0.1 d1 = self.aedtapp.modeler.layers.add_layer( - layername="Diel3", layertype="dielectric", thickness="1.0mm", elevation="0.035mm", material="plexiglass" + layer="Diel3", layer_type="dielectric", thickness="1.0mm", elevation="0.035mm", material="plexiglass" ) assert d1.material == "plexiglass" assert d1.thickness == "1.0mm" or d1.thickness == 1e-3 @@ -170,8 +170,8 @@ def test_02_stackup(self): assert d1.material == "fr4_epoxy" assert d1.transparency == 23 s2 = self.aedtapp.modeler.layers.add_layer( - layername="Top", - layertype="signal", + layer="Top", + layer_type="signal", thickness=3.5e-5, elevation="1.035mm", material="copper", @@ -220,12 +220,16 @@ def test_05_subtract(self): def test_06_unite(self): n1 = self.aedtapp.modeler.create_circle("Top", 0, 5, 8, "mycircle2") n2 = self.aedtapp.modeler.create_rectangle("Top", [0, 0], [6, 8], 3, 2, "myrectangle2") - assert self.aedtapp.modeler.unite([n1, n2]) + assert self.aedtapp.modeler.unite( + [n1, n2], + ) def test_07_intersect(self): n1 = self.aedtapp.modeler.create_circle("Top", 0, 5, 8, "mycircle3") n2 = self.aedtapp.modeler.create_rectangle("Top", [0, 0], [6, 8], 3, 2, "myrectangle3") - assert self.aedtapp.modeler.intersect([n1, n2]) + assert self.aedtapp.modeler.intersect( + [n1, n2], + ) def test_08_objectlist(self): a = self.aedtapp.modeler.geometries @@ -242,7 +246,7 @@ def test_10_create_padstack(self): pad1 = self.aedtapp.modeler.new_padstack("My_padstack2") hole1 = pad1.add_hole() pad1.add_layer("Start", pad_hole=hole1, thermal_hole=hole1) - hole2 = pad1.add_hole(holetype="Rct", sizes=[0.5, 0.8]) + hole2 = pad1.add_hole(hole_type="Rct", sizes=[0.5, 0.8]) pad1.add_layer("Default", pad_hole=hole2, thermal_hole=hole2) pad1.add_layer("Stop", pad_hole=hole1, thermal_hole=hole1) pad1.hole.sizes = ["0.8mm"] @@ -269,7 +273,7 @@ def test_11_create_via(self): assert self.aedtapp.modeler.vias[via_1].location[1] == float(1) assert self.aedtapp.modeler.vias[via_1].angle == "0deg" assert self.aedtapp.modeler.vias[via_1].holediam == "1mm" - via2 = self.aedtapp.modeler.create_via("PlanarEMVia", x=10, y=10, name="Via123", netname="VCC") + via2 = self.aedtapp.modeler.create_via("PlanarEMVia", x=10, y=10, name="Via123", net="VCC") via_2 = via2.name assert isinstance(via_2, str) assert self.aedtapp.modeler.vias[via_2].name == via_2 @@ -278,9 +282,7 @@ def test_11_create_via(self): assert self.aedtapp.modeler.vias[via_2].location[1] == float(10) assert self.aedtapp.modeler.vias[via_2].angle == "0deg" assert "VCC" in self.aedtapp.oeditor.GetNets() - via_3 = self.aedtapp.modeler.create_via( - "PlanarEMVia", x=5, y=5, name="Via1234", netname="VCC", hole_diam="22mm" - ) + via_3 = self.aedtapp.modeler.create_via("PlanarEMVia", x=5, y=5, hole_diam="22mm", name="Via1234", net="VCC") assert via_3.location[0] == float(5) assert via_3.location[1] == float(5) assert via_3.angle == "0deg" @@ -288,9 +290,7 @@ def test_11_create_via(self): assert "VCC" in self.aedtapp.oeditor.GetNets() def test_12_create_line(self): - line = self.aedtapp.modeler.create_line( - "Bottom", [[0, 0], [10, 30], [20, 30]], lw=1, name="line2", net_name="VCC" - ) + line = self.aedtapp.modeler.create_line("Bottom", [[0, 0], [10, 30], [20, 30]], lw=1, name="line2", net="VCC") assert line.name == "line2" line.name = "line1" assert isinstance(line.center_line, dict) @@ -543,9 +543,11 @@ def test_30_expand(self): assert isinstance(out1, str) def test_31_heal(self): - l1 = self.aedtapp.modeler.create_line("Bottom", [[0, 0], [100, 0]], 0.5, name="poly_1111") - l2 = self.aedtapp.modeler.create_line("Bottom", [[100, 0], [120, -35]], 0.5, name="poly_2222") - self.aedtapp.modeler.unite([l1, l2]) + l1 = self.aedtapp.modeler.create_line("Bottom", [[0, 0], [100, 0]], 0.5) + l2 = self.aedtapp.modeler.create_line("Bottom", [[100, 0], [120, -35]], 0.5) + self.aedtapp.modeler.unite( + [l1, l2], + ) assert self.aedtapp.modeler.colinear_heal("poly_2222", tolerance=0.25) def test_32_cosim_simulation(self): @@ -582,9 +584,7 @@ def test_34_create_additional_setup(self): def test_35a_export_layout(self): self.aedtapp.insert_design("export_layout") - s1 = self.aedtapp.modeler.layers.add_layer( - layername="Top", layertype="signal", thickness="0.035mm", elevation="0mm", material="iron" - ) + s1 = self.aedtapp.modeler.layers.add_layer(layer="Top") n2 = self.aedtapp.modeler.create_rectangle("Top", [0, 0], [6, 8], 3, 2, "myrectangle") output = self.aedtapp.export_3d_model() time_out = 0 diff --git a/_unittest/test_44_TouchstoneParser.py b/_unittest/test_44_TouchstoneParser.py index e8f540fa58c..a7ed22c3ff8 100644 --- a/_unittest/test_44_TouchstoneParser.py +++ b/_unittest/test_44_TouchstoneParser.py @@ -49,7 +49,7 @@ def test_03_check_touchstone_file(self): check = check_touchstone_files(folder=test_T44_dir) assert check for k, v in check.items(): - if v[0] == "passivity": + if v and v[0] == "passivity": assert v[1] - elif v[0] == "causality": + elif v and v[0] == "causality": assert not v[1] diff --git a/_unittest/test_98_Icepak.py b/_unittest/test_98_Icepak.py index 1ec1e02ee0e..212ea79b7d9 100644 --- a/_unittest/test_98_Icepak.py +++ b/_unittest/test_98_Icepak.py @@ -493,7 +493,7 @@ def test_36_create_heat_sink(self): patternangle=8, numcolumn_perside=3, vertical_separation=5.5, - matname="Copper", + material="Copper", center=[10, 0, 0], plane_enum=self.aedtapp.PLANE.XY, rotation=45, @@ -501,7 +501,7 @@ def test_36_create_heat_sink(self): ) box = self.aedtapp.modeler.create_box([0, 0, 0], [20, 20, 3]) top_face = box.top_face_z - hs, _ = self.aedtapp.create_parametric_heatsink_on_face(top_face, matname="Al-Extruded") + hs, _ = self.aedtapp.create_parametric_heatsink_on_face(top_face, material="Al-Extruded") assert hs hs.delete() box.rotate(0, 52) @@ -513,7 +513,7 @@ def test_36_create_heat_sink(self): fin_length=0.95, hs_basethick=0.2, separation=0.2, - matname="Al-Extruded", + material="Al-Extruded", ) assert hs hs.delete() @@ -848,7 +848,7 @@ def test_51_advanced3dcomp_import(self): cs2.props["OriginZ"] = 20 file_path = self.local_scratch.path self.aedtapp.modeler.insert_3d_component( - comp_file=os.path.join(file_path, file_name), targetCS="CS2", auxiliary_dict=True + input_file=os.path.join(file_path, file_name), coordinate_system="CS2", auxiliary_parameters=True ) assert all(i in self.aedtapp.native_components.keys() for i in ["Fan", "Board"]) @@ -867,7 +867,10 @@ def test_51_advanced3dcomp_import(self): self.aedtapp.delete_design() self.aedtapp.insert_design("test_51_2") self.aedtapp.modeler.insert_3d_component( - comp_file=os.path.join(file_path, file_name), targetCS="Global", auxiliary_dict=False, name="test" + input_file=os.path.join(file_path, file_name), + coordinate_system="Global", + name="test", + auxiliary_parameters=False, ) self.aedtapp.delete_design() @@ -882,7 +885,7 @@ def test_52_flatten_3d_components(self): file_path = self.local_scratch.path file_name = "Advanced3DComp.a3dcomp" self.aedtapp.modeler.insert_3d_component( - comp_file=os.path.join(file_path, file_name), targetCS="CS2", auxiliary_dict=True + input_file=os.path.join(file_path, file_name), coordinate_system="CS2", auxiliary_parameters=True ) mon_name = self.aedtapp.monitor.assign_face_monitor( list(self.aedtapp.modeler.user_defined_components["board_assembly1"].parts.values())[0].faces[0].id @@ -1329,7 +1332,7 @@ def test_66_update_3d_component(self): self.aedtapp.insert_design("test_66") self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.XY, [0, 0, 0], [10, 20], name="surf1") self.aedtapp.modeler.create_3dcomponent(os.path.join(file_path, file_name)) - self.aedtapp.modeler.insert_3d_component(comp_file=os.path.join(file_path, file_name), name="test") + self.aedtapp.modeler.insert_3d_component(input_file=os.path.join(file_path, file_name), name="test") component_filepath = self.aedtapp.modeler.user_defined_components["test"].get_component_filepath() assert component_filepath comp = self.aedtapp.modeler.user_defined_components["test"].edit_definition() @@ -1422,7 +1425,7 @@ def test_69_recirculation_boundary(self): ) def test_70_blower_boundary(self): - cylinder = self.aedtapp.modeler.create_cylinder(cs_axis="X", position=[0, 0, 0], radius=10, height=1) + cylinder = self.aedtapp.modeler.create_cylinder(orientation="X", origin=[0, 0, 0], radius=10, height=1) curved_face = [f for f in cylinder.faces if not f.is_planar] planar_faces = [f for f in cylinder.faces if f.is_planar] assert not self.aedtapp.assign_blower_type1(curved_face + planar_faces, planar_faces, [10, 5, 0], [0, 1, 2, 4]) diff --git a/_unittest_solvers/test_00_analyze.py b/_unittest_solvers/test_00_analyze.py index 4a04533c5f3..97e15bb40b7 100644 --- a/_unittest_solvers/test_00_analyze.py +++ b/_unittest_solvers/test_00_analyze.py @@ -125,7 +125,7 @@ def test_01a_sbr_link_array(self, sbr_platform, array): def test_01b_sbr_create_vrt(self, sbr_app): sbr_app.rename_design("vtr") - sbr_app.modeler.create_sphere([10, 10, 10], 5, matname="copper") + sbr_app.modeler.create_sphere([10, 10, 10], 5, material="copper") vrt = sbr_app.post.create_sbr_plane_visual_ray_tracing(max_frequency="10GHz", incident_theta="40deg") assert vrt vrt.incident_phi = "30deg" @@ -139,7 +139,7 @@ def test_01b_sbr_create_vrt(self, sbr_app): def test_01c_sbr_create_vrt_creeping(self, sbr_app): sbr_app.rename_design("vtr_creeping") - sbr_app.modeler.create_sphere([10, 10, 10], 5, matname="copper") + sbr_app.modeler.create_sphere([10, 10, 10], 5, material="copper") vrt = sbr_app.post.create_creeping_plane_visual_ray_tracing(max_frequency="10GHz") assert vrt vrt.incident_phi = "30deg" diff --git a/_unittest_solvers/test_31_Q3D.py b/_unittest_solvers/test_31_Q3D.py index f9a75a36b1b..b158f6969a3 100644 --- a/_unittest_solvers/test_31_Q3D.py +++ b/_unittest_solvers/test_31_Q3D.py @@ -49,9 +49,8 @@ def test_01_save(self): def test_02_create_primitive(self): udp = self.aedtapp.modeler.Position(0, 0, 0) coax_dimension = 30 - o = self.aedtapp.modeler.create_cylinder( - self.aedtapp.PLANE.XY, udp, 3, coax_dimension, 0, matname="brass", name="MyCylinder" - ) + o = self.aedtapp.modeler.create_cylinder(self.aedtapp.PLANE.XY, udp, 3, coax_dimension, 0, name="MyCylinder", + material="brass") assert isinstance(o.id, int) def test_03_get_properties(self): @@ -187,9 +186,8 @@ def test_07B_create_source_tosheet(self): def test_08_create_faceted_bondwire(self): self.aedtapp.load_project(self.test_project, close_active_proj=True, save_active_project=False) - test = self.aedtapp.modeler.create_faceted_bondwire_from_true_surface( - "bondwire_example", self.aedtapp.AXIS.Z, min_size=0.2, numberofsegments=8 - ) + test = self.aedtapp.modeler.create_faceted_bondwire_from_true_surface("bondwire_example", self.aedtapp.AXIS.Z, + min_size=0.2, number_of_segments=8) assert test def test_11_assign_net(self): diff --git a/doc/source/API/Primitives2D.rst b/doc/source/API/Primitives2D.rst index c41e3c5d1d0..da74f78de7f 100644 --- a/doc/source/API/Primitives2D.rst +++ b/doc/source/API/Primitives2D.rst @@ -46,6 +46,6 @@ modeler, including all primitives methods and properties: origin = [0,0,0] dimensions = [10,5,20] #Material and name are not mandatory fields - box_object = app.modeler.primivites.create_rectangle([15, 20, 0], [5, 5], matname="aluminum") + box_object = app.modeler.primivites.create_rectangle([15, 20, 0], [5, 5], material="aluminum") ... diff --git a/doc/source/API/Primitives3D.rst b/doc/source/API/Primitives3D.rst index 186fe639076..bfc61dd13c3 100644 --- a/doc/source/API/Primitives3D.rst +++ b/doc/source/API/Primitives3D.rst @@ -67,8 +67,8 @@ modeler, including all primitives methods and properties for HFSS, Maxwell 3D, Q # This call returns the NexximComponents class origin = [0,0,0] - dimensions = [10,5,20] + sizes = [10,5,20] #Material and name are not mandatory fields - box_object = app.modeler.primivites.create_box(origin, dimensions, name="mybox", matname="copper") + box_object = app.modeler.primivites.create_box(origin, sizes, name="mybox", material="copper") ... diff --git a/doc/source/Getting_started/Contributing.rst b/doc/source/Getting_started/Contributing.rst index c6a307fa7ce..c7392e86e40 100644 --- a/doc/source/Getting_started/Contributing.rst +++ b/doc/source/Getting_started/Contributing.rst @@ -127,7 +127,7 @@ Here is an example of an error: position = [0, 0, 0] dimensions_list = [0, 10, 10] name = None - matname = None + material = None ---------------------------------------------------------------------------------- (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024381), None) diff --git a/doc/source/User_guide/modeler.rst b/doc/source/User_guide/modeler.rst index 5a2ca96e538..e6d58daee23 100644 --- a/doc/source/User_guide/modeler.rst +++ b/doc/source/User_guide/modeler.rst @@ -9,8 +9,10 @@ The following code creates a box and changes the color to red: from pyaedt.hfss import Hfss hfss = Hfss() - box = hfss.modeler.create_box([0, 0, 0], [10, "dim", 10], - "mybox", "aluminum") + box = hfss.modeler.create_box(origin=[0, 0, 0], + sizes=[10, "dim", 10], + name="mybox", + material="aluminum") print(box.faces) box.color = "Red" diff --git a/examples/01-HFSS3DLayout/HFSS3DLayout_Via.py b/examples/01-HFSS3DLayout/HFSS3DLayout_Via.py index b80d13a75a6..483e06aa081 100644 --- a/examples/01-HFSS3DLayout/HFSS3DLayout_Via.py +++ b/examples/01-HFSS3DLayout/HFSS3DLayout_Via.py @@ -50,18 +50,23 @@ # ~~~~~~~~~~~~~~~~~~ # Add stackup layers. -h3d.modeler.layers.add_layer(layername="GND", layertype="signal", thickness="0", isnegative=True) -h3d.modeler.layers.add_layer(layername="diel", layertype="dielectric", thickness="0.2mm", material="FR4_epoxy") -h3d.modeler.layers.add_layer(layername="TOP", layertype="signal", thickness="0.035mm", elevation="0.2mm") +h3d.modeler.layers.add_layer(layer="GND", layer_type="signal", thickness="0", isnegative=True) +h3d.modeler.layers.add_layer(layer="diel", layer_type="dielectric", thickness="0.2mm", material="FR4_epoxy") +h3d.modeler.layers.add_layer(layer="TOP", layer_type="signal", thickness="0.035mm", elevation="0.2mm") + ############################################################################### # Create signal net and ground planes # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create a signal net and ground planes. -h3d.modeler.create_line(layername="TOP", center_line_list=[[0, 0], ["len", 0]], lw="w1", netname="microstrip", name="microstrip") -h3d.modeler.create_rectangle(layername="TOP", origin=[0, "-w1/2-sp"], dimensions=["len", "-w1/2-sp-20mm"]) -h3d.modeler.create_rectangle(layername="TOP", origin=[0, "w1/2+sp"], dimensions=["len", "w1/2+sp+20mm"]) +h3d.modeler.create_line(layer="TOP", + center_line_coordinates=[[0, 0], ["len", 0]], + lw="w1", + name="microstrip", + net="microstrip") +h3d.modeler.create_rectangle(layer="TOP", origin=[0, "-w1/2-sp"], sizes=["len", "-w1/2-sp-20mm"]) +h3d.modeler.create_rectangle(layer="TOP", origin=[0, "w1/2+sp"], sizes=["len", "w1/2+sp+20mm"]) ############################################################################### # Create vias diff --git a/examples/01-HFSS3DLayout/Hfss3DComponent.py b/examples/01-HFSS3DLayout/Hfss3DComponent.py index cd95384f43f..bbf1b9d9304 100644 --- a/examples/01-HFSS3DLayout/Hfss3DComponent.py +++ b/examples/01-HFSS3DLayout/Hfss3DComponent.py @@ -116,9 +116,9 @@ # The trace will connect the pin to the port on layer L1. t1 = s1.add_trace(trace_width, trace_length) -rect1 = hfss.modeler.create_rectangle(csPlane=hfss.PLANE.YZ, - position=["0.75*dielectric_length", "-5*" + t1.width.name, "0mm"], - dimension_list=["15*" + t1.width.name, "-3*" + stackup.thickness.name]) +rect1 = hfss.modeler.create_rectangle(orientation=hfss.PLANE.YZ, + origin=["0.75*dielectric_length", "-5*" + t1.width.name, "0mm"], + sizes=["15*" + t1.width.name, "-3*" + stackup.thickness.name]) p1 = hfss.wave_port(assignment=rect1, reference="G1", name="P1") ############################################################################### @@ -180,6 +180,7 @@ h3d.modeler.layers.add_layer("diel", "dielectric", thickness=diel_height, material="FR4_epoxy") h3d.modeler.layers.add_layer("G1", "signal", thickness=sig_height, isnegative=True) + ############################################################################### # Place 3d Component # ~~~~~~~~~~~~~~~~~~ @@ -197,7 +198,7 @@ h3d["len"] = str(trace_length) + "mm" h3d["w1"] = str(trace_width) + "mm" -line = h3d.modeler.create_line("L1", [[0, 0], ["len", 0]], lw="w1", netname="microstrip", name="microstrip") +line = h3d.modeler.create_line("L1", [[0, 0], ["len", 0]], lw="w1", name="microstrip", net="microstrip") h3d.create_edge_port(line, h3d.modeler[line].top_edge_x, iswave=True, wave_horizontal_extension=15, ) ############################################################################### diff --git a/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py b/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py index 455a1a284c5..da40f1b1d3c 100644 --- a/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py +++ b/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py @@ -208,9 +208,8 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create object coordinate system with origin on face -obj_cs = hfss.modeler.create_object_coordinate_system( - obj=box, origin=box.faces[0], x_axis=box.edges[0], y_axis=[0, 0, 0], name="box_obj_cs" - ) +obj_cs = hfss.modeler.create_object_coordinate_system(assignment=box, origin=box.faces[0], x_axis=box.edges[0], + y_axis=[0, 0, 0], name="box_obj_cs") obj_cs.rename("new_obj_cs") ############################################################################### @@ -218,9 +217,8 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create object coordinate system with origin on edge -obj_cs_1 = hfss.modeler.create_object_coordinate_system( - obj=box.name, origin=box.edges[0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs_1" - ) +obj_cs_1 = hfss.modeler.create_object_coordinate_system(assignment=box.name, origin=box.edges[0], x_axis=[1, 0, 0], + y_axis=[0, 1, 0], name="obj_cs_1") obj_cs_1.set_as_working_cs() ############################################################################### @@ -228,9 +226,8 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create object coordinate system with origin specified on point -obj_cs_2 = hfss.modeler.create_object_coordinate_system( - obj=box.name, origin=[0, 0.8, 0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs_2" - ) +obj_cs_2 = hfss.modeler.create_object_coordinate_system(assignment=box.name, origin=[0, 0.8, 0], x_axis=[1, 0, 0], + y_axis=[0, 1, 0], name="obj_cs_2") new_obj_cs_2 = hfss.modeler.duplicate_coordinate_system_to_global(obj_cs_2) obj_cs_2.delete() @@ -239,9 +236,8 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create object coordinate system with origin on vertex -obj_cs_3 = hfss.modeler.create_object_coordinate_system( - obj=box.name, origin=box.vertices[1], x_axis=box.faces[2], y_axis=box.faces[4], name="obj_cs_3" - ) +obj_cs_3 = hfss.modeler.create_object_coordinate_system(assignment=box.name, origin=box.vertices[1], + x_axis=box.faces[2], y_axis=box.faces[4], name="obj_cs_3") obj_cs_3.props["MoveToEnd"] = False obj_cs_3.update() diff --git a/examples/01-Modeling-Setup/Polyline_Primitives.py b/examples/01-Modeling-Setup/Polyline_Primitives.py index 3e8ae99013a..3d91003ffd6 100644 --- a/examples/01-Modeling-Setup/Polyline_Primitives.py +++ b/examples/01-Modeling-Setup/Polyline_Primitives.py @@ -66,7 +66,7 @@ # segments. The supported segment types are ``Line``, ``Arc`` (3 points), # ``AngularArc`` (center-point + angle), and ``Spline``. -P = prim3D.create_polyline(position_list=test_points[0:2], name="PL01_line") +P = prim3D.create_polyline(points=test_points[0:2], name="PL01_line") print("Created Polyline with name: {}".format(prim3D.objects[P.id].name)) print("Segment types : {}".format([s.type for s in P.segment_types])) @@ -78,7 +78,7 @@ # Create an arc primitive. The parameter ``position_list`` must contain at # least three position values. The first three position values are used. -P = prim3D.create_polyline(position_list=test_points[0:3], segment_type="Arc", name="PL02_arc") +P = prim3D.create_polyline(points=test_points[0:3], segment_type="Arc", name="PL02_arc") print("Created object with id {} and name {}.".format(P.id, prim3D.objects[P.id].name)) @@ -90,9 +90,8 @@ # as the number of points (in this case 4). The parameter ``position_list`` # must contain at least four position values. -P = prim3D.create_polyline( - position_list=test_points, segment_type=prim3D.polyline_segment("Spline", num_points=4), name="PL03_spline_4pt" -) +P = prim3D.create_polyline(points=test_points, segment_type=prim3D.polyline_segment("Spline", num_points=4), + name="PL03_spline_4pt") ############################################################################### # Create center-point arc primitive @@ -108,11 +107,9 @@ start_point = [100, 100, 0] center_point = [0, 0, 0] -P = prim3D.create_polyline( - position_list=[start_point], - segment_type=prim3D.polyline_segment("AngularArc", arc_center=center_point, arc_angle="30deg"), - name="PL04_center_point_arc", -) +P = prim3D.create_polyline(points=[start_point], + segment_type=prim3D.polyline_segment("AngularArc", arc_center=center_point, + arc_angle="30deg"), name="PL04_center_point_arc") ############################################################################### # Here ``start_point`` and ``center_point`` have the same values for the Y and @@ -122,16 +119,14 @@ start_point = [100, 0, 0] center_point = [0, 0, 0] -P = prim3D.create_polyline( - position_list=[start_point], - segment_type=prim3D.polyline_segment("AngularArc", arc_center=center_point, arc_angle="30deg", arc_plane="XY"), - name="PL04_center_point_arc_rot_XY", -) -P = prim3D.create_polyline( - position_list=[start_point], - segment_type=prim3D.polyline_segment("AngularArc", arc_center=center_point, arc_angle="30deg", arc_plane="ZX"), - name="PL04_center_point_arc_rot_ZX", -) +P = prim3D.create_polyline(points=[start_point], + segment_type=prim3D.polyline_segment("AngularArc", arc_center=center_point, + arc_angle="30deg", arc_plane="XY"), + name="PL04_center_point_arc_rot_XY") +P = prim3D.create_polyline(points=[start_point], + segment_type=prim3D.polyline_segment("AngularArc", arc_center=center_point, + arc_angle="30deg", arc_plane="ZX"), + name="PL04_center_point_arc_rot_ZX") ############################################################################### # Compound polylines @@ -142,28 +137,28 @@ # By default, if no specification of the type of segments is given, all points # are connected by line segments. -P = prim3D.create_polyline(position_list=test_points, name="PL06_segmented_compound_line") +P = prim3D.create_polyline(points=test_points, name="PL06_segmented_compound_line") ############################################################################### # You can specify the segment type with the parameter ``segment_type``. # In this case, you must specify that the four input points in ``position_list`` # are to be connected as a line segment followed by a 3-point arc segment. -P = prim3D.create_polyline(position_list=test_points, segment_type=["Line", "Arc"], name="PL05_compound_line_arc") +P = prim3D.create_polyline(points=test_points, segment_type=["Line", "Arc"], name="PL05_compound_line_arc") ############################################################################### # The parameter ``close_surface`` ensures that the polyline starting point and # ending point are the same. If necessary, you can add an additional line # segment to achieve this. -P = prim3D.create_polyline(position_list=test_points, close_surface=True, name="PL07_segmented_compound_line_closed") +P = prim3D.create_polyline(points=test_points, close_surface=True, name="PL07_segmented_compound_line_closed") ############################################################################### # The parameter ``cover_surface=True`` also performs the modeler command # ``cover_surface``. Note that specifying ``cover_surface=True`` automatically # results in the polyline being closed. -P = prim3D.create_polyline(position_list=test_points, cover_surface=True, name="SPL01_segmented_compound_line") +P = prim3D.create_polyline(points=test_points, cover_surface=True, name="SPL01_segmented_compound_line") ############################################################################### # Compound lines @@ -178,12 +173,12 @@ # original polyline object, it is determined automatically that the segment is # inserted after the first segment of the original polyline. -P = prim3D.create_polyline(position_list=test_points, close_surface=True, name="PL08_segmented_compound_insert_segment") +P = prim3D.create_polyline(points=test_points, close_surface=True, name="PL08_segmented_compound_insert_segment") p2 = P.points[1] insert_point = ["-100mm", "20mm", "0mm"] -P.insert_segment(position_list=[insert_point, p2]) +P.insert_segment(points=[insert_point, p2]) ############################################################################### # Insert compound line with insert curve @@ -193,13 +188,13 @@ # By numerical comparison of the starting point, it is determined automatically # that the segment is inserted after the first segment of the original polyline. -P = prim3D.create_polyline(position_list=test_points, close_surface=False, name="PL08_segmented_compound_insert_arc") +P = prim3D.create_polyline(points=test_points, close_surface=False, name="PL08_segmented_compound_insert_arc") start_point = P.vertex_positions[1] insert_point1 = ["90mm", "20mm", "0mm"] insert_point2 = [40, 40, 0] -P.insert_segment(position_list=[start_point, insert_point1, insert_point2], segment="Arc") +P.insert_segment(points=[start_point, insert_point1, insert_point2], segment="Arc") ############################################################################### # Insert compound line at end of a center-point arc @@ -213,11 +208,9 @@ arc_center_1 = [1400, 0, 800] arc_angle_1 = "43.47deg" -P = prim3D.create_polyline( - name="First_Arc", - position_list=[start_point], - segment_type=prim3D.polyline_segment(type="AngularArc", arc_angle=arc_angle_1, arc_center=arc_center_1), -) +P = prim3D.create_polyline(points=[start_point], + segment_type=prim3D.polyline_segment(type="AngularArc", arc_angle=arc_angle_1, + arc_center=arc_center_1), name="First_Arc") ############################################################################### # Step 2: Insert a line segment at the end of the arc with a specified end point. @@ -225,7 +218,7 @@ start_of_line_segment = P.end_point end_of_line_segment = [3600, 200, 30] -P.insert_segment(position_list=[start_of_line_segment, end_of_line_segment]) +P.insert_segment(points=[start_of_line_segment, end_of_line_segment]) ############################################################################### # Step 3: Append a center-point arc segment to the line object. @@ -233,24 +226,18 @@ arc_angle_2 = "39.716deg" arc_center_2 = [3400, 200, 3800] -P.insert_segment( - position_list=[end_of_line_segment], - segment=prim3D.polyline_segment(type="AngularArc", arc_center=arc_center_2, arc_angle=arc_angle_2), -) +P.insert_segment(points=[end_of_line_segment], + segment=prim3D.polyline_segment(type="AngularArc", arc_center=arc_center_2, arc_angle=arc_angle_2)) ############################################################################### # You can use the compound polyline definition to complete all three steps in # a single step. -prim3D.create_polyline( - position_list=[start_point, end_of_line_segment], - segment_type=[ - prim3D.polyline_segment(type="AngularArc", arc_angle="43.47deg", arc_center=arc_center_1), - prim3D.polyline_segment(type="Line"), - prim3D.polyline_segment(type="AngularArc", arc_angle=arc_angle_2, arc_center=arc_center_2), - ], - name="Compound_Polyline_One_Command", -) +prim3D.create_polyline(points=[start_point, end_of_line_segment], segment_type=[ + prim3D.polyline_segment(type="AngularArc", arc_angle="43.47deg", arc_center=arc_center_1), + prim3D.polyline_segment(type="Line"), + prim3D.polyline_segment(type="AngularArc", arc_angle=arc_angle_2, arc_center=arc_center_2), +], name="Compound_Polyline_One_Command") ######################################################################### # Insert two 3-point arcs forming a circle and covered @@ -260,13 +247,8 @@ # the position list. P = prim3D.create_polyline( - position_list=[[34.1004, 14.1248, 0], [27.646, 16.7984, 0], [24.9725, 10.3439, 0], [31.4269, 7.6704, 0]], - segment_type=["Arc", "Arc"], - cover_surface=True, - close_surface=True, - name="Rotor_Subtract_25_0", - matname="vacuum", -) + points=[[34.1004, 14.1248, 0], [27.646, 16.7984, 0], [24.9725, 10.3439, 0], [31.4269, 7.6704, 0]], + segment_type=["Arc", "Arc"], cover_surface=True, close_surface=True, name="Rotor_Subtract_25_0", material="vacuum") ############################################################################### # Here is an example of a complex polyline where the number of points is diff --git a/examples/02-HFSS/Create_3d_Component_and_use_it.py b/examples/02-HFSS/Create_3d_Component_and_use_it.py index f7bc5cf8398..44e22750f4e 100644 --- a/examples/02-HFSS/Create_3d_Component_and_use_it.py +++ b/examples/02-HFSS/Create_3d_Component_and_use_it.py @@ -47,13 +47,16 @@ # Objects can be created, deleted and modified using all available boolean operations. # History is also fully accessible to PyAEDT. -substrate = hfss.modeler.create_box(["-width","-width","-thick"],["2*width","2*width", "thick"], matname="FR4_epoxy", name="sub") +substrate = hfss.modeler.create_box(["-width", "-width", "-thick"], ["2*width", "2*width", "thick"], name="sub", + material="FR4_epoxy") patch = hfss.modeler.create_rectangle("XY",["-width/2","-width/2","0mm"],["width","width"], name="patch1") -via1 = hfss.modeler.create_cylinder(2, ["-width/8","-width/4","-thick"],"0.01mm", "thick", matname="copper", name="via_inner") +via1 = hfss.modeler.create_cylinder(2, ["-width/8", "-width/4", "-thick"], "0.01mm", "thick", name="via_inner", + material="copper") -via_outer = hfss.modeler.create_cylinder(2, ["-width/8","-width/4","-thick"],"0.025mm", "thick", matname="Teflon_based", name="via_teflon") +via_outer = hfss.modeler.create_cylinder(2, ["-width/8", "-width/4", "-thick"], "0.025mm", "thick", name="via_teflon", + material="Teflon_based") ########################################################## # Boundaries @@ -126,7 +129,7 @@ hfss2.modeler.create_coordinate_system(origin=[20, 20, 10], name="Second_antenna") -ant2 = hfss2.modeler.insert_3d_component(component_path, targetCS="Second_antenna") +ant2 = hfss2.modeler.insert_3d_component(component_path, coordinate_system="Second_antenna") ########################################################## # Move components diff --git a/examples/02-HFSS/Flex_CPWG.py b/examples/02-HFSS/Flex_CPWG.py index 957b9f00358..90b5e26d3a8 100644 --- a/examples/02-HFSS/Flex_CPWG.py +++ b/examples/02-HFSS/Flex_CPWG.py @@ -88,13 +88,8 @@ def create_bending(radius, extension=0): # Draw a signal line to create a bent signal wire. position_list = create_bending(r, 1) -line = hfss.modeler.create_polyline( - position_list=position_list, - xsection_type="Rectangle", - xsection_width=height, - xsection_height=width, - matname="copper", -) +line = hfss.modeler.create_polyline(points=position_list, material="copper", xsection_type="Rectangle", + xsection_width=height, xsection_height=width) ############################################################################### # Draw ground line @@ -106,9 +101,8 @@ def create_bending(radius, extension=0): gnd_objs = [] for gnd in [gnd_r, gnd_l]: - x = hfss.modeler.create_polyline( - position_list=gnd, xsection_type="Rectangle", xsection_width=height, xsection_height=gnd_width, matname="copper" - ) + x = hfss.modeler.create_polyline(points=gnd, material="copper", xsection_type="Rectangle", xsection_width=height, + xsection_height=gnd_width) x.color = (255, 0, 0) gnd_objs.append(x) @@ -119,13 +113,8 @@ def create_bending(radius, extension=0): position_list = create_bending(r + (height + gnd_thickness) / 2) -fr4 = hfss.modeler.create_polyline( - position_list=position_list, - xsection_type="Rectangle", - xsection_width=gnd_thickness, - xsection_height=width + 2 * spacing + 2 * gnd_width, - matname="FR4_epoxy", -) +fr4 = hfss.modeler.create_polyline(points=position_list, material="FR4_epoxy", xsection_type="Rectangle", + xsection_width=gnd_thickness, xsection_height=width + 2 * spacing + 2 * gnd_width) ############################################################################### # Create bottom metals @@ -134,13 +123,8 @@ def create_bending(radius, extension=0): position_list = create_bending(r + height + gnd_thickness, 1) -bot = hfss.modeler.create_polyline( - position_list=position_list, - xsection_type="Rectangle", - xsection_width=height, - xsection_height=width + 2 * spacing + 2 * gnd_width, - matname="copper", -) +bot = hfss.modeler.create_polyline(points=position_list, material="copper", xsection_type="Rectangle", + xsection_width=height, xsection_height=width + 2 * spacing + 2 * gnd_width) ############################################################################### # Create port interfaces @@ -153,7 +137,7 @@ def create_bending(radius, extension=0): positions = [i.position for i in face.vertices] port_sheet_list = [((x - xc) * 10 + xc, (y - yc) + yc, (z - zc) * 10 + zc) for x, y, z in positions] - s = hfss.modeler.create_polyline(port_sheet_list, close_surface=True, cover_surface=True) + s = hfss.modeler.create_polyline(port_sheet_list, cover_surface=True, close_surface=True) center = [round(i, 6) for i in s.faces[0].center] port_block = hfss.modeler.thicken_sheet(s.name, -5) diff --git a/examples/02-HFSS/HFSS_Choke.py b/examples/02-HFSS/HFSS_Choke.py index a4fe164556b..c2c633a474b 100644 --- a/examples/02-HFSS/HFSS_Choke.py +++ b/examples/02-HFSS/HFSS_Choke.py @@ -147,7 +147,7 @@ ground_radius = 1.2 * dictionary_values[1]["Outer Winding"]["Outer Radius"] ground_position = [0, 0, first_winding_list[1][0][2] - 2] -ground = hfss.modeler.create_circle("XY", ground_position, ground_radius, name="GND", matname="copper") +ground = hfss.modeler.create_circle("XY", ground_position, ground_radius, name="GND", material="copper") coat = hfss.assign_coating(ground, is_infinite_ground=True) ############################################################################### @@ -175,9 +175,8 @@ cylinder_height = 2.5 * dictionary_values[1]["Outer Winding"]["Height"] cylinder_position = [0, 0, first_winding_list[1][0][2] - 4] -mesh_operation_cylinder = hfss.modeler.create_cylinder( - "XY", cylinder_position, ground_radius, cylinder_height, numSides=36, name="mesh_cylinder" -) +mesh_operation_cylinder = hfss.modeler.create_cylinder("XY", cylinder_position, ground_radius, cylinder_height, + num_sides=36, name="mesh_cylinder") hfss.mesh.assign_length_mesh([mesh_operation_cylinder], maximum_length=15, maximum_elements=None, name="choke_mesh") diff --git a/examples/02-HFSS/HFSS_Spiral.py b/examples/02-HFSS/HFSS_Spiral.py index a9a3a0e863b..38bbb17b3be 100644 --- a/examples/02-HFSS/HFSS_Spiral.py +++ b/examples/02-HFSS/HFSS_Spiral.py @@ -64,7 +64,8 @@ # the width, thickness, and material. def create_line(pts): - p.create_polyline(pts, xsection_type="Rectangle", xsection_width=width, xsection_height=thickness, matname="copper") + p.create_polyline(pts, material="copper", xsection_type="Rectangle", xsection_width=width, + xsection_height=thickness) ################################################################ @@ -92,18 +93,16 @@ def create_line(pts): x0, y0, z0 = ind.points[0] x1, y1, z1 = ind.points[-1] create_line([(x0 - width / 2, y0, -gap), (abs(x1) + 5, y0, -gap)]) -p.create_box([x0 - width / 2, y0 - width / 2, -gap - thickness / 2], - [width, width, gap + thickness], - matname="copper") +p.create_box([x0 - width / 2, y0 - width / 2, -gap - thickness / 2], [width, width, gap + thickness], material="copper") ################################################################ # Create port 1 # ~~~~~~~~~~~~~ # Create port 1. -p.create_rectangle(csPlane=pyaedt.constants.PLANE.YZ, - position=[abs(x1) + 5, y0 - width / 2, -gap - thickness / 2], - dimension_list=[width, "Tsub+{}{}".format(gap, hfss.modeler.model_units)], +p.create_rectangle(orientation=pyaedt.constants.PLANE.YZ, + origin=[abs(x1) + 5, y0 - width / 2, -gap - thickness / 2], + sizes=[width, "-Tsub+{}{}".format(gap, hfss.modeler.model_units)], name="port1" ) hfss.lumped_port(assignment="port1", integration_line=pyaedt.constants.AXIS.Z) @@ -125,12 +124,10 @@ def create_line(pts): # Create the silicon substrate and the ground plane. p.create_box([x1 - 20, x1 - 20, "-Tsub-{}{}/2".format(thickness, hfss.modeler.model_units)], - [-2 * x1 + 40, -2 * x1 + 40, "Tsub"], - matname="silicon") + [-2 * x1 + 40, -2 * x1 + 40, "Tsub"], material="silicon") p.create_box([x1 - 20, x1 - 20, "-Tsub-{}{}/2".format(thickness, hfss.modeler.model_units)], - [-2 * x1 + 40, -2 * x1 + 40, -0.1], - matname="PEC") + [-2 * x1 + 40, -2 * x1 + 40, -0.1], material="PEC") ################################################################ # Assign airbox and radiation @@ -139,10 +136,7 @@ def create_line(pts): box = p.create_box( [x1 - 20, x1 - 20, "-Tsub-{}{}/2 - 0.1{}".format(thickness, hfss.modeler.model_units, hfss.modeler.model_units)], - [-2 * x1 + 40, -2 * x1 + 40, 100], - name="airbox", - matname="air" -) + [-2 * x1 + 40, -2 * x1 + 40, 100], name="airbox", material="air") hfss.assign_radiation_boundary_to_objects("airbox") diff --git a/examples/02-HFSS/Waveguide_Filter.py b/examples/02-HFSS/Waveguide_Filter.py index ce05d14a8d3..1ab4995d3b4 100644 --- a/examples/02-HFSS/Waveguide_Filter.py +++ b/examples/02-HFSS/Waveguide_Filter.py @@ -65,8 +65,9 @@ specified_version=aedt_version, designname="filter", non_graphical=non_graphical, - new_desktop_session=True) -hfss.solution_type = "Modal" + new_desktop_session=True, + close_on_exit=True, + solution_type="Modal") # hfss.settings.enable_debug_methods_argument_logger = False # Only for debugging. @@ -110,8 +111,10 @@ def place_iris(zpos, dz, n): iris = [] # Return a list of the two objects that make up the iris. if this_name in hfss.modeler.object_names: this_name = this_name.replace("a", "c") - iris.append(hfss.modeler.create_box(['-b/2', '-a/2', zpos], ['(b - ' + w_str + ')/2', 'a', dz], - name=this_name, matname="silver")) + iris.append(hfss.modeler.create_box(origin=['-b/2', '-a/2', zpos], + sizes=['(b - ' + w_str + ')/2', 'a', dz], + name=this_name, + material="silver")) iris.append(iris[0].mirror([0, 0, 0], [1, 0, 0], duplicate=True)) return iris @@ -150,8 +153,10 @@ def place_iris(zpos, dz, n): wg_length = hfss.variable_manager["wg_length"] hfss["u_start"] = "-a/2" hfss["u_end"] = "a/2" -hfss.modeler.create_box(["-b/2", "-a/2", "wg_z_start"], ["b", "a", "wg_length"], - name="waveguide", matname="vacuum") +hfss.modeler.create_box(origin=["-b/2", "-a/2", "wg_z_start"], + sizes=["b", "a", "wg_length"], + name="waveguide", + material="vacuum") ############################################################################### # Draw the whole waveguide. @@ -171,7 +176,7 @@ def place_iris(zpos, dz, n): count = 0 ports = [] for n, z in enumerate(wg_z): - face_id = hfss.modeler.get_faceid_from_position([0, 0, z], obj_name="waveguide") + face_id = hfss.modeler.get_faceid_from_position(position=[0, 0, z], assignment="waveguide") u_start = [0, hfss.variable_manager["u_start"].evaluated_value, z] u_end = [0, hfss.variable_manager["u_end"].evaluated_value, z] diff --git a/examples/02-SBR+/SBR_Doppler_Example.py b/examples/02-SBR+/SBR_Doppler_Example.py index f8f31307afc..6bb80e2f1a1 100644 --- a/examples/02-SBR+/SBR_Doppler_Example.py +++ b/examples/02-SBR+/SBR_Doppler_Example.py @@ -82,7 +82,7 @@ # ~~~~~~~~~~~~~~~~~~ # Define the background environment. -road1 = app.modeler.add_environment(env_folder=env_folder, environment_name="Bari") +road1 = app.modeler.add_environment(input_dir=env_folder, name="Bari") prim = app.modeler ############################################################################### @@ -91,28 +91,15 @@ # Place actors in the environment. This code places persons, birds, bikes, and cars # in the environment. -person1 = app.modeler.add_person( - actor_folder=person_folder, speed=1.0, global_offset=[25, 1.5, 0], yaw=180, actor_name="Massimo" -) -person2 = app.modeler.add_person( - actor_folder=person_folder, speed=1.0, global_offset=[25, 2.5, 0], yaw=180, actor_name="Devin" -) -car1 = app.modeler.add_vehicle(actor_folder=car_folder, speed=8.7, global_offset=[3, -2.5, 0], actor_name="LuxuryCar") -bike1 = app.modeler.add_vehicle( - actor_folder=bike_folder, speed=2.1, global_offset=[24, 3.6, 0], yaw=180, actor_name="Alberto_in_bike" -) -bird1 = app.modeler.add_bird( - actor_folder=bird_folder, - speed=1.0, - global_offset=[19, 4, 3], - yaw=120, - pitch=-5, - flapping_rate=30, - actor_name="Pigeon", -) -bird2 = app.modeler.add_bird( - actor_folder=bird_folder, speed=1.0, global_offset=[6, 2, 3], yaw=-60, pitch=10, actor_name="Eagle" -) +person1 = app.modeler.add_person(input_dir=person_folder, speed=1.0, global_offset=[25, 1.5, 0], yaw=180, + name="Massimo") +person2 = app.modeler.add_person(input_dir=person_folder, speed=1.0, global_offset=[25, 2.5, 0], yaw=180, name="Devin") +car1 = app.modeler.add_vehicle(input_dir=car_folder, speed=8.7, global_offset=[3, -2.5, 0], name="LuxuryCar") +bike1 = app.modeler.add_vehicle(input_dir=bike_folder, speed=2.1, global_offset=[24, 3.6, 0], yaw=180, + name="Alberto_in_bike") +bird1 = app.modeler.add_bird(input_dir=bird_folder, speed=1.0, global_offset=[19, 4, 3], yaw=120, pitch=-5, + flapping_rate=30, name="Pigeon") +bird2 = app.modeler.add_bird(input_dir=bird_folder, speed=1.0, global_offset=[6, 2, 3], yaw=-60, pitch=10, name="Eagle") ############################################################################### # Place radar diff --git a/examples/03-Maxwell/Maxwell2D_Electrostatic.py b/examples/03-Maxwell/Maxwell2D_Electrostatic.py index 57498b5c3f8..6eb50df7baf 100644 --- a/examples/03-Maxwell/Maxwell2D_Electrostatic.py +++ b/examples/03-Maxwell/Maxwell2D_Electrostatic.py @@ -106,8 +106,8 @@ # Create rectangle and a circle and assign the material read from the .xlsx file. # Create two new polylines and a region. -rect = mod2D.create_rectangle(position=['r_x0', 'r_y0', 'r_z0'], - dimension_list=['r_dx', 'r_dy', 0], +rect = mod2D.create_rectangle(origin=['r_x0', 'r_y0', 'r_z0'], + sizes=['r_dx', 'r_dy', 0], name='Ground', matname=mats[0]) rect.color = (0, 0, 255) # rgb rect.solve_inside = False @@ -119,8 +119,8 @@ poly1_points = [[-9, 2, 0], [-4, 2, 0], [2, -2, 0],[8, 2, 0]] poly2_points = [[-9, 0, 0], [9, 0, 0]] -poly1_id = mod2D.create_polyline(position_list=poly1_points,segment_type='Spline', name='Poly1') -poly2_id = mod2D.create_polyline(position_list=poly2_points, name='Poly2') +poly1_id = mod2D.create_polyline(points=poly1_points, segment_type='Spline', name='Poly1') +poly2_id = mod2D.create_polyline(points=poly2_points, name='Poly2') mod2D.split([poly1_id, poly2_id], 'YZ', sides='NegativeOnly') mod2D.create_region([20, 100, 20, 100]) diff --git a/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py b/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py index 3437fab9a6c..dfb741a4776 100644 --- a/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py +++ b/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py @@ -236,8 +236,7 @@ ["DuctPitch", "0mm"], ["SegAngle", "0deg"], ["LenRegion", "Model_Length"], ["InfoCore", "0"]] -stator_id = mod2D.create_udp(udp_dll_name="RMxprt/VentSlotCore.dll", - udp_parameters_list=udp_par_list_stator, upd_library='syslib', +stator_id = mod2D.create_udp(dll="RMxprt/VentSlotCore.dll", parameters=udp_par_list_stator, library='syslib', name='my_stator') # name not taken ########################################################## @@ -323,11 +322,11 @@ def create_cs_magnets(pm_id, cs_name, point_direction): [55.05576774, 1.098662669, 0]] OM1_points = [[54.37758185, 22.52393189, 0], [59.69688156, 9.68200639, 0], [63.26490432, 11.15992981, 0], [57.94560461, 24.00185531, 0]] -IPM1_id = mod2D.create_polyline(position_list=IM1_points, cover_surface=True, name="PM_I1", - matname="Arnold_Magnetics_N30UH_80C_new") +IPM1_id = mod2D.create_polyline(points=IM1_points, cover_surface=True, name="PM_I1", + material="Arnold_Magnetics_N30UH_80C_new") IPM1_id.color = (0, 128, 64) -OPM1_id = mod2D.create_polyline(position_list=OM1_points, cover_surface=True, name="PM_O1", - matname="Arnold_Magnetics_N30UH_80C_new") +OPM1_id = mod2D.create_polyline(points=OM1_points, cover_surface=True, name="PM_O1", + material="Arnold_Magnetics_N30UH_80C_new") OPM1_id.color = (0, 128, 64) ##################################################################################### @@ -343,7 +342,7 @@ def create_cs_magnets(pm_id, cs_name, point_direction): # ~~~~~~~~~~~~~~~~~~~~~~~~ # Duplicate and mirror the PMs along with the local coordinate system. -mod2D.duplicate_and_mirror([IPM1_id, OPM1_id], position=[0, 0, 0], +mod2D.duplicate_and_mirror([IPM1_id, OPM1_id], origin=[0, 0, 0], vector=["cos((360deg/SymmetryFactor/2)+90deg)", "sin((360deg/SymmetryFactor/2)+90deg)", 0]) id_PMs = mod2D.get_objects_w_string("PM", case_sensitive=True) @@ -352,12 +351,12 @@ def create_cs_magnets(pm_id, cs_name, point_direction): # ~~~~~~~~~~~~ # Create the coils. -coil_id = mod2D.create_rectangle(position=['DiaRotorLam/2+Airgap+Coil_SetBack', '-Coil_Edge_Short/2', 0], - dimension_list=['Coil_Edge_Long', 'Coil_Edge_Short', 0], - name='Coil', matname="Copper (Annealed)_65C") +coil_id = mod2D.create_rectangle(origin=['DiaRotorLam/2+Airgap+Coil_SetBack', '-Coil_Edge_Short/2', 0], + sizes=['Coil_Edge_Long', 'Coil_Edge_Short', 0], + name='Coil', material="Copper (Annealed)_65C") coil_id.color = (255, 128, 0) -M2D.modeler.rotate(objid=coil_id, cs_axis="Z", angle="360deg/SlotNumber/2") -coil_id.duplicate_around_axis(cs_axis="Z", angle="360deg/SlotNumber", nclones='CoilPitch+1', +M2D.modeler.rotate(assignment=coil_id, axis="Z", angle="360deg/SlotNumber/2") +coil_id.duplicate_around_axis(axis="Z", angle="360deg/SlotNumber", nclones='CoilPitch+1', create_new_objects=True) id_coils = mod2D.get_objects_w_string("Coil", case_sensitive=True) @@ -407,27 +406,25 @@ def create_cs_magnets(pm_id, cs_name, point_direction): # Allocated PMs are created. rotor_id = mod2D.create_circle(position=[0, 0, 0], radius='DiaRotorLam/2', - num_sides=0, name="Rotor", matname="30DH_20C_smooth") + num_sides=0, name="Rotor", material="30DH_20C_smooth") rotor_id.color = (0, 128, 255) mod2D.subtract(rotor_id, shaft_id, keep_originals=True) void_small_1_id = mod2D.create_circle(position=[62, 0, 0], radius="2.55mm", - num_sides=0, name="void1", matname="vacuum") -M2D.modeler.duplicate_around_axis(void_small_1_id, cs_axis="Z", angle="360deg/SymmetryFactor", - nclones=2, create_new_objects=False) + num_sides=0, name="void1", material="vacuum") +M2D.modeler.duplicate_around_axis(void_small_1_id, axis="Z", angle="360deg/SymmetryFactor", + clones=2, create_new_objects=False) void_big_1_id = mod2D.create_circle(position=[29.5643, 12.234389332712, 0], radius='9.88mm/2', - num_sides=0, name="void_big", matname="vacuum") + num_sides=0, name="void_big", material="vacuum") mod2D.subtract(rotor_id, [void_small_1_id, void_big_1_id], keep_originals=False) slot_IM1_points = [[37.5302872, 15.54555396, 0], [55.05576774, 1.098662669, 0], [57.33637589, 1.25, 0], [57.28982158, 2.626565019, 0], [40.25081875, 16.67243502, 0]] slot_OM1_points = [[54.37758185, 22.52393189, 0], [59.69688156, 9.68200639, 0], [63.53825619, 10.5, 0], [57.94560461, 24.00185531, 0]] -slot_IM_id = mod2D.create_polyline(position_list=slot_IM1_points, cover_surface=True, name="slot_IM1", - matname="vacuum") -slot_OM_id = mod2D.create_polyline(position_list=slot_OM1_points, cover_surface=True, name="slot_OM1", - matname="vacuum") +slot_IM_id = mod2D.create_polyline(points=slot_IM1_points, cover_surface=True, name="slot_IM1", material="vacuum") +slot_OM_id = mod2D.create_polyline(points=slot_OM1_points, cover_surface=True, name="slot_OM1", material="vacuum") -M2D.modeler.duplicate_and_mirror(objid=[slot_IM_id, slot_OM_id], position=[0, 0, 0], +M2D.modeler.duplicate_and_mirror(assignment=[slot_IM_id, slot_OM_id], origin=[0, 0, 0], vector=["cos((360deg/SymmetryFactor/2)+90deg)", "sin((360deg/SymmetryFactor/2)+90deg)", 0]) @@ -461,10 +458,9 @@ def create_cs_magnets(pm_id, cs_name, point_direction): # The points for edge picking are in the airgap. pos_1 = "((DiaGap - (1.0 * Airgap))/4)" -id_bc_1 = mod2D.get_edgeid_from_position(position=[pos_1, 0, 0], obj_name='Region') +id_bc_1 = mod2D.get_edgeid_from_position(position=[pos_1, 0, 0], assignment='Region') id_bc_2 = mod2D.get_edgeid_from_position( - position=[pos_1 + "*cos((360deg/SymmetryFactor))", pos_1 + "*sin((360deg/SymmetryFactor))", 0], - obj_name='Region') + position=[pos_1 + "*cos((360deg/SymmetryFactor))", pos_1 + "*sin((360deg/SymmetryFactor))", 0], assignment='Region') M2D.assign_master_slave(independent=id_bc_1, dependent=id_bc_2, reverse_master=False, reverse_slave=True, same_as_master=False, boundary="Matching") @@ -476,7 +472,7 @@ def create_cs_magnets(pm_id, cs_name, point_direction): pos_2 = "(DiaOuter/2)" id_bc_az = mod2D.get_edgeid_from_position( position=[pos_2 + "*cos((360deg/SymmetryFactor/2))", pos_2 + "*sin((360deg/SymmetryFactor)/2)", 0], - obj_name='Region') + assignment='Region') M2D.assign_vector_potential(id_bc_az, vector_value=0, boundary="VectorPotentialZero") ########################################################## diff --git a/examples/03-Maxwell/Maxwell2D_Transient.py b/examples/03-Maxwell/Maxwell2D_Transient.py index 2c84ff1995d..7992c81c4c7 100644 --- a/examples/03-Maxwell/Maxwell2D_Transient.py +++ b/examples/03-Maxwell/Maxwell2D_Transient.py @@ -62,7 +62,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create a rectangle and duplicate it. -rect1 = maxwell_2d.modeler.create_rectangle([0, 0, 0], [10, 20], name="winding", matname="copper") +rect1 = maxwell_2d.modeler.create_rectangle([0, 0, 0], [10, 20], name="winding", material="copper") added = rect1.duplicate_along_line([14, 0, 0]) rect2 = maxwell_2d.modeler[added[0]] diff --git a/examples/03-Maxwell/Maxwell3DTeam7.py b/examples/03-Maxwell/Maxwell3DTeam7.py index 995eb40d259..af6cdbc1aa6 100644 --- a/examples/03-Maxwell/Maxwell3DTeam7.py +++ b/examples/03-Maxwell/Maxwell3DTeam7.py @@ -116,7 +116,7 @@ # ~~~~~~~~~~~~~~~ # Create a polyline. One quarter of the coil is modeled by sweeping a 2D sheet along a polyline. -test = m3d.modeler.create_polyline(position_list=[P1, P2, P3, P4], segment_type=["Line", "Arc"], name="Coil") +test = m3d.modeler.create_polyline(points=[P1, P2, P3, P4], segment_type=["Line", "Arc"], name="Coil") test.set_crosssection_properties(type="Rectangle", width=coil_thk, height=coil_height) ########################################################################################### @@ -125,7 +125,7 @@ # Duplicate and unit the polyline to create a full coil. m3d.modeler.duplicate_around_axis( - "Coil", cs_axis="Global", angle=90, nclones=4, create_new_objects=True, is_3d_comp=False + "Coil", axis="Global", angle=90, clones=4, create_new_objects=True, is_3d_comp=False ) m3d.modeler.unite("Coil, Coil_1, Coil_2") m3d.modeler.unite("Coil, Coil_3") @@ -171,10 +171,9 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Model the aluminium plate with a hole by subtracting two rectangular cuboids. -plate = m3d.modeler.create_box(position=[0, 0, 0], dimensions_list=[294, 294, 19], name="Plate", - matname="team7_aluminium") +plate = m3d.modeler.create_box(origin=[0, 0, 0], sizes=[294, 294, 19], name="Plate", material="team7_aluminium") m3d.modeler.fit_all() -m3d.modeler.create_box(position=[18, 18, 0], dimensions_list=[108, 108, 19], name="Hole") +m3d.modeler.create_box(origin=[18, 18, 0], sizes=[108, 108, 19], name="Hole") m3d.modeler.subtract(blank_list="Plate", tool_list=["Hole"], keep_originals=False) ########################################################################################### @@ -221,13 +220,13 @@ mesh_diameter = "2mm" line_points_1 = [["0mm", "72mm", "34mm"], ["288mm", "72mm", "34mm"]] -polyline = m3d.modeler.create_polyline(position_list=line_points_1, name=lines[0]) -l1_mesh = m3d.modeler.create_polyline(position_list=line_points_1, name=lines[0] + "mesh") +polyline = m3d.modeler.create_polyline(points=line_points_1, name=lines[0]) +l1_mesh = m3d.modeler.create_polyline(points=line_points_1, name=lines[0] + "mesh") l1_mesh.set_crosssection_properties(type="Circle", width=mesh_diameter) line_points_2 = [["0mm", "144mm", "34mm"], ["288mm", "144mm", "34mm"]] -polyline2 = m3d.modeler.create_polyline(position_list=line_points_2, name=lines[1]) -l2_mesh = m3d.modeler.create_polyline(position_list=line_points_2, name=lines[1] + "mesh") +polyline2 = m3d.modeler.create_polyline(points=line_points_2, name=lines[1]) +l2_mesh = m3d.modeler.create_polyline(points=line_points_2, name=lines[1] + "mesh") l2_mesh.set_crosssection_properties(type="Circle", width=mesh_diameter) ############################################################################### diff --git a/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py b/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py index 64b43f2650f..e3f45e84ec6 100644 --- a/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py +++ b/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py @@ -86,10 +86,9 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Draw a ladder plate and assign it the newly created material ``team3_aluminium``. -m3d.modeler.create_box(position=[-30, -55, 0], dimensions_list=[60, 110, -6.35], name="LadderPlate", - matname="team3_aluminium") -m3d.modeler.create_box(position=[-20, -35, 0], dimensions_list=[40, 30, -6.35], name="CutoutTool1") -m3d.modeler.create_box(position=[-20, 5, 0], dimensions_list=[40, 30, -6.35], name="CutoutTool2") +m3d.modeler.create_box(origin=[-30, -55, 0], sizes=[60, 110, -6.35], name="LadderPlate", material="team3_aluminium") +m3d.modeler.create_box(origin=[-20, -35, 0], sizes=[40, 30, -6.35], name="CutoutTool1") +m3d.modeler.create_box(origin=[-20, 5, 0], sizes=[40, 30, -6.35], name="CutoutTool2") m3d.modeler.subtract("LadderPlate", ["CutoutTool1", "CutoutTool2"], keep_originals=False) ################################################################################ @@ -105,12 +104,10 @@ # Draw a search coil and assign it a ``stranded`` current excitation. # The stranded type forces the current density to be constant in the coil. -m3d.modeler.create_cylinder( - cs_axis="Z", position=[0, "Coil_Position", 15], radius=40, height=20, name="SearchCoil", matname="copper" -) -m3d.modeler.create_cylinder( - cs_axis="Z", position=[0, "Coil_Position", 15], radius=20, height=20, name="Bore", matname="copper" -) +m3d.modeler.create_cylinder(orientation="Z", origin=[0, "Coil_Position", 15], radius=40, height=20, name="SearchCoil", + material="copper") +m3d.modeler.create_cylinder(orientation="Z", origin=[0, "Coil_Position", 15], radius=20, height=20, name="Bore", + material="copper") m3d.modeler.subtract("SearchCoil", "Bore", keep_originals=False) m3d.modeler.section("SearchCoil", "YZ") m3d.modeler.separate_bodies("SearchCoil_Section1") @@ -125,8 +122,8 @@ # mesh locally around the line. line_points = [["0mm", "-55mm", "0.5mm"], ["0mm", "55mm", "0.5mm"]] -m3d.modeler.create_polyline(position_list=line_points, name="Line_AB") -poly = m3d.modeler.create_polyline(position_list=line_points, name="Line_AB_MeshRefinement") +m3d.modeler.create_polyline(points=line_points, name="Line_AB") +poly = m3d.modeler.create_polyline(points=line_points, name="Line_AB_MeshRefinement") poly.set_crosssection_properties(type="Circle", width="0.5mm") ############################################################################### diff --git a/examples/03-Maxwell/Maxwell_Magnet.py b/examples/03-Maxwell/Maxwell_Magnet.py index d82fd12da7b..a6596d884bd 100644 --- a/examples/03-Maxwell/Maxwell_Magnet.py +++ b/examples/03-Maxwell/Maxwell_Magnet.py @@ -58,7 +58,7 @@ # ~~~~~~~~~~~~~ # Create a magnet. -magnet = m3d.modeler.create_box(position=[7, 4, 22], dimensions_list=[10, 5, 30], name="Magnet", matname="copper") +magnet = m3d.modeler.create_box(origin=[7, 4, 22], sizes=[10, 5, 30], name="Magnet", material="copper") ############################################################################### # Create setup and assign voltage diff --git a/examples/04-Icepak/Icepak_3DComponents_Example.py b/examples/04-Icepak/Icepak_3DComponents_Example.py index 4977da6bbf6..a052677b123 100644 --- a/examples/04-Icepak/Icepak_3DComponents_Example.py +++ b/examples/04-Icepak/Icepak_3DComponents_Example.py @@ -49,16 +49,16 @@ ipk.modeler.get_object_from_name("Region").delete() # Definition of heatsink with boxes -hs_base = ipk.modeler.create_box(position=[0, 0, 0], dimensions_list=[37.5, 37.5, 2], name="HS_Base") +hs_base = ipk.modeler.create_box(origin=[0, 0, 0], sizes=[37.5, 37.5, 2], name="HS_Base") hs_base.material_name = "Al-Extruded" -hs_fin = ipk.modeler.create_box(position=[0, 0, 2], dimensions_list=[37.5, 1, 18], name="HS_Fin1") +hs_fin = ipk.modeler.create_box(origin=[0, 0, 2], sizes=[37.5, 1, 18], name="HS_Fin1") hs_fin.material_name = "Al-Extruded" hs_fin.duplicate_along_line([0, 3.65, 0], nclones=11) ipk.plot(show=False, export_path=os.path.join(temp_folder, "Heatsink.jpg")) # Definition of a mesh region. First a non-model box is created, then the mesh region is assigned -mesh_box = ipk.modeler.create_box(position=[-2, -2, -3], dimensions_list=[41.5, 41.5, 24]) +mesh_box = ipk.modeler.create_box(origin=[-2, -2, -3], sizes=[41.5, 41.5, 24]) mesh_box.model = False mesh_region = ipk.mesh.assign_mesh_region([mesh_box.name]) mesh_region.UserSpecifiedSettings = True @@ -164,12 +164,11 @@ y_pointing=[0, 1, 0], ) heatsink_obj = ipk.modeler.insert_3d_component( - comp_file=os.path.join(temp_folder, "componentLibrary", "Heatsink.a3dcomp"), - targetCS="HeatsinkCS", auxiliary_dict=True) + input_file=os.path.join(temp_folder, "componentLibrary", "Heatsink.a3dcomp"), coordinate_system="HeatsinkCS", + auxiliary_parameters=True) -QFP2_obj = ipk.modeler.insert_3d_component( - comp_file=os.path.join(temp_folder, "componentLibrary", "QFP.a3dcomp"), - targetCS="Global", auxiliary_dict=True) +QFP2_obj = ipk.modeler.insert_3d_component(input_file=os.path.join(temp_folder, "componentLibrary", "QFP.a3dcomp"), + coordinate_system="Global", auxiliary_parameters=True) ipk.plot(show=False, export_path=os.path.join(temp_folder, "electronic_package.jpg")) # Create a coordinate system at the xmin, ymin, zmin of the model diff --git a/examples/04-Icepak/Icepak_CSV_Import.py b/examples/04-Icepak/Icepak_CSV_Import.py index 23bddf410f5..d4d0dd11980 100644 --- a/examples/04-Icepak/Icepak_CSV_Import.py +++ b/examples/04-Icepak/Icepak_CSV_Import.py @@ -48,7 +48,7 @@ ipk.autosave_disable() # Create the PCB as a simple block. -board = ipk.modeler.create_box([-30.48, -27.305, 0], [146.685, 71.755, 0.4064], "board_outline", matname="FR-4_Ref") +board = ipk.modeler.create_box([-30.48, -27.305, 0], [146.685, 71.755, 0.4064], "board_outline", material="FR-4_Ref") ############################################################################### # Blocks creation with a CSV file @@ -86,7 +86,7 @@ material_name = "copper" # creates the block with the given name, coordinates, material, and type - block = ipk.modeler.create_box(origin, dimensions, name=block_name, matname=material_name) + block = ipk.modeler.create_box(origin, dimensions, name=block_name, material=material_name) # Assign boundary conditions if row["block_type"] == "solid": diff --git a/examples/04-Icepak/Sherlock_Example.py b/examples/04-Icepak/Sherlock_Example.py index 56cd9407386..dc0dc6295ba 100644 --- a/examples/04-Icepak/Sherlock_Example.py +++ b/examples/04-Icepak/Sherlock_Example.py @@ -191,7 +191,9 @@ point1 = ipk.assign_point_monitor(ipk.modeler["COMP_U10"].top_face_z.center, monitor_name="Point1") ipk.modeler.set_working_coordinate_system("Global") -line = ipk.modeler.create_polyline([ipk.modeler["COMP_U10"].top_face_z.vertices[0].position, ipk.modeler["COMP_U10"].top_face_z.vertices[2].position], non_model=True) +line = ipk.modeler.create_polyline( + [ipk.modeler["COMP_U10"].top_face_z.vertices[0].position, ipk.modeler["COMP_U10"].top_face_z.vertices[2].position], + non_model=True) ipk.post.create_report(expressions="Point1.Temperature", primary_sweep_variable="X") ############################################################################### diff --git a/examples/05-Q3D/Q2D_Armoured_Cable.py b/examples/05-Q3D/Q2D_Armoured_Cable.py index 0f486ee4574..99372aa6f66 100644 --- a/examples/05-Q3D/Q2D_Armoured_Cable.py +++ b/examples/05-Q3D/Q2D_Armoured_Cable.py @@ -137,7 +137,7 @@ mod2D.set_working_coordinate_system('CS_c_strand_1') c1_id = mod2D.create_circle(['0mm', '0mm', '0mm'], 'c_strand_radius', name='c_strand_1', matname='copper') c2_id = c1_id.duplicate_along_line(vector=['0mm', '2.0*c_strand_radius', '0mm'], nclones=2) -mod2D.duplicate_around_axis(c2_id, cs_axis="Z", angle=360 / core_n_strands, nclones=6) +mod2D.duplicate_around_axis(c2_id, axis="Z", angle=360 / core_n_strands, clones=6) c_unite_name = mod2D.unite(q2d.get_all_conductors_names()) fill_id = mod2D.create_circle(['0mm', '0mm', '0mm'], '3*c_strand_radius', name='c_strand_fill', @@ -150,7 +150,7 @@ mod2D.set_working_coordinate_system('Global') all_obj_names = q2d.get_all_conductors_names() + q2d.get_all_dielectrics_names() -mod2D.duplicate_around_axis(all_obj_names, cs_axis="Z", angle=360 / cable_n_cores, nclones=4) +mod2D.duplicate_around_axis(all_obj_names, axis="Z", angle=360 / cable_n_cores, clones=4) cond_names = q2d.get_all_conductors_names() ##################################################################################### diff --git a/examples/05-Q3D/Q2D_Example_CPWG.py b/examples/05-Q3D/Q2D_Example_CPWG.py index d57cfdb86f9..eed944fd119 100644 --- a/examples/05-Q3D/Q2D_Example_CPWG.py +++ b/examples/05-Q3D/Q2D_Example_CPWG.py @@ -83,36 +83,34 @@ # ~~~~~~~~~~~~~ # Create a signal. -base_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_lh, 0], [sig_bot_w, layer_2_lh, 0]], name="signal") -top_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_uh, 0], [sig_top_w, layer_2_uh, 0]]) -q.modeler.move(objid=[top_line_obj], vector=[delta_w_half, 0, 0]) +base_line_obj = q.modeler.create_polyline(points=[[0, layer_2_lh, 0], [sig_bot_w, layer_2_lh, 0]], name="signal") +top_line_obj = q.modeler.create_polyline(points=[[0, layer_2_uh, 0], [sig_top_w, layer_2_uh, 0]]) +q.modeler.move(assignment=[top_line_obj], vector=[delta_w_half, 0, 0]) q.modeler.connect([base_line_obj, top_line_obj]) -q.modeler.move(objid=[base_line_obj], vector=["{}+{}".format(co_gnd_w, clearance), 0, 0]) +q.modeler.move(assignment=[base_line_obj], vector=["{}+{}".format(co_gnd_w, clearance), 0, 0]) ############################################################################### # Create coplanar ground # ~~~~~~~~~~~~~~~~~~~~~~ # Create a coplanar ground. -base_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_lh, 0], [co_gnd_w, layer_2_lh, 0]], - name="co_gnd_left") -top_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_uh, 0], [co_gnd_top_w, layer_2_uh, 0]]) -q.modeler.move(objid=[top_line_obj], vector=[delta_w_half, 0, 0]) +base_line_obj = q.modeler.create_polyline(points=[[0, layer_2_lh, 0], [co_gnd_w, layer_2_lh, 0]], name="co_gnd_left") +top_line_obj = q.modeler.create_polyline(points=[[0, layer_2_uh, 0], [co_gnd_top_w, layer_2_uh, 0]]) +q.modeler.move(assignment=[top_line_obj], vector=[delta_w_half, 0, 0]) q.modeler.connect([base_line_obj, top_line_obj]) -base_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_lh, 0], [co_gnd_w, layer_2_lh, 0]], - name="co_gnd_right") -top_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_uh, 0], [co_gnd_top_w, layer_2_uh, 0]]) -q.modeler.move(objid=[top_line_obj], vector=[delta_w_half, 0, 0]) +base_line_obj = q.modeler.create_polyline(points=[[0, layer_2_lh, 0], [co_gnd_w, layer_2_lh, 0]], name="co_gnd_right") +top_line_obj = q.modeler.create_polyline(points=[[0, layer_2_uh, 0], [co_gnd_top_w, layer_2_uh, 0]]) +q.modeler.move(assignment=[top_line_obj], vector=[delta_w_half, 0, 0]) q.modeler.connect([base_line_obj, top_line_obj]) -q.modeler.move(objid=[base_line_obj], vector=["{}+{}*2+{}".format(co_gnd_w, clearance, sig_bot_w), 0, 0]) +q.modeler.move(assignment=[base_line_obj], vector=["{}+{}*2+{}".format(co_gnd_w, clearance, sig_bot_w), 0, 0]) ############################################################################### # Create reference ground plane # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create a reference ground plane. -q.modeler.create_rectangle(position=[0, layer_1_lh, 0], dimension_list=[model_w, cond_h], name="ref_gnd") +q.modeler.create_rectangle(origin=[0, layer_1_lh, 0], sizes=[model_w, cond_h], name="ref_gnd") ############################################################################### # Create dielectric @@ -120,7 +118,7 @@ # Create a dielectric. q.modeler.create_rectangle( - position=[0, layer_1_uh, 0], dimension_list=[model_w, d_h], name="Dielectric", matname="FR4_epoxy" + origin=[0, layer_1_uh, 0], sizes=[model_w, d_h], name="Dielectric", material="FR4_epoxy" ) ############################################################################### @@ -144,10 +142,10 @@ new_obj = q.modeler.sweep_along_vector(e_obj_1.id, [0, sm_h, 0]) sm_obj_list.append(e_obj_1) -new_obj = q.modeler.create_rectangle(position=[co_gnd_w, layer_2_lh, 0], dimension_list=[clearance, sm_h]) +new_obj = q.modeler.create_rectangle(origin=[co_gnd_w, layer_2_lh, 0], sizes=[clearance, sm_h]) sm_obj_list.append(new_obj) -new_obj = q.modeler.create_rectangle(position=[co_gnd_w, layer_2_lh, 0], dimension_list=[clearance, sm_h]) +new_obj = q.modeler.create_rectangle(origin=[co_gnd_w, layer_2_lh, 0], sizes=[clearance, sm_h]) q.modeler.move([new_obj], [sig_bot_w + "+" + clearance, 0, 0]) sm_obj_list.append(new_obj) diff --git a/examples/05-Q3D/Q2D_Example_Stripline.py b/examples/05-Q3D/Q2D_Example_Stripline.py index 0b72537f491..6fae84c7eb1 100644 --- a/examples/05-Q3D/Q2D_Example_Stripline.py +++ b/examples/05-Q3D/Q2D_Example_Stripline.py @@ -100,38 +100,35 @@ # ~~~~~~~~~~~~~~~~~~~~~~ # Create a negative signal. -base_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_lh, 0], [sig_w, layer_2_lh, 0]], name="signal_n") -top_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_uh, 0], [sig_top_w, layer_2_uh, 0]]) -q.modeler.move(objid=[top_line_obj], vector=[delta_w_half, 0, 0]) +base_line_obj = q.modeler.create_polyline(points=[[0, layer_2_lh, 0], [sig_w, layer_2_lh, 0]], name="signal_n") +top_line_obj = q.modeler.create_polyline(points=[[0, layer_2_uh, 0], [sig_top_w, layer_2_uh, 0]]) +q.modeler.move(assignment=[top_line_obj], vector=[delta_w_half, 0, 0]) q.modeler.connect([base_line_obj, top_line_obj]) -q.modeler.move(objid=[base_line_obj], vector=["{}+{}+{}+{}".format(co_gnd_w, clearance, sig_w, sig_gap), 0, 0]) +q.modeler.move(assignment=[base_line_obj], vector=["{}+{}+{}+{}".format(co_gnd_w, clearance, sig_w, sig_gap), 0, 0]) ############################################################################### # Create coplanar ground # ~~~~~~~~~~~~~~~~~~~~~~ # Create a coplanar ground. -base_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_lh, 0], [co_gnd_w, layer_2_lh, 0]], - name="co_gnd_left") -top_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_uh, 0], [co_gnd_top_w, layer_2_uh, 0]]) +base_line_obj = q.modeler.create_polyline(points=[[0, layer_2_lh, 0], [co_gnd_w, layer_2_lh, 0]], name="co_gnd_left") +top_line_obj = q.modeler.create_polyline(points=[[0, layer_2_uh, 0], [co_gnd_top_w, layer_2_uh, 0]]) q.modeler.move([top_line_obj], [delta_w_half, 0, 0]) q.modeler.connect([base_line_obj, top_line_obj]) -base_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_lh, 0], [co_gnd_w, layer_2_lh, 0]], - name="co_gnd_right") -top_line_obj = q.modeler.create_polyline(position_list=[[0, layer_2_uh, 0], [co_gnd_top_w, layer_2_uh, 0]]) -q.modeler.move(objid=[top_line_obj], vector=[delta_w_half, 0, 0]) +base_line_obj = q.modeler.create_polyline(points=[[0, layer_2_lh, 0], [co_gnd_w, layer_2_lh, 0]], name="co_gnd_right") +top_line_obj = q.modeler.create_polyline(points=[[0, layer_2_uh, 0], [co_gnd_top_w, layer_2_uh, 0]]) +q.modeler.move(assignment=[top_line_obj], vector=[delta_w_half, 0, 0]) q.modeler.connect([base_line_obj, top_line_obj]) -q.modeler.move(objid=[base_line_obj], - vector=["{}+{}*2+{}*2+{}".format(co_gnd_w, clearance, sig_w, sig_gap), 0, 0]) +q.modeler.move(assignment=[base_line_obj], vector=["{}+{}*2+{}*2+{}".format(co_gnd_w, clearance, sig_w, sig_gap), 0, 0]) ############################################################################### # Create reference ground plane # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create a reference ground plane. -q.modeler.create_rectangle(position=[0, layer_1_lh, 0], dimension_list=[model_w, cond_h], name="ref_gnd_u") -q.modeler.create_rectangle(position=[0, layer_3_lh, 0], dimension_list=[model_w, cond_h], name="ref_gnd_l") +q.modeler.create_rectangle(origin=[0, layer_1_lh, 0], sizes=[model_w, cond_h], name="ref_gnd_u") +q.modeler.create_rectangle(origin=[0, layer_3_lh, 0], sizes=[model_w, cond_h], name="ref_gnd_l") ############################################################################### # Create dielectric @@ -139,13 +136,13 @@ # Create a dielectric. q.modeler.create_rectangle( - position=[0, layer_1_uh, 0], dimension_list=[model_w, core_h], name="Core", matname="FR4_epoxy" + origin=[0, layer_1_uh, 0], sizes=[model_w, core_h], name="Core", material="FR4_epoxy" ) q.modeler.create_rectangle( - position=[0, layer_2_uh, 0], dimension_list=[model_w, pp_h], name="Prepreg", matname="FR4_epoxy" + origin=[0, layer_2_uh, 0], sizes=[model_w, pp_h], name="Prepreg", material="FR4_epoxy" ) q.modeler.create_rectangle( - position=[0, layer_2_lh, 0], dimension_list=[model_w, cond_h], name="Filling", matname="FR4_epoxy" + origin=[0, layer_2_lh, 0], sizes=[model_w, cond_h], name="Filling", material="FR4_epoxy" ) ############################################################################### diff --git a/examples/05-Q3D/Q3D_DC_IR.py b/examples/05-Q3D/Q3D_DC_IR.py index c1cbbd280b7..6536fe911e6 100644 --- a/examples/05-Q3D/Q3D_DC_IR.py +++ b/examples/05-Q3D/Q3D_DC_IR.py @@ -120,13 +120,13 @@ # Create new coordinate systems and place 3D component inductors. q3d.modeler.create_coordinate_system(location_l2_1, name="L2") -comp = q3d.modeler.insert_3d_component(coil, targetCS="L2") +comp = q3d.modeler.insert_3d_component(coil, coordinate_system="L2") comp.rotate(q3d.AXIS.Z, -90) comp.parameters["n_turns"] = "3" comp.parameters["d_wire"] = "100um" q3d.modeler.set_working_coordinate_system("Global") q3d.modeler.create_coordinate_system(location_l4_1, name="L4") -comp2 = q3d.modeler.insert_3d_component(coil, targetCS="L4",) +comp2 = q3d.modeler.insert_3d_component(coil, coordinate_system="L4") comp2.rotate(q3d.AXIS.Z, -90) comp2.parameters["n_turns"] = "3" comp2.parameters["d_wire"] = "100um" @@ -134,7 +134,7 @@ q3d.modeler.set_working_coordinate_system("Global") q3d.modeler.create_coordinate_system(location_r106_1, name="R106") -comp3 = q3d.modeler.insert_3d_component(res, targetCS="R106",geo_params={'$Resistance': 2000}) +comp3 = q3d.modeler.insert_3d_component(res, geometry_parameters={'$Resistance': 2000}, coordinate_system="R106") comp3.rotate(q3d.AXIS.Z, -90) q3d.modeler.set_working_coordinate_system("Global") diff --git a/examples/05-Q3D/Q3D_Example.py b/examples/05-Q3D/Q3D_Example.py index 793ff31dd24..0fd89b1f1d6 100644 --- a/examples/05-Q3D/Q3D_Example.py +++ b/examples/05-Q3D/Q3D_Example.py @@ -54,37 +54,19 @@ # ~~~~~~~~~~~~~~~~~ # Create polylines for three busbars and a box for the substrate. -b1 = q.modeler.create_polyline( - [[0, 0, 0], [-100, 0, 0]], - name="Bar1", - matname="copper", - xsection_type="Rectangle", - xsection_width="5mm", - xsection_height="1mm", -) +b1 = q.modeler.create_polyline([[0, 0, 0], [-100, 0, 0]], name="Bar1", material="copper", xsection_type="Rectangle", + xsection_width="5mm", xsection_height="1mm") q.modeler["Bar1"].color = (255, 0, 0) -q.modeler.create_polyline( - [[0, -15, 0], [-150, -15, 0]], - name="Bar2", - matname="aluminum", - xsection_type="Rectangle", - xsection_width="5mm", - xsection_height="1mm", -) +q.modeler.create_polyline([[0, -15, 0], [-150, -15, 0]], name="Bar2", material="aluminum", xsection_type="Rectangle", + xsection_width="5mm", xsection_height="1mm") q.modeler["Bar2"].color = (0, 255, 0) -q.modeler.create_polyline( - [[0, -30, 0], [-175, -30, 0], [-175, -10, 0]], - name="Bar3", - matname="copper", - xsection_type="Rectangle", - xsection_width="5mm", - xsection_height="1mm", -) +q.modeler.create_polyline([[0, -30, 0], [-175, -30, 0], [-175, -10, 0]], name="Bar3", material="copper", + xsection_type="Rectangle", xsection_width="5mm", xsection_height="1mm") q.modeler["Bar3"].color = (0, 0, 255) -q.modeler.create_box([50, 30, -0.5], [-250, -100, -3], name="substrate", matname="FR4_epoxy") +q.modeler.create_box([50, 30, -0.5], [-250, -100, -3], name="substrate", material="FR4_epoxy") q.modeler["substrate"].color = (128, 128, 128) q.modeler["substrate"].transparency = 0.8 diff --git a/examples/05-Q3D/Q3D_from_EDB.py b/examples/05-Q3D/Q3D_from_EDB.py index c055e24052f..f1fc41d0a7a 100644 --- a/examples/05-Q3D/Q3D_from_EDB.py +++ b/examples/05-Q3D/Q3D_from_EDB.py @@ -105,13 +105,13 @@ # Use previously calculated position to identify faces and # assign sources and sinks on nets. -f1 = q3d.modeler.get_faceid_from_position(location_u13_scl, obj_name="CLOCK_I2C_SCL") +f1 = q3d.modeler.get_faceid_from_position(location_u13_scl, assignment="CLOCK_I2C_SCL") q3d.source(f1, net_name="CLOCK_I2C_SCL") -f1 = q3d.modeler.get_faceid_from_position(location_u13_sda, obj_name="CLOCK_I2C_SDA") +f1 = q3d.modeler.get_faceid_from_position(location_u13_sda, assignment="CLOCK_I2C_SDA") q3d.source(f1, net_name="CLOCK_I2C_SDA") -f1 = q3d.modeler.get_faceid_from_position(location_u1_scl, obj_name="CLOCK_I2C_SCL") +f1 = q3d.modeler.get_faceid_from_position(location_u1_scl, assignment="CLOCK_I2C_SCL") q3d.sink(f1, net_name="CLOCK_I2C_SCL") -f1 = q3d.modeler.get_faceid_from_position(location_u1_sda, obj_name="CLOCK_I2C_SDA") +f1 = q3d.modeler.get_faceid_from_position(location_u1_sda, assignment="CLOCK_I2C_SDA") q3d.sink(f1, net_name="CLOCK_I2C_SDA") ############################################################################### diff --git a/examples/06-Multiphysics/Hfss_Icepak_Coupling.py b/examples/06-Multiphysics/Hfss_Icepak_Coupling.py index 56258e08585..272bcb130d3 100644 --- a/examples/06-Multiphysics/Hfss_Icepak_Coupling.py +++ b/examples/06-Multiphysics/Hfss_Icepak_Coupling.py @@ -74,12 +74,12 @@ # Optionally, you can assign a material using the :func:`assign_material` method. # TODO: How does this work when two truesurfaces are defined? -o1 = aedtapp.modeler.create_cylinder(cs_axis=aedtapp.PLANE.ZX, position=udp, radius="inner", height="$coax_dimension", - numSides=0, name="inner") -o2 = aedtapp.modeler.create_cylinder(cs_axis=aedtapp.PLANE.ZX, position=udp, radius=8, height="$coax_dimension", - numSides=0, matname="teflon_based") -o3 = aedtapp.modeler.create_cylinder(cs_axis=aedtapp.PLANE.ZX, position=udp, radius=10, height="$coax_dimension", - numSides=0, name="outer") +o1 = aedtapp.modeler.create_cylinder(orientation=aedtapp.PLANE.ZX, origin=udp, radius="inner", height="$coax_dimension", + num_sides=0, name="inner") +o2 = aedtapp.modeler.create_cylinder(orientation=aedtapp.PLANE.ZX, origin=udp, radius=8, height="$coax_dimension", + num_sides=0, material="teflon_based") +o3 = aedtapp.modeler.create_cylinder(orientation=aedtapp.PLANE.ZX, origin=udp, radius=10, height="$coax_dimension", + num_sides=0, name="outer") ############################################################################### # Assign colors diff --git a/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py b/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py index ddec3ecb525..9ae83d184ea 100644 --- a/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py +++ b/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py @@ -54,19 +54,19 @@ # Create the coil, coil terminal, core, and region. coil = m3d.modeler.create_rectangle( - csPlane="XZ", position=[70, 0, -11], dimension_list=[11, 110], name="Coil" + orientation="XZ", origin=[70, 0, -11], sizes=[11, 110], name="Coil" ) -coil.sweep_around_axis(cs_axis=AXIS.Z) +coil.sweep_around_axis(axis=AXIS.Z) coil_terminal = m3d.modeler.create_rectangle( - csPlane="XZ", position=[70, 0, -11], dimension_list=[11, 110], name="Coil_terminal" + orientation="XZ", origin=[70, 0, -11], sizes=[11, 110], name="Coil_terminal" ) core = m3d.modeler.create_rectangle( - csPlane="XZ", position=[45, 0, -18], dimension_list=[7, 160], name="Core" + orientation="XZ", origin=[45, 0, -18], sizes=[7, 160], name="Core" ) -core.sweep_around_axis(cs_axis=AXIS.Z) +core.sweep_around_axis(axis=AXIS.Z) # Magnetic flux is not concentrated by the core in +z-direction. Therefore, more padding is needed in that direction. region = m3d.modeler.create_region(pad_percent=[20, 20, 500, 20, 20, 100]) @@ -182,7 +182,7 @@ ipk.modeler["Region"].delete() coil_dim = coil.bounding_dimension[0] ipk.modeler.create_region(0, False) -ipk.modeler.edit_region_dimensions([coil_dim/2, coil_dim/2, coil_dim/2, coil_dim/2, coil_dim*2, coil_dim]) +ipk.modeler.edit_region_dimensions([coil_dim / 2, coil_dim / 2, coil_dim / 2, coil_dim / 2, coil_dim * 2, coil_dim]) ############################################################################### # Map coil losses diff --git a/examples/07-Circuit/Circuit_Example.py b/examples/07-Circuit/Circuit_Example.py index ab3b61c2c64..fff442bf276 100644 --- a/examples/07-Circuit/Circuit_Example.py +++ b/examples/07-Circuit/Circuit_Example.py @@ -53,9 +53,9 @@ # ~~~~~~~~~~~~~~~~~ # Create components, such as an inductor, resistor, and capacitor. -inductor = aedt_app.modeler.schematic.create_inductor(compname="L1", value=1e-9, location=[0, 0]) -resistor = aedt_app.modeler.schematic.create_resistor(compname="R1", value=50, location=[500, 0]) -capacitor = aedt_app.modeler.schematic.create_capacitor(compname="C1", value=1e-12, location=[1000, 0]) +inductor = aedt_app.modeler.schematic.create_inductor(name="L1", value=1e-9, location=[0, 0]) +resistor = aedt_app.modeler.schematic.create_resistor(name="R1", value=50, location=[500, 0]) +capacitor = aedt_app.modeler.schematic.create_capacitor(name="C1", value=1e-12, location=[1000, 0]) ############################################################################### # Get all pins @@ -77,10 +77,10 @@ # ~~~~~~~~~~~~~~~~~~ # Connect components with wires. -port.pins[0].connect_to_component(component_pin=inductor.pins[0], use_wire=True) -inductor.pins[1].connect_to_component(component_pin=resistor.pins[1], use_wire=True) -resistor.pins[0].connect_to_component(component_pin=capacitor.pins[0], use_wire=True) -capacitor.pins[1].connect_to_component(component_pin=gnd.pins[0], use_wire=True) +port.pins[0].connect_to_component(assignment=inductor.pins[0], use_wire=True) +inductor.pins[1].connect_to_component(assignment=resistor.pins[1], use_wire=True) +resistor.pins[0].connect_to_component(assignment=capacitor.pins[0], use_wire=True) +capacitor.pins[1].connect_to_component(assignment=gnd.pins[0], use_wire=True) ############################################################################### # Create transient setup diff --git a/examples/07-Circuit/Circuit_Subcircuit_Example.py b/examples/07-Circuit/Circuit_Subcircuit_Example.py index 3f8f8409cd5..a5f05b47fc6 100644 --- a/examples/07-Circuit/Circuit_Subcircuit_Example.py +++ b/examples/07-Circuit/Circuit_Subcircuit_Example.py @@ -64,7 +64,7 @@ l1 = circuit.modeler.schematic.create_inductor(value="L_val") c1 = circuit.modeler.schematic.create_capacitor(value="C_val") p2 = circuit.modeler.schematic.create_interface_port(name="Out") -circuit.modeler.schematic.connect_components_in_series(components_to_connect=[p1, r1, l1, c1, p2], use_wire=True) +circuit.modeler.schematic.connect_components_in_series(assignment=[p1, r1, l1, c1, p2], use_wire=True) circuit.pop_up() diff --git a/examples/07-Circuit/Circuit_Transient.py b/examples/07-Circuit/Circuit_Transient.py index 3ef5308466c..bf9fdf4ddd4 100644 --- a/examples/07-Circuit/Circuit_Transient.py +++ b/examples/07-Circuit/Circuit_Transient.py @@ -62,7 +62,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create a resistor and ground in the schematic. -res = cir.modeler.components.create_resistor(compname="R1", value="1Meg") +res = cir.modeler.components.create_resistor(name="R1", value="1Meg") gnd1 = cir.modeler.components.create_gnd() ############################################################################### diff --git a/examples/07-EMIT/interference_gui.py b/examples/07-EMIT/interference_gui.py index 592b3b53eeb..6c7f4fe36ae 100644 --- a/examples/07-EMIT/interference_gui.py +++ b/examples/07-EMIT/interference_gui.py @@ -144,7 +144,7 @@ def setup_widgets(self): self.protection_results_btn.setEnabled(False) self.protection_export_btn.setEnabled(False) self.protection_save_img_btn.setEnabled(False) - self.file_select_btn.clicked.connect(self.open_file_dialog) + self.file_select_btn.clicked.connect(self.open_file_dialog) self.protection_export_btn.clicked.connect(self.save_results_excel) self.protection_results_btn.clicked.connect(self.protection_results) self.protection_legend_table.resizeRowsToContents() diff --git a/examples/07-TwinBuilder/02-Wiring_A_Rectifier.py b/examples/07-TwinBuilder/02-Wiring_A_Rectifier.py index 1894eb0157f..9b7de137a56 100644 --- a/examples/07-TwinBuilder/02-Wiring_A_Rectifier.py +++ b/examples/07-TwinBuilder/02-Wiring_A_Rectifier.py @@ -62,18 +62,18 @@ # Create the four diodes of the bridge rectifier. -diode1 = tb.modeler.schematic.create_diode(compname="D1", location=[10 * G, 6 * G], angle=270) -diode2 = tb.modeler.schematic.create_diode(compname="D2", location=[20 * G, 6 * G], angle=270) -diode3 = tb.modeler.schematic.create_diode(compname="D3", location=[10 * G, -4 * G], angle=270) -diode4 = tb.modeler.schematic.create_diode(compname="D4", location=[20 * G, -4 * G], angle=270) +diode1 = tb.modeler.schematic.create_diode(location=[10 * G, 6 * G], angle=270) +diode2 = tb.modeler.schematic.create_diode(location=[20 * G, 6 * G], angle=270) +diode3 = tb.modeler.schematic.create_diode(location=[10 * G, -4 * G], angle=270) +diode4 = tb.modeler.schematic.create_diode(location=[20 * G, -4 * G], angle=270) # Create a capacitor filter. -capacitor = tb.modeler.schematic.create_capacitor(compname="C_FILTER", value=1e-6, location=[29 * G, -10 * G]) +capacitor = tb.modeler.schematic.create_capacitor(value=1e-6, location=[29 * G, -10 * G]) # Create a load resistor. -resistor = tb.modeler.schematic.create_resistor(compname="RL", value=100000, location=[39 * G, -10 * G]) +resistor = tb.modeler.schematic.create_resistor(value=100000, location=[39 * G, -10 * G]) # Create a ground. @@ -86,26 +86,26 @@ # Wire the diode bridge. -tb.modeler.schematic.create_wire(points_array=[diode1.pins[0].location, diode3.pins[0].location]) -tb.modeler.schematic.create_wire(points_array=[diode2.pins[1].location, diode4.pins[1].location]) -tb.modeler.schematic.create_wire(points_array=[diode1.pins[1].location, diode2.pins[0].location]) -tb.modeler.schematic.create_wire(points_array=[diode3.pins[1].location, diode4.pins[0].location]) +tb.modeler.schematic.create_wire(points=[diode1.pins[0].location, diode3.pins[0].location]) +tb.modeler.schematic.create_wire(points=[diode2.pins[1].location, diode4.pins[1].location]) +tb.modeler.schematic.create_wire(points=[diode1.pins[1].location, diode2.pins[0].location]) +tb.modeler.schematic.create_wire(points=[diode3.pins[1].location, diode4.pins[0].location]) # Wire the AC source. -tb.modeler.schematic.create_wire(points_array=[source.pins[1].location, [0, 10 * G], [15 * G, 10 * G], [15 * G, 5 * G]]) -tb.modeler.schematic.create_wire(points_array=[source.pins[0].location, [0, -10 * G], [15 * G, -10 * G], [15 * G, -5 * G]]) +tb.modeler.schematic.create_wire(points=[source.pins[1].location, [0, 10 * G], [15 * G, 10 * G], [15 * G, 5 * G]]) +tb.modeler.schematic.create_wire(points=[source.pins[0].location, [0, -10 * G], [15 * G, -10 * G], [15 * G, -5 * G]]) # Wire the filter capacitor and load resistor. -tb.modeler.schematic.create_wire(points_array=[resistor.pins[0].location, [40 * G, 0], [22 * G, 0]]) -tb.modeler.schematic.create_wire(points_array=[capacitor.pins[0].location, [30 * G, 0]]) +tb.modeler.schematic.create_wire(points=[resistor.pins[0].location, [40 * G, 0], [22 * G, 0]]) +tb.modeler.schematic.create_wire(points=[capacitor.pins[0].location, [30 * G, 0]]) # Wire the ground. -tb.modeler.schematic.create_wire(points_array=[resistor.pins[1].location, [40 * G, -15 * G], gnd.pins[0].location]) -tb.modeler.schematic.create_wire(points_array=[capacitor.pins[1].location, [30 * G, -15 * G]]) -tb.modeler.schematic.create_wire(points_array=[gnd.pins[0].location, [5 * G, 0], [8 * G, 0]]) +tb.modeler.schematic.create_wire(points=[resistor.pins[1].location, [40 * G, -15 * G], gnd.pins[0].location]) +tb.modeler.schematic.create_wire(points=[capacitor.pins[1].location, [30 * G, -15 * G]]) +tb.modeler.schematic.create_wire(points=[gnd.pins[0].location, [5 * G, 0], [8 * G, 0]]) # Zoom to fit the schematic tb.modeler.zoom_to_fit() diff --git a/pyaedt/application/Analysis3D.py b/pyaedt/application/Analysis3D.py index 2bac5ff6b7e..9669dbe0db7 100644 --- a/pyaedt/application/Analysis3D.py +++ b/pyaedt/application/Analysis3D.py @@ -703,10 +703,10 @@ def assign_material(self, obj, mat): >>> from pyaedt import Hfss >>> hfss = Hfss() - >>> box1 = hfss.modeler.create_box([10, 10, 10], [4, 5, 5]) - >>> box2 = hfss.modeler.create_box([0, 0, 0], [2, 3, 4]) - >>> cylinder1 = hfss.modeler.create_cylinder(cs_axis="X", position=[5, 0, 0], radius=1, height=20) - >>> cylinder2 = hfss.modeler.create_cylinder(cs_axis="Z", position=[0, 0, 5], radius=1, height=10) + >>> box1 = hfss.modeler.create_box([10, 10, 10],[4, 5, 5]) + >>> box2 = hfss.modeler.create_box([0, 0, 0],[2, 3, 4]) + >>> cylinder1 = hfss.modeler.create_cylinder(orientation="X",origin=[5, 0, 0],radius=1,height=20) + >>> cylinder2 = hfss.modeler.create_cylinder(orientation="Z",origin=[0, 0, 5],radius=1,height=10) Assign the material ``"copper"`` to all the objects. diff --git a/pyaedt/circuit.py b/pyaedt/circuit.py index f35a8c12e5d..986c918b7f0 100644 --- a/pyaedt/circuit.py +++ b/pyaedt/circuit.py @@ -227,7 +227,7 @@ def create_schematic_from_netlist(self, file_to_import): location=[xpos, 0], global_netlist_list=model, ) - self.modeler.schematic.disable_data_netlist(component_name="Models_Netlist") + self.modeler.schematic.disable_data_netlist(assignment="Models_Netlist") xpos += 0.0254 counter = 0 with open_file(file_to_import, "rb") as f: @@ -307,11 +307,7 @@ def create_schematic_from_netlist(self, file_to_import): already_exist = True if not already_exist: self.modeler.schematic.create_new_component_from_symbol( - parameter, - pins, - refbase=fields[0][0], - parameter_list=parameter_list, - parameter_value=parameter_value, + parameter, pins, refbase=fields[0][0], parameters=parameter_list, values=parameter_value ) mycomp = self.modeler.schematic.create_component( fields[0], @@ -342,11 +338,7 @@ def create_schematic_from_netlist(self, file_to_import): already_exist = True if not already_exist: self.modeler.schematic.create_new_component_from_symbol( - parameter, - pins, - refbase=fields[0][0], - parameter_list=parameter_list, - parameter_value=parameter_value, + parameter, pins, refbase=fields[0][0], parameters=parameter_list, values=parameter_value ) mycomp = self.modeler.schematic.create_component( fields[0], @@ -1823,7 +1815,7 @@ def create_lna_schematic_from_snp( new_loc = [loc[0] + delta, loc[1]] right += 1 port = self.modeler.components.create_interface_port(name=pin.name, location=new_loc) - port.pins[0].connect_to_component(component_pin=pin, use_wire=True) + port.pins[0].connect_to_component(assignment=pin, use_wire=True) ports.append(port) diff_pairs = [] comm_pairs = [] diff --git a/pyaedt/generic/configurations.py b/pyaedt/generic/configurations.py index c5a1a0cdbfa..8a3170a6b60 100644 --- a/pyaedt/generic/configurations.py +++ b/pyaedt/generic/configurations.py @@ -1999,7 +1999,7 @@ def apply_operations_to_native_components(obj, operation_dict, native_dict): # ) elif operation_dict["Props"]["Command"] == "Rotate": rotation = decompose_variable_value(operation_dict["Props"]["Angle"]) - obj.rotate(operation_dict["Props"]["Axis"], angle=rotation[0], unit=rotation[1]) + obj.rotate(operation_dict["Props"]["Axis"], angle=rotation[0], units=rotation[1]) elif operation_dict["Props"]["Command"] == "Mirror": obj.mirror( [ @@ -2020,11 +2020,11 @@ def apply_operations_to_native_components(obj, operation_dict, native_dict): # elif operation_dict["Props"]["Command"] == "DuplicateAroundAxis": rotation = decompose_variable_value(operation_dict["Props"]["Angle"]) new_objs = obj.duplicate_around_axis( - operation_dict["Props"]["Axis"], angle=rotation[0], nclones=operation_dict["Props"]["Total Number"] + operation_dict["Props"]["Axis"], angle=rotation[0], clones=operation_dict["Props"]["Total Number"] ) elif operation_dict["Props"]["Command"] == "DuplicateMirror": new_objs = obj.duplicate_and_mirror( - position=[ + origin=[ decompose_variable_value(operation_dict["Props"]["Base Position"][2 * i + 1])[0] for i in range(3) ], diff --git a/pyaedt/generic/ibis_reader.py b/pyaedt/generic/ibis_reader.py index b6c99e129a7..fbaf2a6b790 100644 --- a/pyaedt/generic/ibis_reader.py +++ b/pyaedt/generic/ibis_reader.py @@ -275,10 +275,7 @@ def insert(self, x, y, angle=0.0): """ return self._circuit.modeler.schematic.create_component( - component_library=None, - component_name=self.buffer_name, - location=[x, y], - angle=angle, + component_library=None, component_name=self.buffer_name, location=[x, y], angle=angle ) @@ -439,10 +436,7 @@ def insert(self, x, y, angle=0.0): """ return self._circuit.modeler.schematic.create_component( - component_library=None, - component_name=self.buffer_name, - location=[x, y], - angle=angle, + component_library=None, component_name=self.buffer_name, location=[x, y], angle=angle ) @@ -503,10 +497,7 @@ def insert(self, x, y, angle=0.0): """ return self._circuit.modeler.schematic.create_component( - component_library=None, - component_name=self.name, - location=[x, y], - angle=angle, + component_library=None, component_name=self.name, location=[x, y], angle=angle ) diff --git a/pyaedt/generic/touchstone_parser.py b/pyaedt/generic/touchstone_parser.py index 3442529ee94..983d164d934 100644 --- a/pyaedt/generic/touchstone_parser.py +++ b/pyaedt/generic/touchstone_parser.py @@ -255,8 +255,8 @@ def get_return_loss_index(self, excitation_name_prefix=""): If no excitation is provided it will provide a full list of return losses. - Example: excitation_names ["1","2"] is_touchstone_expression=False output ["S(1,1)",, S(2,2)] - Example: excitation_names ["S(1,1)","S(1,2)", S(2,2)] is_touchstone_expression=True output ["S(1,1)",, S(2,2)] + Example: excitation_names ["1","2"] is_touchstone_expression=False output ["S(1,1)", S(2,2)] + Example: excitation_names ["S(1,1)","S(1,2)", S(2,2)] is_touchstone_expression=True output ["S(1,1)", S(2,2)] Parameters ---------- diff --git a/pyaedt/hfss.py b/pyaedt/hfss.py index d31c96859bc..fd668db9f00 100644 --- a/pyaedt/hfss.py +++ b/pyaedt/hfss.py @@ -696,12 +696,8 @@ def assign_coating( >>> from pyaedt import Hfss >>> hfss = Hfss() >>> origin = hfss.modeler.Position(0, 0, 0) - >>> inner = hfss.modeler.create_cylinder( - ... hfss.PLANE.XY, origin, 3, 200, 0, "inner" - ... ) - >>> outer = hfss.modeler.create_cylinder( - ... hfss.PLANE.XY, origin, 4, 200, 0, "outer" - ... ) + >>> inner = hfss.modeler.create_cylinder(hfss.PLANE.XY,origin,3,200,0,"inner") + >>> outer = hfss.modeler.create_cylinder(hfss.PLANE.XY,origin,4,200,0,"outer") >>> coat = hfss.assign_coating(["inner", outer.faces[2].id], "copper", use_thickness=True, thickness="0.2mm") """ @@ -889,7 +885,10 @@ def create_linear_count_sweep( named ``"LinearCountSweep"``. >>> setup = hfss.create_setup("LinearCountSetup") - >>> linear_count_sweep = hfss.create_linear_count_sweep(,,, + >>> linear_count_sweep = hfss.create_linear_count_sweep(setup="LinearCountSetup", + ... sweep="LinearCountSweep", + ... units="MHz", start_frequency=1.1e3, + ... stop_frequency=1200.1, num_of_freq_points=1658) >>> type(linear_count_sweep) @@ -1676,8 +1675,8 @@ def create_spiral_lumped_port(self, assignment, reference, width=None, name=None >>> aedtapp = Hfss() >>> aedtapp.insert_design("Design_Terminal_2") >>> aedtapp.solution_type = "Terminal" - >>> box1 = aedtapp.modeler.create_box([-100, -100, 0], [200, 200, 5], name="gnd2z", matname="copper") - >>> box2 = aedtapp.modeler.create_box([-100, -100, 20], [200, 200, 25], name="sig2z", matname="copper") + >>> box1 = aedtapp.modeler.create_box([-100, -100, 0],[200, 200, 5],name="gnd2z",material="copper") + >>> box2 = aedtapp.modeler.create_box([-100, -100, 20],[200, 200, 25],name="sig2z",material="copper") >>> aedtapp.modeler.fit_all() >>> portz = aedtapp.create_spiral_lumped_port(box1,box2) """ @@ -1794,10 +1793,10 @@ def create_spiral_lumped_port(self, assignment, reference, width=None, name=None poly1 = self.modeler.create_polyline( p1_down, + name=assignment + "_sheet", xsection_type="Line", xsection_orient=orient, xsection_width=closest_distance / 2, - name=assignment + "_sheet", ) # create second polyline to join spiral with conductor face @@ -1812,10 +1811,10 @@ def create_spiral_lumped_port(self, assignment, reference, width=None, name=None orient = "X" if (dx < dy) else "Y" poly2 = self.modeler.create_polyline( p2_up, + name=reference + "_sheet", xsection_type="Line", xsection_orient=orient, xsection_width=closest_distance / 2, - name=reference + "_sheet", ) # assign pec to created polylines @@ -1866,10 +1865,8 @@ def create_voltage_source_from_objects( Create two boxes for creating a voltage source named ``'VoltageSource'``. - >>> box1 = hfss.modeler.create_box([30, 0, 0], [40, 10, 5], - ... "BoxVolt1", "copper") - >>> box2 = hfss.modeler.create_box([30, 0, 10], [40, 10, 5], - ... "BoxVolt2", "copper") + >>> box1 = hfss.modeler.create_box([30, 0, 0],[40, 10, 5],"BoxVolt1","copper") + >>> box2 = hfss.modeler.create_box([30, 0, 10],[40, 10, 5],"BoxVolt2","copper") >>> v1 = hfss.create_voltage_source_from_objects("BoxVolt1","BoxVolt2",hfss.AxisDir.XNeg,"VoltageSource") PyAEDT INFO: Connection Correctly created """ @@ -1924,10 +1921,8 @@ def create_current_source_from_objects( Create two boxes for creating a current source named ``'CurrentSource'``. - >>> box1 = hfss.modeler.create_box([30, 0, 20], [40, 10, 5], - ... "BoxCurrent1", "copper") - >>> box2 = hfss.modeler.create_box([30, 0, 30], [40, 10, 5], - ... "BoxCurrent2", "copper") + >>> box1 = hfss.modeler.create_box([30, 0, 20],[40, 10, 5],"BoxCurrent1","copper") + >>> box2 = hfss.modeler.create_box([30, 0, 30],[40, 10, 5],"BoxCurrent2","copper") >>> i1 = hfss.create_current_source_from_objects("BoxCurrent1","BoxCurrent2",hfss.AxisDir.XPos,"CurrentSource") PyAEDT INFO: Connection created 'CurrentSource' correctly. """ @@ -2411,10 +2406,8 @@ def create_perfecte_from_objects( Create two boxes for creating a Perfect E named ``'PerfectE'``. - >>> box1 = hfss.modeler.create_box([0,0,0], [10,10,5], - ... "perfect1", "Copper") - >>> box2 = hfss.modeler.create_box([0, 0, 10], [10, 10, 5], - ... "perfect2", "copper") + >>> box1 = hfss.modeler.create_box([0,0,0],[10,10,5],"perfect1","Copper") + >>> box2 = hfss.modeler.create_box([0, 0, 10],[10, 10, 5],"perfect2","copper") >>> perfect_e = hfss.create_perfecte_from_objects("perfect1","perfect2",hfss.AxisDir.ZNeg,"PerfectE") PyAEDT INFO: Connection Correctly created >>> type(perfect_e) @@ -2481,10 +2474,8 @@ def create_perfecth_from_objects( Create two boxes for creating a Perfect H named ``'PerfectH'``. - >>> box1 = hfss.modeler.create_box([0,0,20], [10,10,5], - ... "perfect1", "Copper") - >>> box2 = hfss.modeler.create_box([0, 0, 30], [10, 10, 5], - ... "perfect2", "copper") + >>> box1 = hfss.modeler.create_box([0,0,20],[10,10,5],"perfect1","Copper") + >>> box2 = hfss.modeler.create_box([0, 0, 30],[10, 10, 5],"perfect2","copper") >>> perfect_h = hfss.create_perfecth_from_objects("perfect1","perfect2",hfss.AxisDir.ZNeg,"Perfect H") PyAEDT INFO: Connection Correctly created >>> type(perfect_h) @@ -2658,10 +2649,8 @@ def create_lumped_rlc_between_objects( Create two boxes for creating a lumped RLC named ``'LumpedRLC'``. - >>> box1 = hfss.modeler.create_box([0, 0, 50], [10, 10, 5], - ... "rlc1", "copper") - >>> box2 = hfss.modeler.create_box([0, 0, 60], [10, 10, 5], - ... "rlc2", "copper") + >>> box1 = hfss.modeler.create_box([0, 0, 50],[10, 10, 5],"rlc1","copper") + >>> box2 = hfss.modeler.create_box([0, 0, 60],[10, 10, 5],"rlc2","copper") >>> rlc = hfss.create_lumped_rlc_between_objects("rlc1","rlc2",hfss.AxisDir.XPos,"Lumped RLC",resistance=50, ... inductance=1e-9, capacitance=1e-6) PyAEDT INFO: Connection Correctly created @@ -2761,10 +2750,8 @@ def create_impedance_between_objects( Create two boxes for creating an impedance named ``'ImpedanceExample'``. - >>> box1 = hfss.modeler.create_box([0, 0, 70], [10, 10, 5], - ... "box1", "copper") - >>> box2 = hfss.modeler.create_box([0, 0, 80], [10, 10, 5], - ... "box2", "copper") + >>> box1 = hfss.modeler.create_box([0, 0, 70],[10, 10, 5],"box1","copper") + >>> box2 = hfss.modeler.create_box([0, 0, 80],[10, 10, 5],"box2","copper") >>> impedance = hfss.create_impedance_between_objects("box1", "box2", hfss.AxisDir.XPos, ... "ImpedanceExample", 100, 50) PyAEDT INFO: Connection Correctly created @@ -2932,9 +2919,8 @@ def assign_voltage_source_to_sheet(self, assignment, start_direction=0, name=Non Create a sheet and assign to it some voltage. - >>> sheet = hfss.modeler.create_rectangle(hfss.PLANE.XY, - ... [0, 0, -70], [10, 2], name="VoltageSheet", - ... matname="copper") + >>> sheet = hfss.modeler.create_rectangle(hfss.PLANE.XY,[0, 0, -70],[10, 2], + ... name="VoltageSheet",material="copper") >>> v1 = hfss.assign_voltage_source_to_sheet(sheet.name,hfss.AxisDir.XNeg,"VoltageSheetExample") >>> v2 = hfss.assign_voltage_source_to_sheet(sheet.name,[sheet.bottom_edge_x.midpoint, ... sheet.bottom_edge_y.midpoint],50) @@ -2985,8 +2971,8 @@ def assign_current_source_to_sheet(self, assignment, start_direction=0, name=Non Create a sheet and assign some current to it. - >>> sheet = hfss.modeler.create_rectangle(hfss.PLANE.XY, [0, 0, -50], - ... [5, 1], name="CurrentSheet", matname="copper") + >>> sheet = hfss.modeler.create_rectangle(hfss.PLANE.XY,[0, 0, -50],[5, 1], + ... name="CurrentSheet",material="copper") >>> hfss.assign_current_source_to_sheet(sheet.name,hfss.AxisDir.XNeg,"CurrentSheetExample") 'CurrentSheetExample' >>> c1 = hfss.assign_current_source_to_sheet(sheet.name,[sheet.bottom_edge_x.midpoint, @@ -3036,7 +3022,7 @@ def assign_perfecte_to_sheets(self, assignment, name=None, is_infinite_ground=Fa Create a sheet and use it to create a Perfect E. >>> sheet = hfss.modeler.create_rectangle(hfss.PLANE.XY, [0, 0, -90], - ... [10, 2], name="PerfectESheet", matname="Copper") + ... [10, 2], name="PerfectESheet", material="Copper") >>> perfect_e_from_sheet = hfss.assign_perfecte_to_sheets(sheet.name,"PerfectEFromSheet") >>> type(perfect_e_from_sheet) @@ -3078,7 +3064,7 @@ def assign_perfecth_to_sheets(self, assignment, name=None): Create a sheet and use it to create a Perfect H. >>> sheet = hfss.modeler.create_rectangle(hfss.PLANE.XY, [0, 0, -90], - ... [10, 2], name="PerfectHSheet", matname="Copper") + ... [10, 2], name="PerfectHSheet", material="Copper") >>> perfect_h_from_sheet = hfss.assign_perfecth_to_sheets(sheet.name,"PerfectHFromSheet") >>> type(perfect_h_from_sheet) @@ -3154,7 +3140,7 @@ def assign_lumped_rlc_to_sheet( >>> sheet = hfss.modeler.create_rectangle(hfss.PLANE.XY, ... [0, 0, -90], [10, 2], name="RLCSheet", - ... matname="Copper") + ... material="Copper") >>> lumped_rlc_to_sheet = hfss.assign_lumped_rlc_to_sheet(sheet.name,hfss.AxisDir.XPos,resistance=50, ... inductance=1e-9,capacitance=1e-6) >>> type(lumped_rlc_to_sheet) @@ -3235,7 +3221,7 @@ def assign_impedance_to_sheet(self, assignment, name=None, resistance=50, reacta >>> sheet = hfss.modeler.create_rectangle(hfss.PLANE.XY, ... [0, 0, -90], [10, 2], name="ImpedanceSheet", - ... matname="Copper") + ... material="Copper") >>> impedance_to_sheet = hfss.assign_impedance_to_sheet(sheet.name,"ImpedanceFromSheet",100,50) >>> type(impedance_to_sheet) @@ -3319,14 +3305,14 @@ def assign_impedance_to_sheet( >>> sheet = hfss.modeler.create_rectangle(hfss.PLANE.XY, ... [0, 0, -90], [10, 2], name="ImpedanceSheet", - ... matname="Copper") + ... material="Copper") >>> impedance_to_sheet = hfss.assign_impedance_to_sheet(sheet.name,"ImpedanceFromSheet",100,50) Create a sheet and use it to create an anisotropic impedance. >>> sheet = hfss.modeler.create_rectangle(hfss.PLANE.XY, ... [0, 0, -90], [10, 2], name="ImpedanceSheet", - ... matname="Copper") + ... material="Copper") >>> anistropic_impedance_to_sheet = hfss.assign_impedance_to_sheet(sheet.name, ... "ImpedanceFromSheet", ... [377, 0, 0, 377], @@ -4149,8 +4135,7 @@ def assign_radiation_boundary_to_objects(self, assignment, name=None): Create a box and assign a radiation boundary to it. - >>> radiation_box = hfss.modeler.create_box([0, -200, -200], [200, 200, 200], - ... name="Radiation_box") + >>> radiation_box = hfss.modeler.create_box([0, -200, -200],[200, 200, 200],name="Radiation_box") >>> radiation = hfss.assign_radiation_boundary_to_objects("Radiation_box") >>> type(radiation) @@ -4193,8 +4178,7 @@ def assign_hybrid_region(self, assignment, name=None, hybrid_region="SBR+"): Create a box and assign a hybrid boundary to it. - >>> box = hfss.modeler.create_box([0, -200, -200], [200, 200, 200], - ... name="Radiation_box") + >>> box = hfss.modeler.create_box([0, -200, -200],[200, 200, 200],name="Radiation_box") >>> sbr_box = hfss.assign_hybrid_region("Radiation_box") >>> type(sbr_box) @@ -4237,8 +4221,7 @@ def assign_febi(self, assignment, name=None): Create a box and assign an FE-BI boundary to it. - >>> box = hfss.modeler.create_box([0, -200, -200], [200, 200, 200], - ... name="Radiation_box") + >>> box = hfss.modeler.create_box([0, -200, -200],[200, 200, 200],name="Radiation_box") >>> febi_box = hfss.assign_febi("Radiation_box") >>> type(febi_box) @@ -4281,8 +4264,7 @@ def assign_radiation_boundary_to_faces(self, assignment, name=None): Create a box. Select the faces of this box and assign a radiation boundary to them. - >>> radiation_box = hfss.modeler.create_box([0 , -100, 0], [200, 200, 200], - ... name="RadiationForFaces") + >>> radiation_box = hfss.modeler.create_box([0 , -100, 0],[200, 200, 200],name="RadiationForFaces") >>> ids = [i.id for i in hfss.modeler["RadiationForFaces"].faces] >>> radiation = hfss.assign_radiation_boundary_to_faces(ids) >>> type(radiation) @@ -5542,8 +5524,7 @@ def assign_symmetry(self, assignment, name=None, is_perfect_e=True): Create a box. Select the faces of this box and assign a symmetry. - >>> symmetry_box = hfss.modeler.create_box([0 , -100, 0], [200, 200, 200], - ... name="SymmetryForFaces") + >>> symmetry_box = hfss.modeler.create_box([0 , -100, 0],[200, 200, 200],name="SymmetryForFaces") >>> ids = [i.id for i in hfss.modeler["SymmetryForFaces"].faces] >>> symmetry = hfss.assign_symmetry(ids) >>> type(symmetry) @@ -5594,8 +5575,7 @@ def set_impedance_multiplier(self, multiplier): Create a box. Select the faces of this box and assign a symmetry. - >>> symmetry_box = hfss.modeler.create_box([0 , -100, 0], [200, 200, 200], - ... name="SymmetryForFaces") + >>> symmetry_box = hfss.modeler.create_box([0 , -100, 0],[200, 200, 200],name="SymmetryForFaces") >>> ids = [i.id for i in hfss.modeler["SymmetryForFaces"].faces] >>> symmetry = hfss.assign_symmetry(ids) >>> hfss.set_impedance_multiplier(2.0) @@ -5859,10 +5839,8 @@ def lumped_port( Create two boxes that will be used to create a lumped port named ``'LumpedPort'``. - >>> box1 = hfss.modeler.create_box([0, 0, 50], [10, 10, 5], - ... "BoxLumped1","copper") - >>> box2 = hfss.modeler.create_box([0, 0, 60], [10, 10, 5], - ... "BoxLumped2", "copper") + >>> box1 = hfss.modeler.create_box([0, 0, 50],[10, 10, 5],"BoxLumped1","copper") + >>> box2 = hfss.modeler.create_box([0, 0, 60],[10, 10, 5],"BoxLumped2","copper") >>> hfss.lumped_port("BoxLumped1","BoxLumped2",hfss.AxisDir.XNeg,50,"LumpedPort",True,False) PyAEDT INFO: Connection Correctly created 'LumpedPort' @@ -5997,12 +5975,9 @@ def wave_port( Create a wave port supported by a microstrip line. - >>> ms = hfss.modeler.create_box([4, 5, 0], [1, 100, 0.2], - ... name="MS1", matname="copper") - >>> sub = hfss.modeler.create_box([0, 5, -2], [20, 100, 2], - ... name="SUB1", matname="FR4_epoxy") - >>> gnd = hfss.modeler.create_box([0, 5, -2.2], [20, 100, 0.2], - ... name="GND1", matname="FR4_epoxy") + >>> ms = hfss.modeler.create_box([4, 5, 0],[1, 100, 0.2],name="MS1",material="copper") + >>> sub = hfss.modeler.create_box([0, 5, -2],[20, 100, 2],name="SUB1",material="FR4_epoxy") + >>> gnd = hfss.modeler.create_box([0, 5, -2.2],[20, 100, 0.2],name="GND1",material="FR4_epoxy") >>> port = hfss.wave_port("GND1","MS1",integration_line=1,name="MS1") PyAEDT INFO: Connection correctly created. diff --git a/pyaedt/hfss3dlayout.py b/pyaedt/hfss3dlayout.py index d64ed420e3d..868e93dca61 100644 --- a/pyaedt/hfss3dlayout.py +++ b/pyaedt/hfss3dlayout.py @@ -243,31 +243,31 @@ def create_edge_port( if len(a) > 0: if iswave: self.modeler.change_property( - property_object="Excitations:{}".format(a[0]), - property_name="HFSS Type", - property_value="Wave", - property_tab="EM Design", + assignment="Excitations:{}".format(a[0]), + name="HFSS Type", + value="Wave", + aedt_tab="EM Design", ) self.modeler.change_property( - property_object="Excitations:{}".format(a[0]), - property_name="Horizontal Extent Factor", - property_value=str(wave_horizontal_extension), - property_tab="EM Design", + assignment="Excitations:{}".format(a[0]), + name="Horizontal Extent Factor", + value=str(wave_horizontal_extension), + aedt_tab="EM Design", ) if "Vertical Extent Factor" in list( self.modeler.oeditor.GetProperties("EM Design", "Excitations:{}".format(a[0])) ): self.modeler.change_property( - property_object="Excitations:{}".format(a[0]), - property_name="Vertical Extent Factor", - property_value=str(wave_vertical_extension), - property_tab="EM Design", + assignment="Excitations:{}".format(a[0]), + name="Vertical Extent Factor", + value=str(wave_vertical_extension), + aedt_tab="EM Design", ) self.modeler.change_property( - property_object="Excitations:{}".format(a[0]), - property_name="PEC Launch Width", - property_value=str(wave_launcher), - property_tab="EM Design", + assignment="Excitations:{}".format(a[0]), + name="PEC Launch Width", + value=str(wave_launcher), + aedt_tab="EM Design", ) bound = self._update_port_info(a[0]) if bound: @@ -568,11 +568,7 @@ def create_coax_port(self, vianame, radial_extent=0.1, layer=None, alignment="lo ) self.modeler.change_property("Excitations:{}".format(a[0]), "Layer Alignment", alignment, "EM Design") if layer: - self.modeler.change_property( - a[0], - "Pad Port Layer", - layer, - ) + self.modeler.change_property(a[0], "Pad Port Layer", layer) bound = self._update_port_info(a[0]) if bound: self._boundaries[bound.name] = bound diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 4d5a4c1821a..843f0da26b8 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -424,8 +424,8 @@ def create_source_blocks_from_list(self, list_powers, assign_material=True, defa Create block boundaries from each box in the list. - >>> box1 = icepak.modeler.create_box([1, 1, 1], [3, 3, 3], "BlockBox1", "copper") - >>> box2 = icepak.modeler.create_box([2, 2, 2], [4, 4, 4], "BlockBox2", "copper") + >>> box1 = icepak.modeler.create_box([1, 1, 1],[3, 3, 3],"BlockBox1","copper") + >>> box2 = icepak.modeler.create_box([2, 2, 2],[4, 4, 4],"BlockBox2","copper") >>> blocks = icepak.create_source_blocks_from_list([["BlockBox1", 2], ["BlockBox2", 4]]) PyAEDT INFO: Block on ... >>> blocks[1].props @@ -488,7 +488,7 @@ def create_source_block( Examples -------- - >>> box = icepak.modeler.create_box([5, 5, 5], [1, 2, 3], "BlockBox3", "copper") + >>> box = icepak.modeler.create_box([5, 5, 5],[1, 2, 3],"BlockBox3","copper") >>> block = icepak.create_source_block("BlockBox3", "1W", False) PyAEDT INFO: Block on ... >>> block.props @@ -688,7 +688,7 @@ def create_source_power( Create two source boundaries from one box, one on the top face and one on the bottom face. - >>> box = icepak.modeler.create_box([0, 0, 0], [20, 20, 20], name="SourceBox") + >>> box = icepak.modeler.create_box([0, 0, 0],[20, 20, 20],name="SourceBox") >>> source1 = icepak.create_source_power(box.top_face_z.id, input_power="2W") >>> source1.props["Total Power"] '2W' @@ -781,7 +781,7 @@ def create_network_block( Examples -------- - >>> box = icepak.modeler.create_box([4, 5, 6], [5, 5, 5], "NetworkBox1", "copper") + >>> box = icepak.modeler.create_box([4, 5, 6],[5, 5, 5],"NetworkBox1","copper") >>> block = icepak.create_network_block("NetworkBox1", "2W", 20, 10, 2 , 1.05918) >>> block.props["Nodes"]["Internal"][0] '2W' @@ -881,8 +881,8 @@ def create_network_blocks( Create network boundaries from each box in the list. - >>> box1 = icepak.modeler.create_box([1, 2, 3], [10, 10, 10], "NetworkBox2", "copper") - >>> box2 = icepak.modeler.create_box([4, 5, 6], [5, 5, 5], "NetworkBox3", "copper") + >>> box1 = icepak.modeler.create_box([1, 2, 3],[10, 10, 10],"NetworkBox2","copper") + >>> box2 = icepak.modeler.create_box([4, 5, 6],[5, 5, 5],"NetworkBox3","copper") >>> blocks = icepak.create_network_blocks([["NetworkBox2", 20, 10, 3], ["NetworkBox3", 4, 10, 2]], ... 2, 1.05918, False) >>> blocks[0].props["Nodes"]["Internal"] @@ -947,8 +947,7 @@ def assign_surface_monitor(self, face_name, monitor_type="Temperature", monitor_ Create a rectangle named ``"Surface1"`` and assign a temperature monitor to that surface. - >>> surface = icepak.modeler.create_rectangle(icepak.PLANE.XY, - ... [0, 0, 0], [10, 20], name="Surface1") + >>> surface = icepak.modeler.create_rectangle(icepak.PLANE.XY,[0, 0, 0],[10, 20],name="Surface1") >>> icepak.assign_surface_monitor("Surface1", monitor_name="monitor") 'monitor' """ @@ -1018,7 +1017,7 @@ def assign_point_monitor_in_object(self, name, monitor_type="Temperature", monit Create a box named ``"BlockBox1"`` and assign a temperature monitor point to that object. - >>> box = icepak.modeler.create_box([1, 1, 1], [3, 3, 3], "BlockBox1", "copper") + >>> box = icepak.modeler.create_box([1, 1, 1],[3, 3, 3],"BlockBox1","copper") >>> icepak.assign_point_monitor(box.name, monitor_name="monitor2") "'monitor2' """ @@ -1168,7 +1167,7 @@ def find_top(self, gravityDir): else: return oBoundingBox[gravityDir - 3] - @pyaedt_function_handler() + @pyaedt_function_handler(matname="material") def create_parametric_fin_heat_sink( self, hs_height=100, @@ -1185,7 +1184,7 @@ def create_parametric_fin_heat_sink( symmetric_separation=20, numcolumn_perside=2, vertical_separation=10, - matname="Al-Extruded", + material="Al-Extruded", center=[0, 0, 0], plane_enum=0, rotation=0, @@ -1223,7 +1222,7 @@ def create_parametric_fin_heat_sink( Number of columns per side. The default is ``2``. vertical_separation : optional The default is ``10``. - matname : str, optional + material : str, optional Name of the material. The default is ``Al-Extruded``. center : list, optional List of ``[x, y, z]`` coordinates for the center of @@ -1250,7 +1249,7 @@ def create_parametric_fin_heat_sink( >>> icepak = Icepak() >>> icepak.insert_design("Heat_Sink_Example") >>> icepak.create_parametric_fin_heat_sink(draftangle=1.5, patternangle=8, numcolumn_perside=3, - ... vertical_separation=5.5, matname="Steel", center=[10, 0, 0], + ... vertical_separation=5.5, material="Steel", center=[10, 0, 0], ... plane_enum=icepak.PLANE.XY, rotation=45, tolerance=0.005) """ @@ -1274,12 +1273,12 @@ def create_parametric_fin_heat_sink( symmetric=symmetric, symmetric_separation=symmetric_separation, numcolumn_perside=numcolumn_perside, - matname=matname, + material=material, ) rect.delete() return bool(hs) - @pyaedt_function_handler() + @pyaedt_function_handler(matname="material") def create_parametric_heatsink_on_face( self, top_face, @@ -1295,7 +1294,7 @@ def create_parametric_heatsink_on_face( symmetric=True, symmetric_separation=0.05, numcolumn_perside=2, - matname="Al-Extruded", + material="Al-Extruded", ): """Create a parametric heat sink. @@ -1337,7 +1336,7 @@ def create_parametric_heatsink_on_face( fraction of the ``top_face`` height. The default is ``0.01``. numcolumn_perside : int, optional Number of columns per side. The default is ``2``. - matname : str, optional + material : str, optional Name of the material. The default is ``Al-Extruded``. Returns @@ -1353,9 +1352,9 @@ def create_parametric_heatsink_on_face( >>> from pyaedt import Icepak >>> ipk = Icepak() - >>> box = ipk.modeler.create_box([0,0,0], [1,2,3]) + >>> box = ipk.modeler.create_box([0,0,0],[1,2,3]) >>> top_face=box.top_face_z - >>> ipk.create_parametric_heatsink_on_face(top_face, matname="Al-Extruded") + >>> ipk.create_parametric_heatsink_on_face(top_face, material="Al-Extruded") """ all_obj = self.modeler.object_names center = top_face.center @@ -1429,7 +1428,7 @@ def create_parametric_heatsink_on_face( ["-" + name_map["HSWidth"] + "/2", "-" + name_map["HSHeight"] + "/2", "0"], [name_map["HSWidth"], name_map["HSHeight"], name_map["HSBaseThick"]], generate_unique_name("HSBase"), - matname, + material, ) fin_line = [] fin_line.append(self.Position(0, 0, name_map["HSBaseThick"])) @@ -1507,7 +1506,7 @@ def create_parametric_heatsink_on_face( ) fin_top = self.modeler.create_polyline(fin_line2, cover_surface=True, name=generate_unique_name("Fin_top")) self.modeler.connect([fin_base.name, fin_top.name]) - self.modeler[fin_base.name].material_name = matname + self.modeler[fin_base.name].material_name = material self[name_map["_num"]] = ( "nint((" + name_map["HSWidth"] @@ -3423,8 +3422,8 @@ def create_two_resistor_network_block(self, object_name, pcb, power, rjb, rjc): Examples -------- - >>> board = icepak.modeler.create_box([0, 0, 0], [50, 100, 2], "board", "copper") - >>> box = icepak.modeler.create_box([20, 20, 2], [10, 10, 3], "network_box1", "copper") + >>> board = icepak.modeler.create_box([0, 0, 0],[50, 100, 2],"board","copper") + >>> box = icepak.modeler.create_box([20, 20, 2],[10, 10, 3],"network_box1","copper") >>> network_block = icepak.create_two_resistor_network_block("network_box1", "board", "5W", 2.5, 5) >>> network_block.props["Nodes"]["Internal"][0] '5W' @@ -3445,7 +3444,7 @@ def get_face_normal(obj_face): part_names = sorted( [ pcb_layer - for pcb_layer in self.modeler.get_3d_component_object_list(componentname=pcb) + for pcb_layer in self.modeler.get_3d_component_object_list(name=pcb) if re.search(self.modeler.user_defined_components[pcb].definition_name + r"_\d\d\d.*", pcb_layer) ] ) @@ -4185,7 +4184,7 @@ def assign_source( >>> from pyaedt import Icepak >>> app = Icepak() - >>> box = app.modeler.create_box([0, 0, 0], [20, 20, 20], name="box") + >>> box = app.modeler.create_box([0, 0, 0],[20, 20, 20],name="box") >>> ds = app.create_dataset1d_design("Test_DataSet", [1, 2, 3], [3, 4, 5]) >>> app.solution_type = "Transient" >>> b = app.assign_source("box", "Total Power", assignment_value={"Type": "Temp Dep", @@ -4330,7 +4329,7 @@ def create_resistor_network_from_matrix(self, sources_power, faces_ids, matrix, >>> from pyaedt import Icepak >>> app = Icepak() - >>> box = app.modeler.create_box([0, 0, 0], [20, 50, 80]) + >>> box = app.modeler.create_box([0, 0, 0],[20, 50, 80]) >>> faces_ids = [face.id for face in box.faces][0, 1] >>> sources_power = [3, "4mW"] >>> matrix = [[0, 0, 0, 0], @@ -4413,7 +4412,7 @@ def assign_solid_block( >>> from pyaedt import Icepak >>> ipk = Icepak() >>> ipk.solution_type = "Transient" - >>> box = ipk.modeler.create_box([5, 5, 5], [1, 2, 3], "BlockBox3", "copper") + >>> box = ipk.modeler.create_box([5, 5, 5],[1, 2, 3],"BlockBox3","copper") >>> power_dict = {"Type": "Transient", "Function": "Sinusoidal", "Values": ["0W", 1, 1, "1s"]} >>> block = ipk.assign_solid_block("BlockBox3", power_dict) @@ -4523,7 +4522,7 @@ def assign_hollow_block( >>> from pyaedt import Icepak >>> ipk = Icepak() >>> ipk.solution_type = "Transient" - >>> box = ipk.modeler.create_box([5, 5, 5], [1, 2, 3], "BlockBox5", "copper") + >>> box = ipk.modeler.create_box([5, 5, 5],[1, 2, 3],"BlockBox5","copper") >>> box.solve_inside = False >>> temp_dict = {"Type": "Transient", "Function": "Square Wave", "Values": ["1cel", "0s", "1s", "0.5s", "0cel"]} >>> block = ipk.assign_hollow_block("BlockBox5", "Heat Transfer Coefficient", "1w_per_m2kel", "Test", temp_dict) @@ -5105,7 +5104,7 @@ def assign_adiabatic_plate(self, assignment, high_radiation_dict=None, low_radia -------- >>> from pyaedt import Icepak >>> ipk = Icepak() - >>> box = ipk.modeler.create_box([5, 5, 5], [1, 2, 3], "Box", "copper") + >>> box = ipk.modeler.create_box([5, 5, 5],[1, 2, 3],"Box","copper") >>> ad_plate = ipk.assign_adiabatic_plate(box.top_face_x, None, {"RadiateTo": "AllObjects"}) """ @@ -5559,7 +5558,7 @@ def assign_recirculation_opening(self, face_list, extract_face, thermal_specific >>> from pyaedt import Icepak >>> ipk = Icepak() >>> ipk.solution_type = "Transient" - >>> box = ipk.modeler.create_box([5, 5, 5], [1, 2, 3], "BlockBoxEmpty", "copper") + >>> box = ipk.modeler.create_box([5, 5, 5],[1, 2, 3],"BlockBoxEmpty","copper") >>> box.solve_inside = False >>> recirc = ipk.assign_recirculation_opening([box.top_face_x, box.bottom_face_x], box.top_face_x, >>> flow_assignment="10kg_per_s_m2") @@ -5700,7 +5699,7 @@ def assign_blower_type1(self, faces, inlet_face, fan_curve_pressure, fan_curve_f -------- >>> from pyaedt import Icepak >>> ipk = Icepak() - >>> cylinder = self.aedtapp.modeler.create_cylinder(cs_axis="X", position=[0,0,0], radius=10, height=1) + >>> cylinder = self.aedtapp.modeler.create_cylinder(orientation="X",origin=[0,0,0],radius=10,height=1) >>> curved_face = [f for f in cylinder.faces if not f.is_planar] >>> planar_faces = [f for f in cylinder.faces if f.is_planar] >>> cylinder.solve_inside=False @@ -5765,7 +5764,7 @@ def assign_blower_type2(self, faces, inlet_face, fan_curve_pressure, fan_curve_f -------- >>> from pyaedt import Icepak >>> ipk = Icepak() - >>> box = ipk.modeler.create_box([5, 5, 5], [1, 2, 3], "BlockBoxEmpty", "copper") + >>> box = ipk.modeler.create_box([5, 5, 5],[1, 2, 3],"BlockBoxEmpty","copper") >>> box.solve_inside=False >>> blower = self.aedtapp.assign_blower_type2([box.faces[0], box.faces[1]], >>> [box.faces[0]], [10, 5, 0], [0, 2, 4]) diff --git a/pyaedt/maxwell.py b/pyaedt/maxwell.py index b75b1714525..2489fd112f0 100644 --- a/pyaedt/maxwell.py +++ b/pyaedt/maxwell.py @@ -692,7 +692,7 @@ def assign_current(self, assignment, amplitude=1, phase="0deg", solid=True, swap >>> from pyaedt import Maxwell3d >>> m3d = Maxwell3d(solution_type="ElectroDCConduction") - >>> cylinder= m3d.modeler.create_cylinder("X", [0,0,0],10, 100, 250) + >>> cylinder= m3d.modeler.create_cylinder("X",[0,0,0],10,100,250) >>> current = m3d.assign_current(cylinder.top_face_x.id,amplitude="2mA") >>> m3d.release_desktop(True, True) """ @@ -1249,16 +1249,16 @@ def assign_force(self, assignment, coordinate_system="Global", is_virtual=True, >>> from pyaedt import Maxwell3d >>> m3d = Maxwell3d() - >>> iron_object = m3d.modeler.create_box([0, 0, 0], [2, 10, 10], name="iron") - >>> magnet_object = m3d.modeler.create_box([10, 0, 0], [2, 10, 10], name="magnet") + >>> iron_object = m3d.modeler.create_box([0, 0, 0],[2, 10, 10],name="iron") + >>> magnet_object = m3d.modeler.create_box([10, 0, 0],[2, 10, 10],name="magnet") >>> m3d.assign_material(iron_object, "iron") >>> m3d.assign_material(magnet_object, "NdFe30") >>> m3d.assign_force("iron",is_virtual=True,force_name="force_iron") Assign Lorentz force to a conductor: - >>> conductor1 = m3d.modeler.create_box([0, 0, 0], [1, 1, 10], name="conductor1") - >>> conductor2 = m3d.modeler.create_box([10, 0, 0], [1, 1, 10], name="conductor2") + >>> conductor1 = m3d.modeler.create_box([0, 0, 0],[1, 1, 10],name="conductor1") + >>> conductor2 = m3d.modeler.create_box([10, 0, 0],[1, 1, 10],name="conductor2") >>> m3d.assign_material(conductor1, "copper") >>> m3d.assign_material(conductor2, "copper") >>> m3d.assign_force("conductor1",is_virtual=False,force_name="force_copper") # conductor, use Lorentz force @@ -1674,8 +1674,8 @@ def assign_radiation(self, assignment, radiation=None): >>> from pyaedt import Maxwell3d >>> m3d = Maxwell3d() - >>> box1 = m3d.modeler.create_box([0, 0, 0], [2, 10, 10]) - >>> box2 = m3d.modeler.create_box([10, 0, 0], [2, 10, 10]) + >>> box1 = m3d.modeler.create_box([0, 0, 0],[2, 10, 10]) + >>> box2 = m3d.modeler.create_box([10, 0, 0],[2, 10, 10]) >>> m3d.assign_radiation([box1, box2.faces[0]]) >>> m3d.release_desktop(True, True) """ @@ -2170,7 +2170,7 @@ def assign_insulating(self, assignment, insulation=None): >>> from pyaedt import Maxwell3d >>> m3d = Maxwell3d() - >>> insulated_box = m3d.modeler.create_box([50, 0, 50], [294, 294, 19], name="InsulatedBox") + >>> insulated_box = m3d.modeler.create_box([50, 0, 50],[294, 294, 19],name="InsulatedBox") >>> insulating_assignment = m3d.assign_insulating(assignment=insulated_box,insulation="InsulatingExample") >>> m3d.release_desktop(True, True) """ @@ -2249,7 +2249,7 @@ def assign_impedance( >>> from pyaedt import Maxwell3d >>> m3d = Maxwell3d() - >>> shield = m3d.modeler.create_box([-50, -50, -50], [294, 294, 19], name="shield") + >>> shield = m3d.modeler.create_box([-50, -50, -50],[294, 294, 19],name="shield") >>> shield_faces = m3d.modeler.select_allfaces_fromobjects(["shield"]) >>> impedance_assignment = m3d.assign_impedance(assignment=shield_faces,impedance="ShieldImpedance") >>> m3d.release_desktop(True, True) @@ -2540,7 +2540,7 @@ def assign_flux_tangential(self, assignment, flux_name=None): >>> from pyaedt import Maxwell3d >>> m3d = Maxwell3d() - >>> box = m3d.modeler.create_box([50, 0, 50], [294, 294, 19], name="Box") + >>> box = m3d.modeler.create_box([50, 0, 50],[294, 294, 19],name="Box") >>> flux_tangential = m3d.assign_flux_tangential(box.faces[0],"FluxExample") >>> m3d.release_desktop(True, True) """ diff --git a/pyaedt/modeler/advanced_cad/parts.py b/pyaedt/modeler/advanced_cad/parts.py index 526a811eb78..87f5cbf0dd5 100644 --- a/pyaedt/modeler/advanced_cad/parts.py +++ b/pyaedt/modeler/advanced_cad/parts.py @@ -412,10 +412,10 @@ def insert(self, app): # TODO: Why the inconsistent syntax for cs commands? if self._do_offset: self.set_relative_cs(app) # Create coordinate system, if needed. - comp_obj = app.modeler.insert_3d_component(self.file_name, targetCS=self.cs_name) + comp_obj = app.modeler.insert_3d_component(self.file_name, coordinate_system=self.cs_name) aedt_objects.append(comp_obj.name) else: - comp_obj = app.modeler.insert_3d_component(self.file_name, targetCS=self._multiparts.cs_name) + comp_obj = app.modeler.insert_3d_component(self.file_name, coordinate_system=self._multiparts.cs_name) aedt_objects.append(comp_obj.name) if self._do_rotate: self.do_rotate(app, aedt_objects[0]) diff --git a/pyaedt/modeler/advanced_cad/stackup_3d.py b/pyaedt/modeler/advanced_cad/stackup_3d.py index f84d0e2711e..c4b18125f11 100644 --- a/pyaedt/modeler/advanced_cad/stackup_3d.py +++ b/pyaedt/modeler/advanced_cad/stackup_3d.py @@ -311,8 +311,7 @@ class Layer3D(object): >>> from pyaedt.modeler.advanced_cad.stackup_3d import Stackup3D >>> hfss = Hfss() >>> my_stackup = Stackup3D(hfss, 2.5e9) - >>> my_layer = my_stackup.add_layer("my_layer", layer_type="D", material_name="air", - >>> thickness=3, fill_material=None) + >>> my_layer = my_stackup.add_layer("my_layer") >>> gnd = my_stackup.add_ground_layer("gnd") >>> diel = my_stackup.add_dielectric_layer("diel1", thickness=1.5, material="Duroid (tm)") >>> top = my_stackup.add_signal_layer("top") @@ -366,7 +365,7 @@ def __init__( ["dielectric_x_position", "dielectric_y_position", layer_position], ["dielectric_length", "dielectric_width", self._thickness_variable], name=self._name, - matname=self.material_name, + material=self.material_name, ) elif self._layer_type == "ground": if thickness: @@ -374,7 +373,7 @@ def __init__( ["dielectric_x_position", "dielectric_y_position", layer_position], ["dielectric_length", "dielectric_width", self._thickness_variable], name=self._name, - matname=self.material_name, + material=self.material_name, ) else: @@ -391,7 +390,7 @@ def __init__( ["dielectric_x_position", "dielectric_y_position", layer_position], ["dielectric_length", "dielectric_width", self._thickness_variable], name=self._name, - matname=self._fill_material.name, + material=self._fill_material.name, ) else: obj_3d = self._app.modeler.create_rectangle( @@ -1176,9 +1175,9 @@ def add_via(self, position_x=0, position_y=0, instance_name=None, reference_syst [position_x, position_y, v._layer_elevation.name], v._pad_radius, v._layer_thickness.name, - matname=self._padstacks_material, + num_sides=self._num_sides, name=instance_name, - numSides=self._num_sides, + material=self._padstacks_material, ) ) if self.plating_ratio < 1: @@ -1187,9 +1186,9 @@ def add_via(self, position_x=0, position_y=0, instance_name=None, reference_syst [position_x, position_y, v._layer_elevation.name], "{}*{}".format(self._app.modeler._arg_with_dim(v._pad_radius), 1 - self.plating_ratio), v._layer_thickness.name, - matname=self._padstacks_material, + num_sides=self._num_sides, name=instance_name, - numSides=self._num_sides, + material=self._padstacks_material, ) cyls[-1].subtract(hole, False) if v._antipad_radius > 0: @@ -1198,9 +1197,9 @@ def add_via(self, position_x=0, position_y=0, instance_name=None, reference_syst [position_x, position_y, v._layer_elevation.name], v._antipad_radius, v._layer_thickness.name, - matname="air", + num_sides=self._num_sides, name=instance_name + "_antipad", - numSides=self._num_sides, + material="air", ) self._app.modeler.subtract( self._stackup._signal_list + self._stackup._ground_list + self._stackup._dielectric_list, @@ -1553,8 +1552,7 @@ def add_layer( >>> from pyaedt.modeler.stackup_3d import Stackup3D >>> hfss = Hfss() >>> my_stackup = Stackup3D(hfss, 2.5e9) - >>> my_layer = my_stackup.add_layer("my_layer", layer_type="D", material_name="air", - >>> thickness=3, fill_material=None) + >>> my_layer = my_stackup.add_layer("my_layer") """ self._shifted_index += 1 @@ -1995,7 +1993,7 @@ class Patch(CommonObject, object): >>> patch = signal.add_patch(patch_length=9.57, patch_width=9.25, patch_name="Patch") >>> stackup.resize_around_element(patch) >>> pad_length = [3, 3, 3, 3, 3, 3] # Air bounding box buffer in mm. - >>> region = hfss.modeler.create_region(pad_length, is_percentage=False) + >>> region = hfss.modeler.create_region(pad_length,is_percentage=False) >>> hfss.assign_radiation_boundary_to_objects(region) >>> patch.create_probe_port(gnd, rel_x_offset=0.485) @@ -2095,21 +2093,21 @@ def __init__( self._reference_system = patch_name + "_CS" if signal_layer.thickness: self._aedt_object = application.modeler.create_box( - position=start_point, - dimensions_list=[ + origin=start_point, + sizes=[ "{}_length".format(patch_name), "{}_width".format(patch_name), signal_layer.thickness.name, ], name=patch_name, - matname=signal_layer.material_name, + material=signal_layer.material_name, ) else: self._aedt_object = application.modeler.create_rectangle( - position=start_point, - dimension_list=[self.length.name, self.width.name], + origin=start_point, + sizes=[self.length.name, self.width.name], name=patch_name, - matname=signal_layer.material_name, + material=signal_layer.material_name, ) application.assign_coating(self._aedt_object.name, signal_layer.material) application.modeler.set_working_coordinate_system("Global") @@ -2426,18 +2424,23 @@ def create_probe_port(self, reference_layer, rel_x_offset=0, rel_y_offset=0, r=0 z_ref = reference_layer.elevation.name + " + " + reference_layer.thickness.name probe_pos = [x_probe, y_probe, z_ref] # Probe base position. probe_wire = self.application.modeler.create_cylinder( - cs_axis="Z", position=probe_pos, radius=r, height=probe_height, name=name, matname="copper" + orientation="Z", origin=probe_pos, radius=r, height=probe_height, name=name, material="copper" ) probe_feed_wire = self.application.modeler.create_cylinder( - cs_axis="Z", position=probe_pos, radius=r, height=-feed_length, name=name + "_feed_wire", matname="copper" + orientation="Z", + origin=probe_pos, + radius=r, + height=-feed_length, + name=name + "_feed_wire", + material="copper", ) probe_feed_outer = self.application.modeler.create_cylinder( - cs_axis="Z", - position=probe_pos, + orientation="Z", + origin=probe_pos, radius=probe_or, height=-feed_length, name=name + "_feed_outer", - matname="vacuum", + material="vacuum", ) # Probe extends through the ground plane. @@ -2502,11 +2505,11 @@ def create_lumped_port(self, reference_layer, opposite_side=False, port_name=Non + reference_layer.elevation.name ) rect = self.application.modeler.create_rectangle( - csPlane=constants.PLANE.YZ, - position=[string_position_x, string_position_y, string_position_z], - dimension_list=[string_width, string_length], + orientation=constants.PLANE.YZ, + origin=[string_position_x, string_position_y, string_position_z], + sizes=[string_width, string_length], name=self.name + "_port", - matname=None, + material=None, ) if self.application.solution_type == "Modal": if axisdir is None: @@ -2764,21 +2767,21 @@ def __init__( self._reference_system = line_name + "_CS" if signal_layer.thickness: self._aedt_object = application.modeler.create_box( - position=start_point, - dimensions_list=[ + origin=start_point, + sizes=[ "{}_length".format(self._name), self.width.name, signal_layer.thickness.name, ], name=line_name, - matname=signal_layer.material_name, + material=signal_layer.material_name, ) else: self._aedt_object = application.modeler.create_rectangle( - position=start_point, - dimension_list=["{}_length".format(self._name), self.width.name], + oring=start_point, + sizes=["{}_length".format(self._name), self.width.name], name=line_name, - matname=signal_layer.material_name, + material=signal_layer.material_name, ) application.modeler.set_working_coordinate_system("Global") application.modeler.subtract(blank_list=[signal_layer.name], tool_list=[line_name], keep_originals=True) @@ -3242,11 +3245,11 @@ def create_lumped_port(self, reference_layer, opposite_side=False, port_name=Non + reference_layer.elevation.name ) port = self.application.modeler.create_rectangle( - csPlane=constants.PLANE.YZ, - position=[string_position_x, string_position_y, string_position_z], - dimension_list=[string_width, string_length], + orientation=constants.PLANE.YZ, + origin=[string_position_x, string_position_y, string_position_z], + sizes=[string_width, string_length], name=self.name + "_port", - matname=None, + material=None, ) if self.application.solution_type == "Modal": if axisdir is None: @@ -3342,7 +3345,7 @@ def __init__( self._reference_system = poly_name + "_CS" self._aedt_object = application.modeler.create_polyline( - position_list=pts, name=poly_name, matname=mat_name, cover_surface=True + points=pts, cover_surface=True, name=poly_name, material=mat_name ) if self._thickness: application.modeler.sweep_along_vector( diff --git a/pyaedt/modeler/cad/Modeler.py b/pyaedt/modeler/cad/Modeler.py index f346c2342b3..be58a4ab7c6 100644 --- a/pyaedt/modeler/cad/Modeler.py +++ b/pyaedt/modeler/cad/Modeler.py @@ -338,13 +338,13 @@ def _change_property(self, name, arg): arguments = ["NAME:AllTabs", ["NAME:Geometry3DCSTab", ["NAME:PropServers", name], arg]] self._modeler.oeditor.ChangeProperty(arguments) - @pyaedt_function_handler() - def rename(self, newname): + @pyaedt_function_handler(newname="name") + def rename(self, name): """Rename the coordinate system. Parameters ---------- - newname : str + name : str New name for the coordinate system. Returns @@ -353,8 +353,8 @@ def rename(self, newname): ``True`` when successful, ``False`` when failed. """ - self._change_property(self.name, ["NAME:ChangedProps", ["NAME:Name", "Value:=", newname]]) - self.name = newname + self._change_property(self.name, ["NAME:ChangedProps", ["NAME:Name", "Value:=", name]]) + self.name = name return True @pyaedt_function_handler() @@ -454,9 +454,9 @@ def _attributes(self): coordinateSystemAttributes = ["NAME:Attributes", "Name:=", self.name, "PartName:=", self._part_name] return coordinateSystemAttributes - @pyaedt_function_handler() + @pyaedt_function_handler(face="assignment") def create( - self, face, origin, axis_position, axis="X", name=None, offset=None, rotation=0, always_move_to_end=True + self, assignment, origin, axis_position, axis="X", name=None, offset=None, rotation=0, always_move_to_end=True ): """Create a face coordinate system. The face coordinate has always the Z axis parallel to face normal. @@ -464,7 +464,7 @@ def create( Parameters ---------- - face : int, FacePrimitive + assignment : int, FacePrimitive Face where the coordinate system is defined. origin : int, FacePrimitive, EdgePrimitive, VertexPrimitive Specify the coordinate system origin. The origin must belong to the face where the @@ -503,7 +503,7 @@ def create( """ - face_id = self._modeler.convert_to_selections(face, True)[0] + face_id = self._modeler.convert_to_selections(assignment, True)[0] if not isinstance(face_id, int): # pragma: no cover raise ValueError("Unable to find reference face.") else: @@ -1294,10 +1294,10 @@ def _attributes(self): coordinateSystemAttributes = ["NAME:Attributes", "Name:=", self.name, "PartName:=", self._part_name] return coordinateSystemAttributes - @pyaedt_function_handler() + @pyaedt_function_handler(obj="assignment") def create( self, - obj, + assignment, origin, x_axis, y_axis, @@ -1309,7 +1309,7 @@ def create( Parameters ---------- - obj : str, :class:`pyaedt.modeler.cad.object3d.Object3d` + assignment : str, :class:`pyaedt.modeler.cad.object3d.Object3d` Object to attach the object coordinate system to. origin : int, VertexPrimitive, EdgePrimitive, FacePrimitive, list Origin where the object coordinate system is anchored. @@ -1351,10 +1351,10 @@ def create( ``True`` when successful, ``False`` when failed. """ - if isinstance(obj, str): - self.entity_id = self._modeler.objects_by_name[obj].id - elif isinstance(obj, Object3d): - self.entity_id = obj.id + if isinstance(assignment, str): + self.entity_id = self._modeler.objects_by_name[assignment].id + elif isinstance(assignment, Object3d): + self.entity_id = assignment.id else: raise ValueError("Object provided is invalid.") @@ -1711,23 +1711,23 @@ def update(self): return True - @pyaedt_function_handler() + @pyaedt_function_handler(object_list="assignment", type="entity_type") def create( self, - object_list, + assignment, name=None, - type="Object", + entity_type="Object", ): """Create a List. Parameters ---------- - object_list : list + assignment : list List of ``["Obj1", "Obj2"]`` objects or face ID if type is "Face". The default is ``None``, in which case all objects are selected. name : list, str List of names. The default is ``None``. - type : str, optional + entity_type : str, optional List type. Options are ``"Object"``, ``"Face"``. The default is ``"Object"``. Returns @@ -1738,24 +1738,24 @@ def create( """ if not name: - name = generate_unique_name(type + "List") + name = generate_unique_name(entity_type + "List") - object_list_new = self._list_verification(object_list, type) + object_list_new = self._list_verification(assignment, entity_type) if object_list_new: olist = object_list_new - if type == "Object": + if entity_type == "Object": olist = ",".join(object_list_new) self.name = self._modeler.oeditor.CreateEntityList( - ["NAME:GeometryEntityListParameters", "EntityType:=", type, "EntityList:=", olist], + ["NAME:GeometryEntityListParameters", "EntityType:=", entity_type, "EntityList:=", olist], ["NAME:Attributes", "Name:=", name], ) props = {} props["List"] = object_list_new props["ID"] = self._modeler.get_entitylist_id(self.name) - props["Type"] = type + props["Type"] = entity_type self.props = ListsProps(self, props) self._modeler.user_lists.append(self) @@ -1777,13 +1777,13 @@ def delete(self): self._modeler.user_lists.remove(self) return True - @pyaedt_function_handler() - def rename(self, newname): + @pyaedt_function_handler(newname="name") + def rename(self, name): """Rename the List. Parameters ---------- - newname : str + name : str New name for the List. Returns @@ -1797,11 +1797,11 @@ def rename(self, newname): [ "NAME:Geometry3DListTab", ["NAME:PropServers", self.name], - ["NAME:ChangedProps", ["NAME:Name", "Value:=", newname]], + ["NAME:ChangedProps", ["NAME:Name", "Value:=", name]], ], ] self._modeler.oeditor.ChangeProperty(argument) - self.name = newname + self.name = name return True def _list_verification(self, object_list, list_type): diff --git a/pyaedt/modeler/cad/Primitives.py b/pyaedt/modeler/cad/Primitives.py index b4bfdf71cff..0198c07c3ab 100644 --- a/pyaedt/modeler/cad/Primitives.py +++ b/pyaedt/modeler/cad/Primitives.py @@ -1009,7 +1009,7 @@ def add_new_solids(self): for obj_name in self.object_names: if obj_name not in self._object_names_to_ids: try: - pid = self.oeditor.GetObjectIDByName(obj) + pid = self.oeditor.GetObjectIDByName(obj_name) except Exception: pid = 0 self._create_object(obj_name, pid=pid, use_cached=True) @@ -1017,7 +1017,7 @@ def add_new_solids(self): for obj_name in self.unclassified_names: if obj_name not in self._object_names_to_ids: try: - pid = self.oeditor.GetObjectIDByName(obj) + pid = self.oeditor.GetObjectIDByName(obj_name) except Exception: pid = 0 self._create_object(obj_name, pid=pid, use_cached=True) @@ -1074,13 +1074,13 @@ def refresh_all_ids(self): return len(self.objects) - @pyaedt_function_handler() - def get_objects_by_material(self, materialname=None): + @pyaedt_function_handler(materialname="material") + def get_objects_by_material(self, material=None): """Get a list of objects either of a specified material or classified by material. Parameters ---------- - materialname : str + material : str Name of the material. The default is ``None``. Returns @@ -1100,7 +1100,7 @@ def get_objects_by_material(self, materialname=None): """ obj_lst = [] - if materialname is not None: + if material is not None: for obj in self.object_list: if obj and ("[" in obj.material_name or "(" in obj.material_name) and obj.object_type == "Solid": material = ( @@ -1109,9 +1109,9 @@ def get_objects_by_material(self, materialname=None): .GetPropEvaluatedValue("Material") .lower() ) - if materialname.lower() == material: + if material.lower() == material: obj_lst.append(obj) - elif obj and (obj.material_name == materialname or obj.material_name == materialname.lower()): + elif obj and (obj.material_name == material or obj.material_name == material.lower()): obj_lst.append(obj) else: obj_lst = [ @@ -1345,13 +1345,13 @@ def _find_perpendicular_points(self, face): return False, (origin, a_end, b_end) return True, (origin, a_end, b_end) - @pyaedt_function_handler() - def cover_lines(self, selection): + @pyaedt_function_handler(selection="assignment") + def cover_lines(self, assignment): """Cover closed lines and transform them to a sheet. Parameters ---------- - selection : str, int + assignment : str, int Polyline object to cover. Returns @@ -1364,17 +1364,17 @@ def cover_lines(self, selection): >>> oEditor.CoverLines """ - obj_to_cover = self.convert_to_selections(selection, False) + obj_to_cover = self.convert_to_selections(assignment, False) self.oeditor.CoverLines(["NAME:Selections", "Selections:=", obj_to_cover, "NewPartsModelFlag:=", "Model"]) return True - @pyaedt_function_handler() - def cover_faces(self, selection): + @pyaedt_function_handler(selection="assignment") + def cover_faces(self, assignment): """Cover a face. Parameters ---------- - selection : str, int + assignment : str, int Sheet object to cover. Returns ------- @@ -1386,7 +1386,7 @@ def cover_faces(self, selection): >>> oEditor.CoverLines """ - obj_to_cover = self.convert_to_selections(selection, False) + obj_to_cover = self.convert_to_selections(assignment, False) self.oeditor.CoverSurfaces(["NAME:Selections", "Selections:=", obj_to_cover, "NewPartsModelFlag:=", "Model"]) return True @@ -1561,7 +1561,7 @@ def create_face_coordinate_system( cs = FaceCoordinateSystem(self) if cs: result = cs.create( - face=face, + assignment=face, origin=origin, axis_position=axis_position, axis=axis, @@ -1575,15 +1575,23 @@ def create_face_coordinate_system( return cs return False - @pyaedt_function_handler() + @pyaedt_function_handler(obj="assignment") def create_object_coordinate_system( - self, obj, origin, x_axis, y_axis, move_to_end=True, reverse_x_axis=False, reverse_y_axis=False, name=None + self, + assignment, + origin, + x_axis, + y_axis, + move_to_end=True, + reverse_x_axis=False, + reverse_y_axis=False, + name=None, ): """Create an object coordinate system. Parameters ---------- - obj : str, :class:`pyaedt.modeler.cad.object3d.Object3d` + assignment : str, :class:`pyaedt.modeler.cad.object3d.Object3d` Object to attach the object coordinate system to. origin : int, VertexPrimitive, EdgePrimitive, FacePrimitive, list Refer to the origin where the object coordinate system is anchored. @@ -1635,7 +1643,7 @@ def create_object_coordinate_system( cs = ObjectCoordinateSystem(self, name=name) if cs: result = cs.create( - obj=obj, + assignment=assignment, origin=origin, x_axis=x_axis, y_axis=y_axis, @@ -1648,15 +1656,15 @@ def create_object_coordinate_system( return cs return False - @pyaedt_function_handler() - def global_to_cs(self, point, ref_cs): + @pyaedt_function_handler(ref_cs="coordinate_system") + def global_to_cs(self, point, coordinate_system): """Transform a point from the global coordinate system to another coordinate system. Parameters ---------- point : list List of the ``[x, y, z]`` coordinates to transform. - ref_cs : str, CoordinateSystem + coordinate_system : str, CoordinateSystem Name of the destination reference system. The ``CoordinateSystem`` object can also be used. @@ -1672,10 +1680,10 @@ def global_to_cs(self, point, ref_cs): point = [float(i) for i in point] except Exception: raise AttributeError("Point must be in format [x, y, z].") - if isinstance(ref_cs, BaseCoordinateSystem): - ref_cs_name = ref_cs.name - elif isinstance(ref_cs, str): - ref_cs_name = ref_cs + if isinstance(coordinate_system, BaseCoordinateSystem): + ref_cs_name = coordinate_system.name + elif isinstance(coordinate_system, str): + ref_cs_name = coordinate_system else: raise AttributeError("ref_cs must be either a string or a CoordinateSystem object.") if ref_cs_name == "Global": @@ -1905,7 +1913,7 @@ def duplicate_coordinate_system_to_global(self, coordinate_system): axis_position = [v for v in edge.vertices if v.id == face_cs.props["AxisPosn"]["EntityID"]][0] if face_cs: result = face_cs.create( - face=face, + assignment=face, origin=origin, axis_position=axis_position, axis=face_cs.props["WhichAxis"], @@ -1977,7 +1985,7 @@ def duplicate_coordinate_system_to_global(self, coordinate_system): ] if obj_cs: result = obj_cs.create( - obj=obj, + assignment=obj, origin=origin, x_axis=x_axis, y_axis=y_axis, @@ -1989,13 +1997,13 @@ def duplicate_coordinate_system_to_global(self, coordinate_system): return obj_cs return False - @pyaedt_function_handler() - def set_objects_deformation(self, objects): + @pyaedt_function_handler(objects="assignment") + def set_objects_deformation(self, assignment): """Assign deformation objects to a Workbench link. Parameters ---------- - objects : list + assignment : list List of the deformation objects to assign to the Workbench link. Returns @@ -2010,7 +2018,7 @@ def set_objects_deformation(self, objects): """ self.logger.info("Enabling deformation feedback") try: - self._odesign.SetObjectDeformation(["EnabledObjects:=", objects]) + self._odesign.SetObjectDeformation(["EnabledObjects:=", assignment]) except Exception: self.logger.error("Failed to enable the deformation dependence") return False @@ -2018,17 +2026,17 @@ def set_objects_deformation(self, objects): self.logger.info("Successfully enabled deformation feedback") return True - @pyaedt_function_handler() - def set_objects_temperature(self, objects, ambient_temp=22, create_project_var=False): + @pyaedt_function_handler(objects="assignment", ambient_temp="ambient_temperature") + def set_objects_temperature(self, assignment, ambient_temperature=22, create_project_var=False): """Assign temperatures to objects. The materials assigned to the objects must have a thermal modifier. Parameters ---------- - objects : list + assignment : list List of objects. - ambient_temp : float, optional + ambient_temperature : float, optional Ambient temperature. The default is ``22``. create_project_var : bool, optional Whether to create a project variable for the ambient temperature. @@ -2046,10 +2054,10 @@ def set_objects_temperature(self, objects, ambient_temp=22, create_project_var=F """ self.logger.info("Set model temperature and enabling Thermal Feedback") if create_project_var: - self._app.variable_manager["$AmbientTemp"] = str(ambient_temp) + "cel" + self._app.variable_manager["$AmbientTemp"] = str(ambient_temperature) + "cel" var = "$AmbientTemp" else: - var = str(ambient_temp) + "cel" + var = str(ambient_temperature) + "cel" vargs1 = [ "NAME:TemperatureSettings", "IncludeTemperatureDependence:=", @@ -2059,7 +2067,7 @@ def set_objects_temperature(self, objects, ambient_temp=22, create_project_var=F "Temperatures:=", ] vargs2 = [] - for obj in objects: + for obj in assignment: mat = self[obj].material_name th = self._app.materials.check_thermal_modifier(mat) if th: @@ -2121,15 +2129,18 @@ def _create_sheet_from_object_closest_edge(self, startobj, endobject, axisdir, p self.connect(port_edges) return sheet_name, point0, point1 - @pyaedt_function_handler() - def find_point_around(self, objectname, startposition, offset, plane): + @pyaedt_function_handler( + objectname="assignment", + startposition="origin", + ) + def find_point_around(self, assignment, origin, offset, plane): """Find the point around an object. Parameters ---------- - objectname : str + assignment : str Name of the object. - startposition : list + origin : list List of the ``[x, y, z]`` coordinates for the starting position of the object. offset : @@ -2149,32 +2160,32 @@ def find_point_around(self, objectname, startposition, offset, plane): angle = 0 if plane == 0: while angle <= 360: - position[0] = startposition[0] + offset * math.cos(math.pi * angle / 180) - position[1] = startposition[1] + offset * math.sin(math.pi * angle / 180) - if objectname in self.get_bodynames_from_position(startposition): + position[0] = origin[0] + offset * math.cos(math.pi * angle / 180) + position[1] = origin[1] + offset * math.sin(math.pi * angle / 180) + if assignment in self.get_bodynames_from_position(origin): angle = 400 else: angle += 90 elif plane == 1: while angle <= 360: - position[1] = startposition[1] + offset * math.cos(math.pi * angle / 180) - position[2] = startposition[2] + offset * math.sin(math.pi * angle / 180) - if objectname in self.get_bodynames_from_position(startposition): + position[1] = origin[1] + offset * math.cos(math.pi * angle / 180) + position[2] = origin[2] + offset * math.sin(math.pi * angle / 180) + if assignment in self.get_bodynames_from_position(origin): angle = 400 else: angle += 90 elif plane == 2: while angle <= 360: - position[0] = startposition[0] + offset * math.cos(math.pi * angle / 180) - position[2] = startposition[2] + offset * math.sin(math.pi * angle / 180) - if objectname in self.get_bodynames_from_position(startposition): + position[0] = origin[0] + offset * math.cos(math.pi * angle / 180) + position[2] = origin[2] + offset * math.sin(math.pi * angle / 180) + if assignment in self.get_bodynames_from_position(origin): angle = 400 else: angle += 90 return position - @pyaedt_function_handler() - def create_sheet_to_ground(self, objectname, groundname=None, axisdir=0, sheet_dim=1): + @pyaedt_function_handler(objectname="assignment", groundname="ground_name", axisdir="orientation") + def create_sheet_to_ground(self, assignment, ground_name=None, orientation=0, sheet_dim=1): """Create a sheet between an object and a ground plane. The ground plane must be bigger than the object and perpendicular @@ -2182,12 +2193,12 @@ def create_sheet_to_ground(self, objectname, groundname=None, axisdir=0, sheet_d Parameters ---------- - objectname : str + assignment : str Name of the object. - groundname : str, optional + ground_name : str, optional Name of the ground. The default is ``None``, in which case the bounding box is used. - axisdir : int, optional + orientation : int, optional Axis direction. Options are ``0`` through ``5``. The default is ``0``. sheet_dim : optional Sheet dimension in millimeters. The default is ``1``. @@ -2202,36 +2213,36 @@ def create_sheet_to_ground(self, objectname, groundname=None, axisdir=0, sheet_d >>> oEditor.CreatePolyline """ - if axisdir > 2: + if orientation > 2: obj_cent = [-1e6, -1e6, -1e6] else: obj_cent = [1e6, 1e6, 1e6] face_ob = None - for face in self[objectname].faces: + for face in self[assignment].faces: center = face.center if not center: continue - if axisdir > 2 and center[axisdir - 3] > obj_cent[axisdir - 3]: + if orientation > 2 and center[orientation - 3] > obj_cent[orientation - 3]: obj_cent = center face_ob = face - elif axisdir <= 2 and center[axisdir] < obj_cent[axisdir]: + elif orientation <= 2 and center[orientation] < obj_cent[orientation]: obj_cent = center face_ob = face vertex = face_ob.vertices start = vertex[0].position - if not groundname: + if not ground_name: gnd_cent = [] bounding = self.get_model_bounding_box() - if axisdir < 3: + if orientation < 3: for i in bounding[0:3]: gnd_cent.append(float(i)) else: for i in bounding[3:]: gnd_cent.append(float(i)) else: - ground_plate = self[groundname] - if axisdir > 2: + ground_plate = self[ground_name] + if orientation > 2: gnd_cent = [1e6, 1e6, 1e6] else: gnd_cent = [-1e6, -1e6, -1e6] @@ -2240,26 +2251,26 @@ def create_sheet_to_ground(self, objectname, groundname=None, axisdir=0, sheet_d center = face.center if not center: continue - if axisdir > 2 and center[axisdir - 3] < gnd_cent[axisdir - 3]: + if orientation > 2 and center[orientation - 3] < gnd_cent[orientation - 3]: gnd_cent = center - elif axisdir <= 2 and center[axisdir] > gnd_cent[axisdir]: + elif orientation <= 2 and center[orientation] > gnd_cent[orientation]: gnd_cent = center - axisdist = obj_cent[divmod(axisdir, 3)[1]] - gnd_cent[divmod(axisdir, 3)[1]] - if axisdir < 3: + axisdist = obj_cent[divmod(orientation, 3)[1]] - gnd_cent[divmod(orientation, 3)[1]] + if orientation < 3: axisdist = -axisdist - if divmod(axisdir, 3)[1] == 0: + if divmod(orientation, 3)[1] == 0: cs = self._app.PLANE.YZ vector = [axisdist, 0, 0] - elif divmod(axisdir, 3)[1] == 1: + elif divmod(orientation, 3)[1] == 1: cs = self._app.PLANE.ZX vector = [0, axisdist, 0] - elif divmod(axisdir, 3)[1] == 2: + elif divmod(orientation, 3)[1] == 2: cs = self._app.PLANE.XY vector = [0, 0, axisdist] - offset = self.find_point_around(objectname, start, sheet_dim, cs) + offset = self.find_point_around(assignment, start, sheet_dim, cs) p1 = self.create_polyline([start, offset]) p2 = p1.clone().move(vector) self.connect([p1, p2]) @@ -2370,13 +2381,13 @@ def get_boundaries_name(self): else: return list(self._app.odesign.GetChildObject("Boundaries").GetChildNames()) - @pyaedt_function_handler() - def set_object_model_state(self, obj_list, model=True): + @pyaedt_function_handler(obj_list="assignment") + def set_object_model_state(self, assignment, model=True): """Set a list of objects to either models or non-models. Parameters ---------- - obj_list : list + assignment : list List of objects IDs or names. model : bool, optional Whether to set the objects as models. The default is ``True``. @@ -2392,7 +2403,7 @@ def set_object_model_state(self, obj_list, model=True): >>> oEditor.ChangeProperty """ - selections = self.convert_to_selections(obj_list, True) + selections = self.convert_to_selections(assignment, True) arguments = [ "NAME:AllTabs", [ @@ -2467,15 +2478,15 @@ def get_group_bounding_box(self, group): bounding = self.get_model_bounding_box() return bounding - @pyaedt_function_handler() - def convert_to_selections(self, object_id, return_list=False): + @pyaedt_function_handler(object_id="assignment") + def convert_to_selections(self, assignment, return_list=False): """Convert modeler objects. This method converts modeler object or IDs to the corresponding output according to the following scheme: ==================== =========================== - ``object_id`` Return value + ``assignment`` Return value ==================== =========================== ``int`` object name (str) @@ -2495,7 +2506,7 @@ def convert_to_selections(self, object_id, return_list=False): Parameters ---------- - object_id : str, int, list + assignment : str, int, list One or more object IDs whose name will be returned. A list can contain both strings (object names) and integers (object IDs). return_list : bool, option @@ -2509,10 +2520,10 @@ def convert_to_selections(self, object_id, return_list=False): Name of the objects corresponding to the one or more object IDs passed as arguments. """ - if not isinstance(object_id, list): - object_id = [object_id] + if not isinstance(assignment, list): + assignment = [assignment] objnames = [] - for el in object_id: + for el in assignment: if isinstance(el, int) and el in self.objects: objnames.append(self.objects[el].name) elif isinstance(el, int): @@ -2528,15 +2539,17 @@ def convert_to_selections(self, object_id, return_list=False): else: return ",".join([str(i) for i in objnames]) - @pyaedt_function_handler() - def split(self, objects, plane=None, sides="Both", tool=None, split_crossing_objs=False, delete_invalid_objs=True): + @pyaedt_function_handler(objects="assignment") + def split( + self, assignment, plane=None, sides="Both", tool=None, split_crossing_objs=False, delete_invalid_objs=True + ): """Split a list of objects. In case of 3D design possible splitting options are plane, Face Primitive, Edge Primitive or Polyline. In case of 2D design possible splitting option is plane. Parameters ---------- - objects : str, int, or list + assignment : str, int, or list One or more objects to split. A list can contain both strings (object names) and integers (object IDs). plane : str, optional @@ -2574,7 +2587,7 @@ def split(self, objects, plane=None, sides="Both", tool=None, split_crossing_obj if plane is None and not tool or plane and tool: self.logger.info("One method to split the objects has to be defined.") return False - objects = self.convert_to_selections(objects) + assignment = self.convert_to_selections(assignment) all_objs = [i for i in self.object_names] selections = [] planes = "Dummy" @@ -2587,7 +2600,7 @@ def split(self, objects, plane=None, sides="Both", tool=None, split_crossing_obj tool_type = "PlaneTool" tool_entity_id = -1 planes = GeometryOperators.cs_plane_to_plane_str(plane) - selections = ["NAME:Selections", "Selections:=", objects, "NewPartsModelFlag:=", "Model"] + selections = ["NAME:Selections", "Selections:=", assignment, "NewPartsModelFlag:=", "Model"] elif tool and plane is None: if isinstance(tool, str): obj = [f for f in self.object_list if f.name == tool][0] @@ -2647,7 +2660,7 @@ def split(self, objects, plane=None, sides="Both", tool=None, split_crossing_obj selections = [ "NAME:Selections", "Selections:=", - objects, + assignment, "NewPartsModelFlag:=", "Model", "ToolPart:=", @@ -2661,7 +2674,7 @@ def split(self, objects, plane=None, sides="Both", tool=None, split_crossing_obj tool_type = "PlaneTool" tool_entity_id = -1 planes = GeometryOperators.cs_plane_to_plane_str(plane) - selections = ["NAME:Selections", "Selections:=", objects, "NewPartsModelFlag:=", "Model"] + selections = ["NAME:Selections", "Selections:=", assignment, "NewPartsModelFlag:=", "Model"] self.oeditor.Split( selections, [ @@ -2681,13 +2694,13 @@ def split(self, objects, plane=None, sides="Both", tool=None, split_crossing_obj ], ) self.refresh_all_ids() - return [objects] + [i for i in self.object_names if i not in all_objs] + return [assignment] + [i for i in self.object_names if i not in all_objs] - @pyaedt_function_handler() # TODO: Deprecate this and add duplicate as an option in the mirror method. + @pyaedt_function_handler(objid="assignment", position="origin") def duplicate_and_mirror( self, - objid, - position, + assignment, + origin, vector, is_3d_comp=False, duplicate_assignment=True, @@ -2696,12 +2709,12 @@ def duplicate_and_mirror( Parameters ---------- - objid : str, int, or Object3d + assignment : str, int, or :class:`pyaedt.modeler.cad.object3d.Object3d` Name or ID of the object. - position : float + origin : list List of the ``[x, y, z]`` coordinates or Application.Position object for the selection. - vector : float + vector : float, str List of the ``[x1, y1, z1]`` coordinates or Application.Position object for the vector. is_3d_comp : bool, optional @@ -2720,19 +2733,19 @@ def duplicate_and_mirror( >>> oEditor.DuplicateMirror """ return self.mirror( - objid, position, vector, duplicate=True, is_3d_comp=is_3d_comp, duplicate_assignment=duplicate_assignment + assignment, origin, vector, duplicate=True, is_3d_comp=is_3d_comp, duplicate_assignment=duplicate_assignment ) # selections = self.convert_to_selections(objid) - @pyaedt_function_handler() - def mirror(self, objid, position, vector, duplicate=False, is_3d_comp=False, duplicate_assignment=True): + @pyaedt_function_handler(objid="assignment", position="origin") + def mirror(self, assignment, origin, vector, duplicate=False, is_3d_comp=False, duplicate_assignment=True): """Mirror a selection. Parameters ---------- - objid : str, int, or Object3d + assignment : str, int, or Object3d Name or ID of the object. - position : int or float + origin : int or float List of the ``[x, y, z]`` coordinates or the ``Application.Position`` object for the selection. duplicate : bool, optional @@ -2740,7 +2753,7 @@ def mirror(self, objid, position, vector, duplicate=False, is_3d_comp=False, dup is_3d_comp : bool, optional Whether the component is 3D. The default is ``False``. If ``True``, the method tries to return the duplicated list of 3D components. - vector : float + vector : list List of the ``[x1, y1, z1]`` coordinates or the ``Application.Position`` object for the vector. duplicate_assignment : bool, optional @@ -2757,8 +2770,8 @@ def mirror(self, objid, position, vector, duplicate=False, is_3d_comp=False, dup >>> oEditor.Mirror >>> oEditor.DuplicateMirror """ - selections = self.convert_to_selections(objid) - Xpos, Ypos, Zpos = self._pos_with_arg(position) + selections = self.convert_to_selections(assignment) + Xpos, Ypos, Zpos = self._pos_with_arg(origin) Xnorm, Ynorm, Znorm = self._pos_with_arg(vector) if duplicate: vArg1 = ["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"] @@ -2793,13 +2806,13 @@ def mirror(self, objid, position, vector, duplicate=False, is_3d_comp=False, dup self.oeditor.Mirror(vArg1, vArg2) return True - @pyaedt_function_handler() - def move(self, objid, vector): + @pyaedt_function_handler(objid="assignment") + def move(self, assignment, vector): """Move objects from a list. Parameters ---------- - objid : list, Position object + assignment : list, Position object List of object IDs. vector : list Vector of the direction move. It can be a list of the ``[x, y, z]`` @@ -2816,7 +2829,7 @@ def move(self, objid, vector): >>> oEditor.Move """ Xvec, Yvec, Zvec = self._pos_with_arg(vector) - szSelections = self.convert_to_selections(objid) + szSelections = self.convert_to_selections(assignment) vArg1 = ["NAME:Selections", "Selections:=", szSelections, "NewPartsModelFlag:=", "Model"] vArg2 = ["NAME:TranslateParameters"] @@ -2828,13 +2841,13 @@ def move(self, objid, vector): self.oeditor.Move(vArg1, vArg2) return True - @pyaedt_function_handler() + @pyaedt_function_handler(objid="assignment", cs_axis="axis", nclones="clones") def duplicate_around_axis( self, - objid, - cs_axis, + assignment, + axis, angle=90, - nclones=2, + clones=2, create_new_objects=True, is_3d_comp=False, duplicate_assignment=True, @@ -2843,13 +2856,13 @@ def duplicate_around_axis( Parameters ---------- - objid : list, str, int, Object3d or UserDefinedComponent + assignment : list, str, int, Object3d or UserDefinedComponent Name or ID of the object. - cs_axis : + axis : str Coordinate system axis or the Application.AXIS object. angle : float, optional Angle rotation in degees. The default is ``90``. - nclones : int, optional + clones : int, optional Number of clones. The default is ``2``. create_new_objects : Whether to create the copies as new objects. The @@ -2868,7 +2881,7 @@ def duplicate_around_axis( >>> oEditor.DuplicateAroundAxis """ - selections = self.convert_to_selections(objid) + selections = self.convert_to_selections(assignment) vArg1 = ["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"] vArg2 = [ @@ -2876,11 +2889,11 @@ def duplicate_around_axis( "CreateNewObjects:=", create_new_objects, "WhichAxis:=", - GeometryOperators.cs_axis_str(cs_axis), + GeometryOperators.cs_axis_str(axis), "AngleStr:=", self._arg_with_dim(angle, "deg"), "Numclones:=", - str(nclones), + str(clones), ] vArg3 = ["NAME:Options", "DuplicateAssignments:=", duplicate_assignment] added_objs = self.oeditor.DuplicateAroundAxis(vArg1, vArg2, vArg3) @@ -2903,13 +2916,13 @@ def _duplicate_added_components_tuple(self): else: return False, [] - @pyaedt_function_handler() + @pyaedt_function_handler(objid="assignment", nclones="clones", attachObject="attach") def duplicate_along_line( self, - objid, + assignment, vector, - nclones=2, - attachObject=False, + clones=2, + attach=False, is_3d_comp=False, duplicate_assignment=True, ): @@ -2917,14 +2930,14 @@ def duplicate_along_line( Parameters ---------- - objid : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` + assignment : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` Name or ID of the object. vector : list List of ``[x1,y1,z1]`` coordinates or the Application.Position object for the vector. - attachObject : bool, optional + attach : bool, optional The default is ``False``. - nclones : int, optional + clones : int, optional Number of clones. The default is ``2``. is_3d_comp : bool, optional If True, the method will try to return the duplicated list of 3dcomponents. The default is ``False``. @@ -2940,35 +2953,35 @@ def duplicate_along_line( >>> oEditor.DuplicateAlongLine """ - selections = self.convert_to_selections(objid) + selections = self.convert_to_selections(assignment) Xpos, Ypos, Zpos = self._pos_with_arg(vector) vArg1 = ["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"] vArg2 = ["NAME:DuplicateToAlongLineParameters"] - vArg2.append("CreateNewObjects:="), vArg2.append(not attachObject) + vArg2.append("CreateNewObjects:="), vArg2.append(not attach) vArg2.append("XComponent:="), vArg2.append(Xpos) vArg2.append("YComponent:="), vArg2.append(Ypos) vArg2.append("ZComponent:="), vArg2.append(Zpos) - vArg2.append("Numclones:="), vArg2.append(str(nclones)) + vArg2.append("Numclones:="), vArg2.append(str(clones)) vArg3 = ["NAME:Options", "DuplicateAssignments:=", duplicate_assignment] self.oeditor.DuplicateAlongLine(vArg1, vArg2, vArg3) if is_3d_comp: return self._duplicate_added_components_tuple() - if attachObject: + if attach: return True, [] return self._duplicate_added_objects_tuple() - @pyaedt_function_handler() - def thicken_sheet(self, objid, thickness, bBothSides=False): + @pyaedt_function_handler(objid="assignment", bBothSides="both_sides") + def thicken_sheet(self, assignment, thickness, both_sides=False): """Thicken the sheet of the selection. Parameters ---------- - objid : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` + assignment : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` Name or ID of the object. thickness : float, str Amount to thicken the sheet by. - bBothSides : bool, optional + both_sides : bool, optional Whether to thicken the sheet on both side. The default is ``False``. Returns @@ -2980,31 +2993,31 @@ def thicken_sheet(self, objid, thickness, bBothSides=False): >>> oEditor.ThickenSheet """ - selections = self.convert_to_selections(objid) + selections = self.convert_to_selections(assignment) vArg1 = ["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"] vArg2 = ["NAME:SheetThickenParameters"] vArg2.append("Thickness:="), vArg2.append(self._arg_with_dim(thickness)) - vArg2.append("BothSides:="), vArg2.append(bBothSides) + vArg2.append("BothSides:="), vArg2.append(both_sides) self.oeditor.ThickenSheet(vArg1, vArg2) - if isinstance(objid, list): + if isinstance(assignment, list): obj_list = [] - for objl in objid: + for objl in assignment: obj_list.append(self.update_object(objl)) return obj_list - return self.update_object(objid) + return self.update_object(assignment) - @pyaedt_function_handler() - def sweep_along_normal(self, obj_name, face_id, sweep_value=0.1): + @pyaedt_function_handler(obj_name="assignment", face_id="faces") + def sweep_along_normal(self, assignment, faces, sweep_value=0.1): """Sweep the selection along the vector. Parameters ---------- - obj_name : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` + assignment : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` Name or ID of the object. - face_id : int or list + faces : int or list Face or list of faces to sweep. sweep_value : float, optional Sweep value. The default is ``0.1``. @@ -3018,16 +3031,16 @@ def sweep_along_normal(self, obj_name, face_id, sweep_value=0.1): >>> oEditor.SweepFacesAlongNormal """ - if not isinstance(face_id, list): - face_id = [face_id] - selections = self.convert_to_selections(obj_name) + if not isinstance(faces, list): + faces = [faces] + selections = self.convert_to_selections(assignment) vArg1 = ["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"] vArg2 = ["NAME:Parameters"] vArg2.append( [ "NAME:SweepFaceAlongNormalToParameters", "FacesToDetach:=", - face_id, + faces, "LengthOfSweep:=", self._arg_with_dim(sweep_value), ] @@ -3047,13 +3060,13 @@ def sweep_along_normal(self, obj_name, face_id, sweep_value=0.1): return self.update_object(self[obj[0]]) return False - @pyaedt_function_handler() - def sweep_along_vector(self, objid, sweep_vector, draft_angle=0, draft_type="Round"): + @pyaedt_function_handler(objid="assignment") + def sweep_along_vector(self, assignment, sweep_vector, draft_angle=0, draft_type="Round"): """Sweep the selection along a vector. Parameters ---------- - objid : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` + assignment : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` Name or ID of the object. sweep_vector : float List of ``[x1, y1, z1]`` coordinates or Application.Position object for @@ -3074,7 +3087,7 @@ def sweep_along_vector(self, objid, sweep_vector, draft_angle=0, draft_type="Rou >>> oEditor.SweepAlongVector """ - selections = self.convert_to_selections(objid) + selections = self.convert_to_selections(assignment) vectorx, vectory, vectorz = self._pos_with_arg(sweep_vector) vArg1 = ["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"] vArg2 = ["NAME:VectorSweepParameters"] @@ -3086,23 +3099,29 @@ def sweep_along_vector(self, objid, sweep_vector, draft_angle=0, draft_type="Rou self.oeditor.SweepAlongVector(vArg1, vArg2) - if isinstance(objid, list): + if isinstance(assignment, list): updated_obj = [] - for sel_obj in objid: + for sel_obj in assignment: updated_obj.append(self.update_object(sel_obj)) return updated_obj else: - return self.update_object(objid) + return self.update_object(assignment) - @pyaedt_function_handler() + @pyaedt_function_handler(objid="assignment") def sweep_along_path( - self, objid, sweep_object, draft_angle=0, draft_type="Round", is_check_face_intersection=False, twist_angle=0 + self, + assignment, + sweep_object, + draft_angle=0, + draft_type="Round", + is_check_face_intersection=False, + twist_angle=0, ): """Sweep the selection along a path. Parameters ---------- - objid : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` + assignment : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` Name or ID of the object. sweep_object : str, int Name or ID of the sweep. @@ -3126,7 +3145,7 @@ def sweep_along_path( >>> oEditor.SweepAlongPath """ - selections = self.convert_to_selections(objid) + "," + self.convert_to_selections(sweep_object) + selections = self.convert_to_selections(assignment) + "," + self.convert_to_selections(sweep_object) vArg1 = ["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"] vArg2 = ["NAME:PathSweepParameters"] vArg2.append("DraftAngle:="), vArg2.append(self._arg_with_dim(draft_angle, "deg")) @@ -3136,17 +3155,17 @@ def sweep_along_path( self.oeditor.SweepAlongPath(vArg1, vArg2) - return self.update_object(objid) + return self.update_object(assignment) - @pyaedt_function_handler() - def sweep_around_axis(self, objid, cs_axis, sweep_angle=360, draft_angle=0, number_of_segments=0): + @pyaedt_function_handler(objid="assignment", cs_axis="axis") + def sweep_around_axis(self, assignment, axis, sweep_angle=360, draft_angle=0, number_of_segments=0): """Sweep the selection around the axis. Parameters ---------- - objid : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` + assignment : list, str, int, :class:`pyaedt.modeler.Object3d.Object3d` Name or ID of the object. - cs_axis : + axis : Coordinate system axis or the Application.AXIS object. sweep_angle : float Sweep angle in degrees. The default is ``360``. @@ -3165,7 +3184,7 @@ def sweep_around_axis(self, objid, cs_axis, sweep_angle=360, draft_angle=0, numb >>> oEditor.SweepAroundAxis """ - selections = self.convert_to_selections(objid) + selections = self.convert_to_selections(assignment) vArg1 = ["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"] vArg2 = [ @@ -3177,7 +3196,7 @@ def sweep_around_axis(self, objid, cs_axis, sweep_angle=360, draft_angle=0, numb "CheckFaceFaceIntersection:=", False, "SweepAxis:=", - GeometryOperators.cs_axis_str(cs_axis), + GeometryOperators.cs_axis_str(axis), "SweepAngle:=", self._arg_with_dim(sweep_angle, "deg"), "NumOfSegments:=", @@ -3186,15 +3205,15 @@ def sweep_around_axis(self, objid, cs_axis, sweep_angle=360, draft_angle=0, numb self.oeditor.SweepAroundAxis(vArg1, vArg2) - return self.update_object(objid) + return self.update_object(assignment) - @pyaedt_function_handler() - def section(self, object_list, plane, create_new=True, section_cross_object=False): + @pyaedt_function_handler(object_list="assignment") + def section(self, assignment, plane, create_new=True, section_cross_object=False): """Section the selection. Parameters ---------- - object_list : list, str, int, or :class:`pyaedt.modeler.Object3d.Object3d` + assignment : list, str, int, or :class:`pyaedt.modeler.Object3d.Object3d` One or more objects to section. plane : str Coordinate plane or Application.PLANE object. @@ -3216,7 +3235,7 @@ def section(self, object_list, plane, create_new=True, section_cross_object=Fals """ section_plane = GeometryOperators.cs_plane_to_plane_str(plane) - selections = self.convert_to_selections(object_list) + selections = self.convert_to_selections(assignment) self.oeditor.Section( ["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"], @@ -3233,13 +3252,13 @@ def section(self, object_list, plane, create_new=True, section_cross_object=Fals self.refresh_all_ids() return True - @pyaedt_function_handler() - def separate_bodies(self, object_list, create_group=False): + @pyaedt_function_handler(object_list="assignment") + def separate_bodies(self, assignment, create_group=False): """Separate bodies of the selection. Parameters ---------- - object_list : list, str + assignment : list, str List of objects to separate. create_group : bool, optional Whether to create a group. The default is ``False``. @@ -3256,7 +3275,7 @@ def separate_bodies(self, object_list, create_group=False): >>> oEditor.SeparateBody """ try: - selections = self.convert_to_selections(object_list) + selections = self.convert_to_selections(assignment) all_objs = [i for i in self.object_names] self.oeditor.SeparateBody( ["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"], @@ -3273,20 +3292,24 @@ def separate_bodies(self, object_list, create_group=False): except Exception: return False - @pyaedt_function_handler() - def rotate(self, objid, cs_axis, angle=90.0, unit="deg"): + @pyaedt_function_handler( + objid="assignment", + cs_axis="axis", + unit="units", + ) + def rotate(self, assignment, axis, angle=90.0, units="deg"): """Rotate the selection. Parameters ---------- - objid : list, str, int, or :class:`pyaedt.modeler.Object3d.Object3d` + assignment : list, str, int, or :class:`pyaedt.modeler.Object3d.Object3d` ID of the object. - cs_axis + axis : str Coordinate system axis or the Application.AXIS object. - angle : float + angle : float, str Angle of rotation. The units, defined by ``unit``, can be either degrees or radians. The default is ``90.0``. - unit : text, optional + units : text, optional Units for the angle. Options are ``"deg"`` or ``"rad"``. The default is ``"deg"``. @@ -3300,11 +3323,11 @@ def rotate(self, objid, cs_axis, angle=90.0, unit="deg"): >>> oEditor.Rotate """ - selections = self.convert_to_selections(objid) + selections = self.convert_to_selections(assignment) vArg1 = ["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"] vArg2 = ["NAME:RotateParameters"] - vArg2.append("RotateAxis:="), vArg2.append(GeometryOperators.cs_axis_str(cs_axis)) - vArg2.append("RotateAngle:="), vArg2.append(self._arg_with_dim(angle, unit)) + vArg2.append("RotateAxis:="), vArg2.append(GeometryOperators.cs_axis_str(axis)) + vArg2.append("RotateAngle:="), vArg2.append(self._arg_with_dim(angle, units)) if self.oeditor is not None: self.oeditor.Rotate(vArg1, vArg2) @@ -3414,17 +3437,17 @@ def _imprint_projection(self, tool_list, keep_originals=True, normal=True, vecto self.cleanup_objects() return True - @pyaedt_function_handler + @pyaedt_function_handler(tool_list="assignment") def imprint_normal_projection( self, - tool_list, + assignment, keep_originals=True, ): """Imprint the normal projection of objects over a sheet. Parameters ---------- - tool_list : list + assignment : list List of objects to imprint. The list can be of either Object3d objects or object IDs. keep_originals : bool, optional @@ -3440,12 +3463,12 @@ def imprint_normal_projection( >>> oEditor.ImprintProjection """ - return self._imprint_projection(tool_list, keep_originals, True) + return self._imprint_projection(assignment, keep_originals, True) - @pyaedt_function_handler + @pyaedt_function_handler(tool_list="assignment") def imprint_vector_projection( self, - tool_list, + assignment, vector_points, distance, keep_originals=True, @@ -3454,7 +3477,7 @@ def imprint_vector_projection( Parameters ---------- - tool_list : list + assignment : list List of objects to imprint. The list can be of either Object3d objects or object IDs. vector_points : list @@ -3474,15 +3497,15 @@ def imprint_vector_projection( >>> oEditor.ImprintProjection """ - return self._imprint_projection(tool_list, keep_originals, False, vector_points, distance) + return self._imprint_projection(assignment, keep_originals, False, vector_points, distance) - @pyaedt_function_handler() - def purge_history(self, theList): + @pyaedt_function_handler(theList="assignment") + def purge_history(self, assignment): """Purge history objects from object names. Parameters ---------- - theList : list + assignment : list List of object names to purge. Returns @@ -3495,7 +3518,7 @@ def purge_history(self, theList): >>> oEditor.PurgeHistory """ - szList = self.convert_to_selections(theList) + szList = self.convert_to_selections(assignment) vArg1 = ["NAME:Selections", "Selections:=", szList, "NewPartsModelFlag:=", "Model"] @@ -3522,13 +3545,13 @@ def get_model_bounding_box(self): bound = [float(b) for b in bb] return bound - @pyaedt_function_handler() - def unite(self, unite_list, purge=False, keep_originals=False): + @pyaedt_function_handler(unite_list="assignment") + def unite(self, assignment, purge=False, keep_originals=False): """Unite objects from a list. Parameters ---------- - unite_list : list, str + assignment : list, str List of objects to unite. purge : bool, optional Purge history after unite. Default is False. @@ -3545,12 +3568,12 @@ def unite(self, unite_list, purge=False, keep_originals=False): >>> oEditor.Unite """ - slice = min(100, len(unite_list)) - num_objects = len(unite_list) + slice = min(100, len(assignment)) + num_objects = len(assignment) remaining = num_objects objs_groups = [] while remaining > 1: - objs = unite_list[:slice] + objs = assignment[:slice] szSelections = self.convert_to_selections(objs) vArg1 = ["NAME:Selections", "Selections:=", szSelections] vArg2 = ["NAME:UniteParameters", "KeepOriginals:=", keep_originals] @@ -3568,22 +3591,22 @@ def unite(self, unite_list, purge=False, keep_originals=False): objs_groups.append(objs[0]) remaining -= slice if remaining > 0: - unite_list = unite_list[slice:] + assignment = assignment[slice:] if remaining > 0: - objs_groups.extend(unite_list) + objs_groups.extend(assignment) self.cleanup_objects() if len(objs_groups) > 1: return self.unite(objs_groups, purge=purge) self.logger.info("Union of {} objects has been executed.".format(num_objects)) - return self.convert_to_selections(unite_list[0], False) + return self.convert_to_selections(assignment[0], False) - @pyaedt_function_handler() - def clone(self, objid): + @pyaedt_function_handler(objid="assignment") + def clone(self, assignment): """Clone objects from a list of object IDs. Parameters ---------- - objid : list + assignment : list List of object IDs. Returns @@ -3599,17 +3622,17 @@ def clone(self, objid): >>> oEditor.Copy >>> oEditor.Paste """ - self.copy(objid) + self.copy(assignment) new_objects = self.paste() return True, new_objects - @pyaedt_function_handler() - def copy(self, object_list): + @pyaedt_function_handler(object_list="assignment") + def copy(self, assignment): """Copy objects to the clipboard. Parameters ---------- - object_list : list + assignment : list List of objects (IDs or names). Returns @@ -3625,7 +3648,7 @@ def copy(self, object_list): # convert to string try: - selections = self.convert_to_selections(object_list) + selections = self.convert_to_selections(assignment) vArg1 = ["NAME:Selections", "Selections:=", selections] self.oeditor.Copy(vArg1) return selections @@ -3651,13 +3674,13 @@ def paste(self): new_objects = self.add_new_objects() return new_objects - @pyaedt_function_handler() - def intersect(self, theList, keep_originals=False, **kwargs): + @pyaedt_function_handler(theList="assignment") + def intersect(self, assignment, keep_originals=False, **kwargs): """Intersect objects from a list. Parameters ---------- - theList : list + assignment : list List of objects. keep_originals : bool, optional Whether to keep the original object. The default is ``False``. @@ -3676,7 +3699,7 @@ def intersect(self, theList, keep_originals=False, **kwargs): warnings.warn("keeporiginal has been deprecated. use keep_originals.", DeprecationWarning) keep_originals = kwargs["keeporiginal"] unclassified = list(self.oeditor.GetObjectsInGroup("Unclassified")) - szSelections = self.convert_to_selections(theList) + szSelections = self.convert_to_selections(assignment) vArg1 = ["NAME:Selections", "Selections:=", szSelections] vArg2 = ["NAME:IntersectParameters", "KeepOriginals:=", keep_originals] @@ -3689,15 +3712,15 @@ def intersect(self, theList, keep_originals=False, **kwargs): return self.cleanup_objects() self.logger.info("Intersection Succeeded") - return self.convert_to_selections(theList[0], False) + return self.convert_to_selections(assignment[0], False) - @pyaedt_function_handler() - def connect(self, theList): + @pyaedt_function_handler(theList="assignment") + def connect(self, assignment): """Connect objects from a list. Parameters ---------- - theList : list + assignment : list List of objects. Returns @@ -3713,7 +3736,7 @@ def connect(self, theList): """ try: unclassified_before = list(self.unclassified_names) - szSelections = self.convert_to_selections(theList) + szSelections = self.convert_to_selections(assignment) szSelections_list = szSelections.split(",") vArg1 = ["NAME:Selections", "Selections:=", szSelections] @@ -3811,15 +3834,15 @@ def _offset_on_plane(self, i, offset): off3 = +offset return off1, off2, off3 - @pyaedt_function_handler() - def check_plane(self, obj, faceposition, offset=1): + @pyaedt_function_handler(obj="assignment", face_position="face_location") + def check_plane(self, assignment, face_location, offset=1): """Check for the plane that is defined as the face for an object. Parameters ---------- - obj : str + assignment : str Name of the object. - faceposition : list + face_location : list List of the ``[x, y, z]`` coordinates for the position of the face. offset : optional Offset to apply. The default is ``1``. @@ -3831,17 +3854,17 @@ def check_plane(self, obj, faceposition, offset=1): """ - Xvec, Yvec, Zvec = self._pos_with_arg(faceposition) + Xvec, Yvec, Zvec = self._pos_with_arg(face_location) - if isinstance(obj, int): - obj = self.objects[obj].name + if isinstance(assignment, int): + assignment = self.objects[assignment].name plane = None found = False i = 0 while not found: off1, off2, off3 = self._offset_on_plane(i, offset) vArg1 = ["NAME:FaceParameters"] - vArg1.append("BodyName:="), vArg1.append(obj) + vArg1.append("BodyName:="), vArg1.append(assignment) vArg1.append("XPosition:="), vArg1.append(Xvec + "+" + self._arg_with_dim(off1)) vArg1.append("YPosition:="), vArg1.append(Yvec + "+" + self._arg_with_dim(off2)) vArg1.append("ZPosition:="), vArg1.append(Zvec + "+" + self._arg_with_dim(off3)) @@ -3915,8 +3938,8 @@ def clean_objects_name(self, main_part_name): self.oeditor.RenamePart(RenameArgs) return True - @pyaedt_function_handler() - def create_airbox(self, offset=0, offset_type="Absolute", defname="AirBox_Auto"): + @pyaedt_function_handler(defname="name") + def create_airbox(self, offset=0, offset_type="Absolute", name="AirBox_Auto"): """Create an airbox that is as big as the bounding extension of the project. Parameters @@ -3928,7 +3951,7 @@ def create_airbox(self, offset=0, offset_type="Absolute", defname="AirBox_Auto") Type of the offset. Options are ``"Absolute"`` and ``"Relative"``. The default is ``"Absolute"``. If ``"Relative"``, the offset input is between 0 and 100. - defname : str, optional + name : str, optional Name of the airbox. The default is ``"AirBox_Auto"``. Returns @@ -3956,7 +3979,7 @@ def create_airbox(self, offset=0, offset_type="Absolute", defname="AirBox_Auto") dim.append(bound[3] - bound[0] + 2 * offset1) dim.append(bound[4] - bound[1] + 2 * offset2) dim.append(bound[5] - bound[2] + 2 * offset3) - airid = self.create_box(startpos, dim, defname) + airid = self.create_box(startpos, dim, name) return airid @pyaedt_function_handler() @@ -4004,13 +4027,13 @@ def create_air_region(self, x_pos=0, y_pos=0, z_pos=0, x_neg=0, y_neg=0, z_neg=0 """ return self.create_region(pad_percent=[x_pos, y_pos, z_pos, x_neg, y_neg, z_neg], is_percentage=is_percentage) - @pyaedt_function_handler() - def edit_region_dimensions(self, listvalues): + @pyaedt_function_handler(listvalues="values") + def edit_region_dimensions(self, values): """Modify the dimensions of the region. Parameters ---------- - listvalues : list + values : list List of the padding percentages along all six directions in the form ``[+X, -X, +Y, -Y, +Z, -Z]``. @@ -4028,7 +4051,7 @@ def edit_region_dimensions(self, listvalues): arg2 = ["NAME:Geometry3DCmdTab", ["NAME:PropServers", "Region:CreateRegion:1"]] arg3 = ["NAME:ChangedProps"] p = ["+X", "-X", "+Y", "-Y", "+Z", "-Z"] - for label, value in zip(p, listvalues): + for label, value in zip(p, values): padding = [] padding.append("NAME:" + label + " Padding Data") padding.append("Value:=") @@ -4039,13 +4062,13 @@ def edit_region_dimensions(self, listvalues): self.oeditor.ChangeProperty(arg) return True - @pyaedt_function_handler() - def create_face_list(self, face_list, name=None): + @pyaedt_function_handler(face_list="assignment") + def create_face_list(self, assignment, name=None): """Create a list of faces given a list of face ID or a list of objects. Parameters ---------- - face_list : list + assignment : list List of face ID or list of objects name : str, optional @@ -4066,15 +4089,11 @@ def create_face_list(self, face_list, name=None): if i.name == name: self.logger.warning("A List with the specified name already exists!") return i - face_list = self.convert_to_selections(face_list, True) + assignment = self.convert_to_selections(assignment, True) user_list = Lists(self) list_type = "Face" if user_list: - result = user_list.create( - object_list=face_list, - name=name, - type=list_type, - ) + result = user_list.create(assignment=assignment, name=name, entity_type=list_type) if result: return user_list else: @@ -4084,13 +4103,13 @@ def create_face_list(self, face_list, name=None): self._app.logger.error("User list object could not be created") return False - @pyaedt_function_handler() - def create_object_list(self, object_list, name=None): + @pyaedt_function_handler(object_list="assignment") + def create_object_list(self, assignment, name=None): """Create an object list given a list of object names. Parameters ---------- - object_list : list + assignment : list List of object names. name : str, optional Name of the new object list. @@ -4110,15 +4129,11 @@ def create_object_list(self, object_list, name=None): if i.name == name: self.logger.warning("A List with the specified name already exists!") return i - object_list = self.convert_to_selections(object_list, True) + assignment = self.convert_to_selections(assignment, True) user_list = Lists(self) list_type = "Object" if user_list: - result = user_list.create( - object_list=object_list, - name=name, - type=list_type, - ) + result = user_list.create(assignment=assignment, name=name, entity_type=list_type) if result: return user_list else: @@ -4128,13 +4143,13 @@ def create_object_list(self, object_list, name=None): self._app.logger.error("User list object could not be created") return False - @pyaedt_function_handler() - def generate_object_history(self, objectname): + @pyaedt_function_handler(objectname="assignment") + def generate_object_history(self, assignment): """Generate history for the object. Parameters ---------- - objectname : str + assignment : str Name of the history object. Returns @@ -4147,27 +4162,27 @@ def generate_object_history(self, objectname): >>> oEditor.GenerateHistory """ - objectname = self.convert_to_selections(objectname) + assignment = self.convert_to_selections(assignment) self.oeditor.GenerateHistory( - ["NAME:Selections", "Selections:=", objectname, "NewPartsModelFlag:=", "Model", "UseCurrentCS:=", True] + ["NAME:Selections", "Selections:=", assignment, "NewPartsModelFlag:=", "Model", "UseCurrentCS:=", True] ) self.cleanup_objects() return True - @pyaedt_function_handler() - def create_faceted_bondwire_from_true_surface(self, bondname, bond_direction, min_size=0.2, numberofsegments=8): + @pyaedt_function_handler(bondname="assignment", bond_direction="direction", numberofsegments="number_of_segments") + def create_faceted_bondwire_from_true_surface(self, assignment, direction, min_size=0.2, number_of_segments=8): """Create a faceted bondwire from an existing true surface bondwire. Parameters ---------- - bondname : str + assignment : str Name of the bondwire to replace. - bond_direction : list + direction : list List of the ``[x, y, z]`` coordinates for the axis direction of the bondwire. For example, ``[0, 1, 2]``. min_size : float Minimum size of the subsegment of the new polyline. The default is ``0.2``. - numberofsegments : int, optional + number_of_segments : int, optional Number of segments. The default is ``8``. Returns @@ -4175,7 +4190,7 @@ def create_faceted_bondwire_from_true_surface(self, bondname, bond_direction, mi str Name of the bondwire created. """ - old_bondwire = self.get_object_from_name(bondname) + old_bondwire = self.get_object_from_name(assignment) if not old_bondwire: return False edges = old_bondwire.edges @@ -4196,7 +4211,7 @@ def create_faceted_bondwire_from_true_surface(self, bondname, bond_direction, mi p3 = [abs(i - j) for i, j in zip(p1, p2)] dir = p3.index(max(p3)) - if dir == bond_direction: + if dir == direction: edgelist.append(el) verlist.append([p1, p2]) if not edgelist: @@ -4260,15 +4275,15 @@ def create_faceted_bondwire_from_true_surface(self, bondname, bond_direction, mi rad = dist move_vector = GeometryOperators.v_sub(fc, first_vert) - P = self.get_existing_polyline(object=new_edges[0]) + P = self.get_existing_polyline(assignment=new_edges[0]) if edge_to_delete: P.remove_edges(edge_to_delete) - angle = math.pi * (180 - 360 / numberofsegments) / 360 + angle = math.pi * (180 - 360 / number_of_segments) / 360 status = P.set_crosssection_properties( - type="Circle", num_seg=numberofsegments, width=(rad * (2 - math.sin(angle))) * 2 + type="Circle", num_seg=number_of_segments, width=(rad * (2 - math.sin(angle))) * 2 ) if status: self.move(new_edges[0], move_vector) @@ -4299,13 +4314,13 @@ def get_entitylist_id(self, name): id = self.oeditor.GetEntityListIDByName(name) return id - @pyaedt_function_handler() - def create_outer_facelist(self, externalobjects, name="outer_faces"): + @pyaedt_function_handler(externalobjects="assignment") + def create_outer_facelist(self, assignment, name="outer_faces"): """Create a face list from a list of outer objects. Parameters ---------- - externalobjects : list + assignment : list List of outer objects. name : str, optional Name of the new list. The default is ``"outer_faces"``. @@ -4316,20 +4331,20 @@ def create_outer_facelist(self, externalobjects, name="outer_faces"): ``True`` when successful, ``False`` when failed. """ - list2 = self.select_allfaces_fromobjects(externalobjects) # find ALL faces of outer objects + list2 = self.select_allfaces_fromobjects(assignment) # find ALL faces of outer objects self.create_face_list(list2, name) self.logger.info("Extfaces of thermal model = " + str(len(list2))) return True - @pyaedt_function_handler() - def explicitly_subtract(self, diellist, metallist): + @pyaedt_function_handler(diellist="tool_parts", metallist="blank_parts") + def explicitly_subtract(self, tool_parts, blank_parts): """Explicitly subtract all elements in a SolveInside list and a SolveSurface list. Parameters ---------- - diellist : list + tool_parts : list List of dielectrics. - metallist : list + blank_parts : list List of metals. Returns @@ -4344,12 +4359,12 @@ def explicitly_subtract(self, diellist, metallist): >>> oEditor.PurgeHistory """ self.logger.info("Creating explicit subtraction between objects.") - for el in diellist: + for el in tool_parts: list1 = el list2 = "" - for el1 in metallist: + for el1 in blank_parts: list2 = list2 + el1 + "," - for el1 in diellist: + for el1 in tool_parts: if el1 is not el: list2 = list2 + el1 + "," if list2: @@ -4357,10 +4372,10 @@ def explicitly_subtract(self, diellist, metallist): self.subtract(list1, list2, True) self.purge_history(list1) self.purge_history(list2) - for el in metallist: + for el in blank_parts: list1 = el list2 = "" - for el1 in metallist: + for el1 in blank_parts: if el1 is not el: list2 = list2 + el1 + "," if list2: @@ -4371,8 +4386,8 @@ def explicitly_subtract(self, diellist, metallist): self.logger.info("Explicit subtraction is completed.") return True - @pyaedt_function_handler() - def find_port_faces(self, port_sheets): + @pyaedt_function_handler(port_sheets="assignment") + def find_port_faces(self, assignment): """Find the vacuums given a list of input sheets. Starting from a list of input sheets, this method creates a list of output sheets @@ -4382,7 +4397,7 @@ def find_port_faces(self, port_sheets): Parameters ---------- - port_sheets : list + assignment : list List of input sheets names. Returns @@ -4393,7 +4408,7 @@ def find_port_faces(self, port_sheets): """ faces = [] solids = [s for s in self.solid_objects if s.material_name not in ["vacuum", "air"] and s.model] - for sheet_name in port_sheets: + for sheet_name in assignment: sheet = self[sheet_name] # get the sheet object _, cloned = self.clone(sheet) cloned = self[cloned[0]] @@ -4439,13 +4454,13 @@ def get_bounding_dimension(self): dimensions.append(abs(float(oBoundingBox[2]) - float(oBoundingBox[5]))) return dimensions - @pyaedt_function_handler() - def get_object_name_from_edge_id(self, edge_id): + @pyaedt_function_handler(edge_id="assignment") + def get_object_name_from_edge_id(self, assignment): """Retrieve the object name for a predefined edge ID. Parameters ---------- - edge_id : int + assignment : int ID of the edge. Returns @@ -4461,7 +4476,7 @@ def get_object_name_from_edge_id(self, edge_id): for object in self.solid_names + self.sheet_names + self.line_names: try: oEdgeIDs = self.oeditor.GetEdgeIDsFromObject(object) - if str(edge_id) in oEdgeIDs: + if str(assignment) in oEdgeIDs: return object except Exception: return False @@ -4486,13 +4501,13 @@ def get_solving_volume(self): volume = str(round(volume, 0)) return volume - @pyaedt_function_handler() - def vertex_data_of_lines(self, txtfilter=None): + @pyaedt_function_handler(txtfilter="text_filter") + def vertex_data_of_lines(self, text_filter=None): """Generate a dictionary of line vertex data for all lines contained within the design. Parameters ---------- - txtfilter : str, optional + text_filter : str, optional Text string for filtering. The default is ``None``. When a text string is specified, line data is generated only if this text string is contained within the line name. @@ -4504,20 +4519,20 @@ def vertex_data_of_lines(self, txtfilter=None): """ line_data = {} lines = self.get_line_ids() - if txtfilter is not None: - lines = [n for n in lines if txtfilter in n] + if text_filter is not None: + lines = [n for n in lines if text_filter in n] for x in lines: line_data[x] = self.get_vertices_of_line(x) return line_data - @pyaedt_function_handler() - def get_vertices_of_line(self, sLineName): + @pyaedt_function_handler(sLineName="assignment") + def get_vertices_of_line(self, assignment): """Generate a list of vertex positions for a line object from AEDT in model units. Parameters ---------- - sLineName : str + assignment : str Name of the line object in AEDT. Returns @@ -4533,7 +4548,7 @@ def get_vertices_of_line(self, sLineName): position_list = [] # Get all vertices in the line - vertices_on_line = self.oeditor.GetVertexIDsFromObject(sLineName) + vertices_on_line = self.oeditor.GetVertexIDsFromObject(assignment) if settings.aedt_version > "2022.2": vertices_on_line = vertices_on_line[::-1] @@ -4550,10 +4565,10 @@ def get_vertices_of_line(self, sLineName): return position_list - @pyaedt_function_handler() + @pyaedt_function_handler(filename="input_file") def import_3d_cad( self, - filename, + input_file, healing=False, refresh_all_ids=True, import_materials=False, @@ -4568,7 +4583,7 @@ def import_3d_cad( Parameters ---------- - filename : str + input_file : str Full path and name of the CAD file. healing : bool, optional Whether to perform healing. The default is ``False``, in which @@ -4624,20 +4639,20 @@ def import_3d_cad( vArg1.append("CreateLightweightPart:="), vArg1.append(create_lightweigth_part) vArg1.append("ImportMaterialNames:="), vArg1.append(import_materials) vArg1.append("SeparateDisjointLumps:="), vArg1.append(separate_disjoints_lumped_object) - vArg1.append("SourceFile:="), vArg1.append(filename) + vArg1.append("SourceFile:="), vArg1.append(input_file) self.oeditor.Import(vArg1) if refresh_all_ids: self.refresh_all_ids() - self.logger.info("Step file {} imported".format(filename)) + self.logger.info("Step file {} imported".format(input_file)) return True - @pyaedt_function_handler() - def import_spaceclaim_document(self, SCFile): + @pyaedt_function_handler(SCFile="input_file") + def import_spaceclaim_document(self, input_file): """Import a SpaceClaim document. Parameters ---------- - SCFile : + input_file : Full path and name of the SpaceClaim file. Returns @@ -4671,7 +4686,7 @@ def import_spaceclaim_document(self, SCFile): "Name:=", "GeometryFilePath", "Value:=", - '"' + SCFile + '"', + '"' + input_file + '"', "DataType:=", "String", "PropType2:=", @@ -4853,16 +4868,16 @@ def import_spaceclaim_document(self, SCFile): self.refresh_all_ids() return True - @pyaedt_function_handler() - def import_primitives_from_file(self, input_file=None, input_dict=None): + @pyaedt_function_handler(input_dict="primitives") + def import_primitives_from_file(self, input_file=None, primitives=None): """Import and create primitives from a JSON file or dictionary of properties. Parameters ---------- input_file : str, optional - Path to a JSON file containing report settings. - input_dict : dict, optional - Dictionary containing report settings. + Path to a JSON file containing all primitives to import. It can be used in alternative to ``parameters``. + primitives : dict, optional + Dictionary containing all primitives to import. It can be used in alternative to ``input_file``. Returns ------- @@ -4875,7 +4890,7 @@ def import_primitives_from_file(self, input_file=None, input_dict=None): >>> aedtapp = Icepak() >>> aedtapp.modeler.import_primitives_from_file(r'C:\\temp\\primitives.json') """ - primitives_builder = PrimitivesBuilder(self._app, input_file, input_dict) + primitives_builder = PrimitivesBuilder(self._app, input_file, primitives) primitive_names = primitives_builder.create() return primitive_names @@ -4915,13 +4930,13 @@ def break_spaceclaim_connection(self): # TODO: Need to change this name. Don't self.oeditor.BreakUDMConnection(args) return True - @pyaedt_function_handler() - def load_scdm_in_hfss(self, SpaceClaimFile): + @pyaedt_function_handler(SpaceClaimFile="input_file") + def load_scdm_in_hfss(self, input_file): """Load a SpaceClaim file in HFSS. Parameters ---------- - SpaceClaimFile : str + input_file : str Full path and name of the SpaceClaim file. @@ -4936,17 +4951,17 @@ def load_scdm_in_hfss(self, SpaceClaimFile): >>> oEditor.CreateUserDefinedModel >>> oEditor.BreakUDMConnection """ - self.import_spaceclaim_document(SpaceClaimFile) + self.import_spaceclaim_document(input_file) self.break_spaceclaim_connection() return True - @pyaedt_function_handler() - def get_faces_from_materials(self, mats): + @pyaedt_function_handler(mats="filter_materials") + def get_faces_from_materials(self, filter_materials): """Select all outer faces given a list of materials. Parameters ---------- - mats : list + filter_materials : list List of materials to include in the search for outer faces. @@ -4965,9 +4980,9 @@ def get_faces_from_materials(self, mats): sel = [] objs = [] - if isinstance(mats, str): - mats = [mats] - for mat in mats: + if isinstance(filter_materials, str): + filter_materials = [filter_materials] + for mat in filter_materials: objs.extend(list(self.oeditor.GetObjectsByMaterial(mat.lower()))) for i in objs: @@ -4977,13 +4992,13 @@ def get_faces_from_materials(self, mats): sel.append(int(face)) return sel - @pyaedt_function_handler() - def scale(self, obj_list, x=2.0, y=2.0, z=2.0): + @pyaedt_function_handler(obj_list="assignment") + def scale(self, assignment, x=2.0, y=2.0, z=2.0): """Scale a list of objects. Parameters ---------- - obj_list : list + assignment : list List of objects IDs or names. x : float, optional Scale factor for X. @@ -5002,19 +5017,19 @@ def scale(self, obj_list, x=2.0, y=2.0, z=2.0): >>> oEditor.Scale """ - selections = self.convert_to_selections(obj_list, True) + selections = self.convert_to_selections(assignment, True) arg1 = ["NAME:Selections", "Selections:=", ", ".join(selections), "NewPartsModelFlag:=", "Model"] arg2 = ["NAME:ScaleParameters", "ScaleX:=", str(x), "ScaleY:=", str(y), "ScaleZ:=", str(z)] self.oeditor.Scale(arg1, arg2) return True - @pyaedt_function_handler() - def select_allfaces_fromobjects(self, elements): + @pyaedt_function_handler(elements="assignment") + def select_allfaces_fromobjects(self, assignment): """Select all outer faces given a list of objects. Parameters ---------- - elements : list + assignment : list List of objects to include in the search for outer faces. Returns @@ -5031,7 +5046,7 @@ def select_allfaces_fromobjects(self, elements): sel = [] - for i in elements: + for i in assignment: oFaceIDs = self.oeditor.GetFaceIDs(i) for face in oFaceIDs: @@ -5059,21 +5074,23 @@ def setunassigned_mats(self): self.oeditor.SetPropertyValue("Geometry3DAttributeTab", obj, "Model", False) return True - @pyaedt_function_handler() - def automatic_thicken_sheets(self, inputlist, value, internalExtr=True, internalvalue=1): + @pyaedt_function_handler( + inputlist="assignment", internalExtr="extrude_internally", internalvalue="internal_extrusion" + ) + def automatic_thicken_sheets(self, assignment, value, extrude_internally=True, internal_extrusion=1): """Create thickened sheets for a list of input faces. This method automatically checks the direction in which to thicken the sheets. Parameters ---------- - inputlist : list + assignment : list List of faces. value : float Value in millimeters to thicken the sheets. - internalExtr : bool, optional + extrude_internally : bool, optional Whether to extrude sheets internally. The default is ``True``. - internalvalue : float, optional + internal_extrusion : float, optional Value in millimeters to thicken the sheets internally (vgoing into the model). The default is ``1``. @@ -5089,8 +5106,8 @@ def automatic_thicken_sheets(self, inputlist, value, internalExtr=True, internal """ aedt_bounding_box = self.get_model_bounding_box() directions = {} - inputlist = self.convert_to_selections(inputlist, True) - for el in inputlist: + assignment = self.convert_to_selections(assignment, True) + for el in assignment: objID = self.oeditor.GetFaceIDs(el) faceCenter = self.oeditor.GetFaceCenter(int(objID[0])) directionfound = False @@ -5118,7 +5135,7 @@ def automatic_thicken_sheets(self, inputlist, value, internalExtr=True, internal directionfound = True else: thickness = thickness + 10 - for el in inputlist: + for el in assignment: objID = self.oeditor.GetFaceIDs(el) faceCenter = self.oeditor.GetFaceCenter(int(objID[0])) if directions[el] == "Internal": @@ -5131,7 +5148,7 @@ def automatic_thicken_sheets(self, inputlist, value, internalExtr=True, internal ["NAME:Selections", "Selections:=", el, "NewPartsModelFlag:=", "Model"], ["NAME:SheetThickenParameters", "Thickness:=", str(value) + "mm", "BothSides:=", False], ) - if internalExtr: + if extrude_internally: objID2 = self.oeditor.GetFaceIDs(el) for fid in objID2: try: @@ -5146,7 +5163,7 @@ def automatic_thicken_sheets(self, inputlist, value, internalExtr=True, internal "MoveAlongNormalFlag:=", True, "OffsetDistance:=", - str(internalvalue) + "mm", + str(internal_extrusion) + "mm", "MoveVectorX:=", "0mm", "MoveVectorY:=", @@ -5163,15 +5180,15 @@ def automatic_thicken_sheets(self, inputlist, value, internalExtr=True, internal # self.modeler_oproject.ClearMessages() return True - @pyaedt_function_handler() - def move_face(self, faces, offset=1.0): + @pyaedt_function_handler(faces="assignment") + def move_face(self, assignment, offset=1.0): """Move an input face or a list of input faces of a specific object. This method moves a face or a list of faces which belong to the same solid. Parameters ---------- - faces : list + assignment : list List of Face ID or List of :class:`pyaedt.modeler.Object3d.FacePrimitive` object or mixed. offset : float, optional Offset to apply in model units. The default is ``1.0``. @@ -5187,7 +5204,7 @@ def move_face(self, faces, offset=1.0): >>> oEditor.MoveFaces """ - face_selection = self.convert_to_selections(faces, True) + face_selection = self.convert_to_selections(assignment, True) selection = {} for f in face_selection: if self.oeditor.GetObjectNameByFaceID(f) in selection: @@ -5224,15 +5241,15 @@ def move_face(self, faces, offset=1.0): self.oeditor.MoveFaces(arg1, arg2) return True - @pyaedt_function_handler() - def move_edge(self, edges, offset=1.0): + @pyaedt_function_handler(edges="assignment") + def move_edge(self, assignment, offset=1.0): """Move an input edge or a list of input edges of a specific object. This method moves an edge or a list of edges which belong to the same solid. Parameters ---------- - edges : list + assignment : list List of Edge ID or List of :class:`pyaedt.modeler.Object3d.EdgePrimitive` object or mixed. offset : float, optional Offset to apply in model units. The default is ``1.0``. @@ -5248,7 +5265,7 @@ def move_edge(self, edges, offset=1.0): >>> oEditor.MoveEdges """ - edge_selection = self.convert_to_selections(edges, True) + edge_selection = self.convert_to_selections(assignment, True) selection = {} for f in edge_selection: if self.oeditor.GetObjectNameByEdgeID(f) in selection: @@ -5400,16 +5417,16 @@ def flatten_assembly(self): self.oeditor.FlattenGroup(["Groups:=", ["Model"]]) return True - @pyaedt_function_handler() - def wrap_sheet(self, sheet_name, object_name, imprinted=False): + @pyaedt_function_handler(sheet_name="sheet", object_name="object") + def wrap_sheet(self, sheet, object, imprinted=False): """Execute the sheet wrapping around an object. If wrapping produces an unclassified operation it will be reverted. Parameters ---------- - sheet_name : str, :class:`pyaedt.modeler.Object3d.Object3d` + sheet : str, :class:`pyaedt.modeler.Object3d.Object3d` Sheet name or sheet object. - object_name : str, :class:`pyaedt.modeler.Object3d.Object3d` + object : str, :class:`pyaedt.modeler.Object3d.Object3d` Object name or solid object. imprinted : bool, optional Either if imprint or not over the sheet. Default is ``False``. @@ -5419,18 +5436,18 @@ def wrap_sheet(self, sheet_name, object_name, imprinted=False): bool Command execution status. """ - sheet_name = self.convert_to_selections(sheet_name, False) - object_name = self.convert_to_selections(object_name, False) + sheet = self.convert_to_selections(sheet, False) + object = self.convert_to_selections(object, False) - if sheet_name not in self.sheet_names: - self.logger.error("{} is not a valid sheet.".format(sheet_name)) + if sheet not in self.sheet_names: + self.logger.error("{} is not a valid sheet.".format(sheet)) return False - if object_name not in self.solid_names: - self.logger.error("{} is not a valid solid body.".format(object_name)) + if object not in self.solid_names: + self.logger.error("{} is not a valid solid body.".format(object)) return False unclassified = [i for i in self.unclassified_objects] self.oeditor.WrapSheet( - ["NAME:Selections", "Selections:=", "{},{}".format(sheet_name, object_name)], + ["NAME:Selections", "Selections:=", "{},{}".format(sheet, object)], ["NAME:WrapSheetParameters", "Imprinted:=", imprinted], ) is_unclassified = [i for i in self.unclassified_objects if i not in unclassified] @@ -5442,10 +5459,10 @@ def wrap_sheet(self, sheet_name, object_name, imprinted=False): self.cleanup_objects() return True - @pyaedt_function_handler() + @pyaedt_function_handler(input_objects_list="assignment") def heal_objects( self, - input_objects_list, + assignment, auto_heal=True, tolerant_stitch=True, simplify_geometry=True, @@ -5478,7 +5495,7 @@ def heal_objects( Parameters ---------- - input_objects_list : str + assignment : str List of object names to analyze. auto_heal : bool, optional Auto heal option. Default value is ``True``. @@ -5541,25 +5558,25 @@ def heal_objects( bool ``True`` when successful, ``False`` when failed. """ - if not input_objects_list: + if not assignment: self.logger.error("Provide an object name or a list of object names as a string.") return False - elif not isinstance(input_objects_list, str): + elif not isinstance(assignment, str): self.logger.error("Provide an object name or a list of object names as a string.") return False - elif "," in input_objects_list: - input_objects_list = input_objects_list.strip() - if ", " in input_objects_list: - input_objects_list_split = input_objects_list.split(", ") + elif "," in assignment: + assignment = assignment.strip() + if ", " in assignment: + input_objects_list_split = assignment.split(", ") else: - input_objects_list_split = input_objects_list.split(",") + input_objects_list_split = assignment.split(",") for obj in input_objects_list_split: if obj not in self.object_names: self.logger.error("Provide an object name or a list of object names that exists in current design.") return False objects_selection = ",".join(input_objects_list_split) else: - objects_selection = input_objects_list + objects_selection = assignment if simplify_type not in [0, 1, 2]: self.logger.error("Invalid simplify type.") @@ -5634,10 +5651,10 @@ def heal_objects( self.oeditor.HealObject(selections_args, healing_parameters) return True - @pyaedt_function_handler() + @pyaedt_function_handler(input_objects_list="assignment") def simplify_objects( self, - input_objects_list, + assignment, simplify_type="Polygon Fit", extrusion_axis="Auto", clean_up=True, @@ -5653,7 +5670,7 @@ def simplify_objects( Parameters ---------- - input_objects_list : str + assignment : str List of object names to simplify. simplify_type : str, optional Simplify type. The default is ``"Polygon Fit"``. Options are @@ -5685,25 +5702,25 @@ def simplify_objects( bool ``True`` when successful, ``False`` when failed. """ - if not input_objects_list: + if not assignment: self.logger.error("Provide an object name or a list of object names as a string.") return False - elif not isinstance(input_objects_list, str): + elif not isinstance(assignment, str): self.logger.error("Provide an object name or a list of object names as a string.") return False - elif "," in input_objects_list: - input_objects_list = input_objects_list.strip() - if ", " in input_objects_list: - input_objects_list_split = input_objects_list.split(", ") + elif "," in assignment: + assignment = assignment.strip() + if ", " in assignment: + input_objects_list_split = assignment.split(", ") else: - input_objects_list_split = input_objects_list.split(",") + input_objects_list_split = assignment.split(",") for obj in input_objects_list_split: if obj not in self.object_names: self.logger.error("Provide an object name or a list of object names that exists in current design.") return False objects_selection = ",".join(input_objects_list_split) else: - objects_selection = input_objects_list + objects_selection = assignment if simplify_type not in ["Polygon Fit", "Primitive Fit", "Bounding Box"]: self.logger.error("Invalid simplify type.") @@ -5744,13 +5761,13 @@ def simplify_objects( self.logger.error("Simplify objects failed.") return False - @pyaedt_function_handler - def get_face_by_id(self, id): + @pyaedt_function_handler(id="assignment") + def get_face_by_id(self, assignment): """Get the face object given its ID. Parameters ---------- - id : int + assignment : int ID of the face to retrieve. Returns @@ -5759,9 +5776,9 @@ def get_face_by_id(self, id): Face object. """ - obj = [o for o in self.object_list for face in o.faces if face.id == id] + obj = [o for o in self.object_list for face in o.faces if face.id == assignment] if obj: - face_obj = [face for face in obj[0].faces if face.id == id][0] + face_obj = [face for face in obj[0].faces if face.id == assignment][0] return face_obj else: return False @@ -5949,14 +5966,14 @@ def _change_plane_property(self, vPropChange, names_list): self.cleanup_objects() return True - @pyaedt_function_handler() - def update_object(self, obj): + @pyaedt_function_handler(obj="assignment") + def update_object(self, assignment): """Update any :class:`pyaedt.modeler.Object3d.Object3d` derivatives that have potentially been modified by a modeler operation. Parameters ---------- - obj : int, str, or :class:`pyaedt.modeler.Object3d.Object3d` + assignment : int, str, or :class:`pyaedt.modeler.Object3d.Object3d` Object to be updated after a modeler operation. Returns @@ -5965,7 +5982,7 @@ def update_object(self, obj): Updated 3D object. """ - o = self._resolve_object(obj) + o = self._resolve_object(assignment) name = o.name del self.objects[self.objects_by_name[name].id] @@ -6017,13 +6034,13 @@ def value_in_object_units(self, value): else: return numeric_list - @pyaedt_function_handler() - def does_object_exists(self, obj_to_check): + @pyaedt_function_handler(obj_to_check="assignment") + def does_object_exists(self, assignment): """Check to see if an object exists. Parameters ---------- - obj_to_check : str, int + assignment : str, int Object name or object ID. Returns @@ -6032,15 +6049,15 @@ def does_object_exists(self, obj_to_check): ``True`` when successful, ``False`` when failed. """ - if isinstance(obj_to_check, int) and obj_to_check in self.objects: + if isinstance(assignment, int) and assignment in self.objects: return True - elif obj_to_check in self.objects_by_name: + elif assignment in self.objects_by_name: return True else: return False - @pyaedt_function_handler - def create_subregion(self, padding_values, padding_types, parts, region_name=None): + @pyaedt_function_handler(parts="assignment", region_name="name") + def create_subregion(self, padding_values, padding_types, assignment, name=None): """Create a subregion. Parameters @@ -6057,9 +6074,9 @@ def create_subregion(self, padding_values, padding_types, parts, region_name=Non ``"Transverse Percentage Offset"``. When using a list, different padding types can be provided for different directions. - parts : list of str + assignment : list of str One or more names of the parts to include in the subregion. - region_name : str, optional + name : str, optional Region name. The default is ``None``, in which case the name is generated automatically. @@ -6073,14 +6090,12 @@ def create_subregion(self, padding_values, padding_types, parts, region_name=Non >>> oEditor.CreateRegion """ - if region_name is None: - region_name = generate_unique_name("SubRegion") + if name is None: + name = generate_unique_name("SubRegion") is_percentage = padding_types in ["Percentage Offset", "Transverse Percentage Offset"] - arg, arg2 = self._parse_region_args( - padding_values, padding_types, region_name, parts, "SubRegion", is_percentage - ) + arg, arg2 = self._parse_region_args(padding_values, padding_types, name, assignment, "SubRegion", is_percentage) self.oeditor.CreateSubregion(arg, arg2) - return self._create_object(region_name) + return self._create_object(name) def reassign_subregion(self, region, parts): """Modify parts in the subregion. @@ -6175,25 +6190,25 @@ def _parse_region_args(self, pad_value, pad_type, region_name, parts, region_typ ] return arg, arg2 - @pyaedt_function_handler() + @pyaedt_function_handler(region_name="name") def _create_region( - self, pad_value=300, pad_type="Percentage Offset", region_name="Region", parts=None, region_type="Region" + self, pad_value=300, pad_type="Percentage Offset", name="Region", parts=None, region_type="Region" ): - if region_name in self._app.modeler.objects_by_name: - self._app.logger.error("{} object already exists".format(region_name)) + if name in self._app.modeler.objects_by_name: + self._app.logger.error("{} object already exists".format(name)) return False if not isinstance(pad_value, list): pad_value = [pad_value] * 6 is_percentage = pad_type in ["Percentage Offset", "Transverse Percentage Offset"] - arg, arg2 = self._parse_region_args(pad_value, pad_type, region_name, parts, region_type, is_percentage) + arg, arg2 = self._parse_region_args(pad_value, pad_type, name, parts, region_type, is_percentage) if arg and arg2: self.oeditor.CreateRegion(arg, arg2) - return self._create_object(region_name) + return self._create_object(name) else: return False - @pyaedt_function_handler() - def create_region(self, pad_value=300, pad_type="Percentage Offset", region_name="Region", **kwarg): + @pyaedt_function_handler(region_name="name") + def create_region(self, pad_value=300, pad_type="Percentage Offset", name="Region", **kwarg): """Create an air region. Parameters @@ -6210,7 +6225,7 @@ def create_region(self, pad_value=300, pad_type="Percentage Offset", region_name ``"Transverse Percentage Offset"``. When using a list, different padding types can be provided for different directions. - region_name : str, optional + name : str, optional Region name. The default is ``None``, in which case the name is generated automatically. @@ -6242,15 +6257,15 @@ def create_region(self, pad_value=300, pad_type="Percentage Offset", region_name if isinstance(pad_value, list): pad_value = [pad_value[i // 2 + 3 * (i % 2)] for i in range(6)] - return self._create_region(pad_value, pad_type, region_name, region_type="Region") + return self._create_region(pad_value, pad_type, name, region_type="Region") - @pyaedt_function_handler() - def create_object_from_edge(self, edge, non_model=False): + @pyaedt_function_handler(edge="assignment") + def create_object_from_edge(self, assignment, non_model=False): """Create an object from one or multiple edges. Parameters ---------- - edge : list, int or :class:`pyaedt.modeler.Object3d.FacePrimitive` + assignment : list, int or :class:`pyaedt.modeler.Object3d.FacePrimitive` Face ID or :class:`pyaedt.modeler.Object3d.FacePrimitive` object or Face List. non_model : bool, optional Either if create the new object as model or non-model. The default is `False`. @@ -6265,7 +6280,7 @@ def create_object_from_edge(self, edge, non_model=False): >>> oEditor.CreateObjectFromFaces """ - edge_ids = self.convert_to_selections(edge, True) + edge_ids = self.convert_to_selections(assignment, True) objs = OrderedDict() for edge_id in edge_ids: obj_name = self._find_object_from_edge_id(edge_id) @@ -6294,13 +6309,13 @@ def create_object_from_edge(self, edge, non_model=False): self.logger.error("Error creating object from edges.") return - @pyaedt_function_handler() - def create_object_from_face(self, face, non_model=False): + @pyaedt_function_handler(face="assignment") + def create_object_from_face(self, assignment, non_model=False): """Create an object from one or multiple face. Parameters ---------- - face : list, int or :class:`pyaedt.modeler.Object3d.FacePrimitive` + assignment : list, int or :class:`pyaedt.modeler.Object3d.FacePrimitive` Face ID or :class:`pyaedt.modeler.Object3d.FacePrimitive` object or Face List. non_model : bool, optional Either if create the new object as model or non-model. Default is `False`. @@ -6315,7 +6330,7 @@ def create_object_from_face(self, face, non_model=False): >>> oEditor.CreateObjectFromFaces """ - face_ids = self.convert_to_selections(face, True) + face_ids = self.convert_to_selections(assignment, True) objs = OrderedDict() for face_id in face_ids: obj_name = self._find_object_from_face_id(face_id) @@ -6389,15 +6404,15 @@ def polyline_segment(self, type, num_seg=0, num_points=0, arc_angle=0, arc_cente arc_plane=arc_plane, ) - @pyaedt_function_handler() + @pyaedt_function_handler(position_list="points", matname="material") def create_polyline( self, - position_list, + points, segment_type=None, cover_surface=False, close_surface=False, name=None, - matname=None, + material=None, xsection_type=None, xsection_orient=None, xsection_width=1, @@ -6420,7 +6435,7 @@ def create_polyline( Parameters ---------- - position_list : list + points : list Array of positions of each point of the polyline. A position is a list of 2D or 3D coordinates. Position coordinate values can be numbers or valid AEDT string @@ -6440,7 +6455,7 @@ def create_polyline( starting and ending points. name : str, optional Name of the polyline. The default is ``None``. - matname : str, optional + material : str, optional Name of the material. The default is ``None``, in which case the default material is assigned. xsection_type : str, optional @@ -6501,25 +6516,24 @@ def create_polyline( The default behavior assumes that all points are to be connected by line segments. Optionally specify the name. - >>> P1 = modeler.create_polyline(test_points, name="PL_line_segments") + >>> P1 = modeler.create_polyline(test_points,name="PL_line_segments") Specify that the first segment is a line and the last three points define a three-point arc. - >>> P2 = modeler.create_polyline(test_points, segment_type=["Line", "Arc"], name="PL_line_plus_arc") + >>> P2 = modeler.create_polyline(test_points,segment_type=["Line", "Arc"],name="PL_line_plus_arc") Redraw the 3-point arc alone from the last three points and additionally specify five segments using ``PolylineSegment``. - >>> P3 = modeler.create_polyline(test_points[1:], - ... segment_type=PolylineSegment(segment_type="Arc", num_seg=7), - ... name="PL_segmented_arc") + >>> P3 = modeler.create_polyline(test_points[1:],segment_type=PolylineSegment(segment_type="Arc", num_seg=7), + ... name="PL_segmented_arc") Specify that the four points form a spline and add a circular cross-section with a diameter of 1 mm. - >>> P4 = modeler.create_polyline(test_points, segment_type="Spline", name="PL_spline", - ... xsection_type="Circle", xsection_width="1mm") + >>> P4 = modeler.create_polyline(test_points,segment_type="Spline",name="PL_spline", + ... xsection_type="Circle",xsection_width="1mm") Use the `PolylineSegment` object to specify more detail about the individual segments. Create a center point arc starting @@ -6530,25 +6544,25 @@ def create_polyline( >>> center_point = test_points[0] >>> segment_def = PolylineSegment(segment_type="AngularArc", arc_center=center_point, ... arc_angle="90deg", arc_plane="XY") - >>> modeler.create_polyline(start_point, segment_type=segment_def, name="PL_center_point_arc") + >>> modeler.create_polyline(start_point,segment_type=segment_def,name="PL_center_point_arc") Create a spline using a list of variables for the coordinates of the points. >>> x0, y0, z0 = "0", "0", "1" >>> x1, y1, z1 = "1", "3", "1" >>> x2, y2, z2 = "2", "2", "1" - >>> P5 = modeler.create_polyline(position_list = [[x0, y0, z0], [x1, y1, z1], [x2, y2, z2]], - ... segment_type="Spline", name="polyline_with_variables") + >>> P5 = modeler.create_polyline(points=[[x0, y0, z0], [x1, y1, z1], [x2, y2, z2]], + ... segment_type="Spline",name="polyline_with_variables") """ new_polyline = Polyline( primitives=self, - position_list=position_list, + position_list=points, segment_type=segment_type, cover_surface=cover_surface, close_surface=close_surface, name=name, - matname=matname, + matname=material, xsection_type=xsection_type, xsection_orient=xsection_orient, xsection_width=xsection_width, @@ -6560,14 +6574,17 @@ def create_polyline( ) return new_polyline - @pyaedt_function_handler() - def create_spiral_on_face(self, face, poly_width, filling_factor=1.5): + @pyaedt_function_handler( + face="assignment", + poly_width="width", + ) + def create_spiral_on_face(self, assignment, width, filling_factor=1.5): """Create a Spiral Polyline inside a face. Parameters ---------- - face : int or str or :class:`pyaedt.modeler.elements3d.FacePrimitive` - poly_width : float + assignment : int or str or :class:`pyaedt.modeler.elements3d.FacePrimitive` + width : float filling_factor : float Returns @@ -6575,12 +6592,12 @@ def create_spiral_on_face(self, face, poly_width, filling_factor=1.5): :class:`pyaedt.modeler.Object3d.Polyline` """ # fmt: off - if isinstance(face, FacePrimitive): - face_id = face.id - elif isinstance(face, int): - face_id = face + if isinstance(assignment, FacePrimitive): + face_id = assignment.id + elif isinstance(assignment, int): + face_id = assignment else: - face_id = self.get_object_faces(face)[0] + face_id = self.get_object_faces(assignment)[0] vertices = self.get_face_vertices(face_id) vertex_coordinates = [] @@ -6593,7 +6610,7 @@ def create_spiral_on_face(self, face, poly_width, filling_factor=1.5): for vc in vertex_coordinates: segments_lengths.append(GeometryOperators.points_distance(vc, centroid)) - n = math.floor(min(segments_lengths) / (poly_width * filling_factor)) + n = math.floor(min(segments_lengths) / (width * filling_factor)) if n % 2 == 0: n_points = int(n / 2 - 1) @@ -6620,10 +6637,10 @@ def create_spiral_on_face(self, face, poly_width, filling_factor=1.5): del poly_points_list[-1] # fmt: on - return self.create_polyline(poly_points_list, xsection_type="Line", xsection_width=poly_width) + return self.create_polyline(poly_points_list, xsection_type="Line", xsection_width=width) - @pyaedt_function_handler() - def get_existing_polyline(self, object): + @pyaedt_function_handler(object="assignment") + def get_existing_polyline(self, assignment): """Retrieve a polyline object to manipulate it. Parameters @@ -6635,20 +6652,24 @@ def get_existing_polyline(self, object): ------- Polyline """ - return Polyline(self, src_object=object) + return Polyline(self, src_object=assignment) - @pyaedt_function_handler() - def create_udp(self, udp_dll_name, udp_parameters_list, upd_library="syslib", name=None): + @pyaedt_function_handler( + udp_dll_name="dll", + udp_parameters_list="parameters", + upd_library="library", + ) + def create_udp(self, dll, parameters, library="syslib", name=None): """Create a user-defined primitive (UDP). Parameters ---------- - udp_dll_name : str + dll : str Name of the UDP DLL or Python file. The default for the file format is ``".dll"``. - udp_parameters_list : + parameters : List of the UDP parameters. - upd_library : str, optional + library : str, optional Name of the UDP library. The default is ``"syslib"``. name : str, optional Name of the component. The default is ``None``. @@ -6665,26 +6686,24 @@ def create_udp(self, udp_dll_name, udp_parameters_list, upd_library="syslib", na Examples -------- - >>> my_udp = self.aedtapp.modeler.create_udp(udp_dll_name="RMxprt/ClawPoleCore", - ... udp_parameters_list=my_udpPairs, - ... upd_library="syslib") + >>> my_udp = self.aedtapp.modeler.create_udp(dll="RMxprt/ClawPoleCore",parameters=my_udpPairs,library="syslib") """ - if ".dll" not in udp_dll_name and ".py" not in udp_dll_name: + if ".dll" not in dll and ".py" not in dll: vArg1 = [ "NAME:UserDefinedPrimitiveParameters", "DllName:=", - udp_dll_name + ".dll", + dll + ".dll", "Library:=", - upd_library, + library, ] else: - vArg1 = ["NAME:UserDefinedPrimitiveParameters", "DllName:=", udp_dll_name, "Library:=", upd_library] + vArg1 = ["NAME:UserDefinedPrimitiveParameters", "DllName:=", dll, "Library:=", library] vArgParamVector = ["NAME:ParamVector"] - for pair in udp_parameters_list: + for pair in parameters: if isinstance(pair, list): vArgParamVector.append(["NAME:Pair", "Name:=", pair[0], "Value:=", pair[1]]) @@ -6695,22 +6714,22 @@ def create_udp(self, udp_dll_name, udp_parameters_list, upd_library="syslib", na if name: obj_name = name else: - obj_name, ext = os.path.splitext(os.path.basename(udp_dll_name)) + obj_name, ext = os.path.splitext(os.path.basename(dll)) vArg2 = self._default_object_attributes(name=obj_name) obj_name = self.oeditor.CreateUserDefinedPart(vArg1, vArg2) return self._create_object(obj_name) - @pyaedt_function_handler() - def update_udp(self, object_name, operation_name, udp_parameters_list): + @pyaedt_function_handler(object_name="assignment", operation_name="operation", udp_parameters_list="parameters") + def update_udp(self, assignment, operation, parameters): """Update an existing geometrical object that was originally created using a user-defined primitive (UDP). Parameters ---------- - object_name : str + assignment : str Name of the object to update. - operation_name : str + operation : str Name of the operation used to create the object. - udp_parameters_list : list + parameters : list List of the UDP parameters to update and their value. Returns @@ -6725,9 +6744,8 @@ def update_udp(self, object_name, operation_name, udp_parameters_list): Examples -------- - >>> self.aedtapp.modeler.update_udp(object_name="ClawPoleCore", - ... operation_name="CreateUserDefinedPart", - ... udp_parameters_list=[["Length","110mm"], ["DiaGap","125mm"]]) + >>> self.aedtapp.modeler.update_udp(assignment="ClawPoleCore",operation="CreateUserDefinedPart", + ... parameters=[["Length","110mm"], ["DiaGap","125mm"]]) True """ @@ -6735,14 +6753,14 @@ def update_udp(self, object_name, operation_name, udp_parameters_list): vArg1 = ["NAME:AllTabs"] prop_servers = ["NAME:PropServers"] - prop_servers.append("{0}:{1}:1".format(object_name, operation_name)) + prop_servers.append("{0}:{1}:1".format(assignment, operation)) cmd_tab = ["NAME:Geometry3DCmdTab"] cmd_tab.append(prop_servers) changed_props = ["NAME:ChangedProps"] - for pair in udp_parameters_list: + for pair in parameters: if isinstance(pair, list): changed_props.append(["NAME:{0}".format(pair[0]), "Value:=", pair[1]]) else: @@ -6753,13 +6771,13 @@ def update_udp(self, object_name, operation_name, udp_parameters_list): self.oeditor.ChangeProperty(vArg1) return True - @pyaedt_function_handler() - def delete(self, objects=None): + @pyaedt_function_handler(objects="assignment") + def delete(self, assignment=None): """Delete objects or groups. Parameters ---------- - objects : list, optional + assignment : list, optional List of objects or group names. The default is ``None``, in which case all objects are deleted. @@ -6774,24 +6792,24 @@ def delete(self, objects=None): >>> oEditor.Delete """ - if objects is None: - objects = self.object_names - objects = self._modeler.convert_to_selections(objects, return_list=True) - for el in objects: + if assignment is None: + assignment = self.object_names + assignment = self._modeler.convert_to_selections(assignment, return_list=True) + for el in assignment: if ( el not in self.object_names and not list(self.oeditor.GetObjectsInGroup(el)) and not self.oeditor.GetObjectsInGroup("Unclassified") ): - objects.remove(el) - if not objects: + assignment.remove(el) + if not assignment: self.logger.warning("No objects to delete") return False - slice = min(100, len(objects)) - num_objects = len(objects) + slice = min(100, len(assignment)) + num_objects = len(assignment) remaining = num_objects while remaining > 0: - objs = objects[:slice] + objs = assignment[:slice] objects_str = self._modeler.convert_to_selections(objs, return_list=False) arg = ["NAME:Selections", "Selections:=", objects_str] try: @@ -6800,11 +6818,11 @@ def delete(self, objects=None): self.logger.warning("Failed to delete {}.".format(objects_str)) remaining -= slice if remaining > 0: - objects = objects[slice:] + assignment = assignment[slice:] self._refresh_object_types() - if len(objects) > 0: + if len(assignment) > 0: self.cleanup_objects() self.logger.info("Deleted {} Objects: {}.".format(num_objects, objects_str)) return True @@ -6845,13 +6863,13 @@ def delete_objects_containing(self, contained_string, case_sensitive=True): self.logger.info("Deleted %s objects", num_del) return True - @pyaedt_function_handler() - def get_obj_id(self, objname): + @pyaedt_function_handler(objname="assignment") + def get_obj_id(self, assignment): """Return the object ID from an object name. Parameters ---------- - objname : str + assignment : str Name of the object. Returns @@ -6860,17 +6878,17 @@ def get_obj_id(self, objname): Object ID. """ - if objname in self.objects_by_name: - return self.objects_by_name[objname].id + if assignment in self.objects_by_name: + return self.objects_by_name[assignment].id return None - @pyaedt_function_handler() - def get_object_from_name(self, objname): + @pyaedt_function_handler(objname="assignment") + def get_object_from_name(self, assignment): """Return the object from an object name. Parameters ---------- - objname : str + assignment : str Name of the object. Returns @@ -6879,17 +6897,17 @@ def get_object_from_name(self, objname): 3D object returned. """ - if objname in self.object_names: + if assignment in self.object_names: # object_id = self.get_obj_id(objname) - return self.objects[objname] + return self.objects[assignment] - @pyaedt_function_handler() - def get_objects_w_string(self, stringname, case_sensitive=True): + @pyaedt_function_handler(stringname="string_name") + def get_objects_w_string(self, string_name, case_sensitive=True): """Retrieve all objects with a given string in their names. Parameters ---------- - stringname : str + string_name : str String to search object names for. case_sensitive : bool, optional Whether the string is case-sensitive. The default is ``True``. @@ -6903,24 +6921,24 @@ def get_objects_w_string(self, stringname, case_sensitive=True): list_objs = [] for name in list(self.objects_by_name.keys()): if case_sensitive: - if stringname in name: + if string_name in name: list_objs.append(name) else: - if stringname.lower() in name.lower(): + if string_name.lower() in name.lower(): list_objs.append(name) return list_objs - @pyaedt_function_handler() - def find_closest_edges(self, start_obj, end_obj, port_direction=0): + @pyaedt_function_handler(start_obj="start_object", end_obj="end_object", port_direction="direction") + def find_closest_edges(self, start_object, end_object, direction=0): """Retrieve the two closest edges that are not perpendicular for two objects. Parameters ---------- - start_obj : str + start_object : str Name of the starting object. - end_obj : str + end_object : str Name of the ending object. - port_direction : str, optional + direction : str, optional Direction of the port to which to give edges precedence when more than two couples are at the same distance. For example, for a coax or microstrip, precedence is given to the edges that are on the given axis direction, such as ``"XNeg"``. Options are @@ -6933,44 +6951,44 @@ def find_closest_edges(self, start_obj, end_obj, port_direction=0): List with two edges if present. """ - start_obj = self._resolve_object(start_obj) - end_obj = self._resolve_object(end_obj) + start_object = self._resolve_object(start_object) + end_object = self._resolve_object(end_object) edge_start_list = None edge_stop_list = None - if port_direction == 0: - if start_obj.bottom_face_x: - edge_start_list = start_obj.bottom_face_x.edges - if end_obj.bottom_face_x: - edge_stop_list = end_obj.bottom_face_x.edges - elif port_direction == 3: - if start_obj.top_face_x: - edge_start_list = start_obj.top_face_x.edges - if end_obj.top_face_x: - edge_stop_list = end_obj.top_face_x.edges - elif port_direction == 1: - if start_obj.bottom_face_y: - edge_start_list = start_obj.bottom_face_y.edges - if end_obj.bottom_face_y: - edge_stop_list = end_obj.bottom_face_y.edges - elif port_direction == 4: - if start_obj.top_face_y: - edge_start_list = start_obj.top_face_y.edges - if end_obj.top_face_y: - edge_stop_list = end_obj.top_face_y.edges - elif port_direction == 2: - if start_obj.bottom_face_z: - edge_start_list = start_obj.bottom_face_z.edges - if end_obj.bottom_face_z: - edge_stop_list = end_obj.bottom_face_z.edges - elif port_direction == 5: - if start_obj.top_face_z: - edge_start_list = start_obj.top_face_z.edges - if end_obj.top_face_z: - edge_stop_list = end_obj.top_face_z.edges + if direction == 0: + if start_object.bottom_face_x: + edge_start_list = start_object.bottom_face_x.edges + if end_object.bottom_face_x: + edge_stop_list = end_object.bottom_face_x.edges + elif direction == 3: + if start_object.top_face_x: + edge_start_list = start_object.top_face_x.edges + if end_object.top_face_x: + edge_stop_list = end_object.top_face_x.edges + elif direction == 1: + if start_object.bottom_face_y: + edge_start_list = start_object.bottom_face_y.edges + if end_object.bottom_face_y: + edge_stop_list = end_object.bottom_face_y.edges + elif direction == 4: + if start_object.top_face_y: + edge_start_list = start_object.top_face_y.edges + if end_object.top_face_y: + edge_stop_list = end_object.top_face_y.edges + elif direction == 2: + if start_object.bottom_face_z: + edge_start_list = start_object.bottom_face_z.edges + if end_object.bottom_face_z: + edge_stop_list = end_object.bottom_face_z.edges + elif direction == 5: + if start_object.top_face_z: + edge_start_list = start_object.top_face_z.edges + if end_object.top_face_z: + edge_stop_list = end_object.top_face_z.edges if not edge_start_list: - edge_start_list = start_obj.edges + edge_start_list = start_object.edges if not edge_stop_list: - edge_stop_list = end_obj.edges + edge_stop_list = end_object.edges mindist = 1e6 tol = 1e-12 pos_tol = 1e-6 @@ -6980,7 +6998,7 @@ def find_closest_edges(self, start_obj, end_obj, port_direction=0): for el in edge_start_list: vertices_i = el.vertices if not vertices_i: - for f in start_obj.faces: + for f in start_object.faces: if len(f.edges) == 1: edges_ids = [i.id for i in f.edges] if el.id in edges_ids: @@ -7002,7 +7020,7 @@ def find_closest_edges(self, start_obj, end_obj, port_direction=0): for el1 in edge_stop_list: vertices_j = el1.vertices if not vertices_j: - for f in end_obj.faces: + for f in end_object.faces: if len(f.edges) == 1: edges_ids = [i.id for i in f.edges] if el1.id in edges_ids: @@ -7062,45 +7080,51 @@ def find_closest_edges(self, start_obj, end_obj, port_direction=0): if actual_point is None: edge_list = [el, el1] is_parallel = parallel_edges - actual_point = GeometryOperators.find_point_on_plane([start_midpoint, end_midpoint], port_direction) + actual_point = GeometryOperators.find_point_on_plane([start_midpoint, end_midpoint], direction) mindist = vert_dist_sum else: - new_point = GeometryOperators.find_point_on_plane([start_midpoint, end_midpoint], port_direction) - if (port_direction <= 2 and new_point - actual_point < 0) or ( - port_direction > 2 and actual_point - new_point < 0 + new_point = GeometryOperators.find_point_on_plane([start_midpoint, end_midpoint], direction) + if (direction <= 2 and new_point - actual_point < 0) or ( + direction > 2 and actual_point - new_point < 0 ): edge_list = [el, el1] is_parallel = parallel_edges actual_point = new_point mindist = vert_dist_sum - elif port_direction <= 2 and new_point - actual_point < tol and vert_dist_sum - mindist < pos_tol: + elif direction <= 2 and new_point - actual_point < tol and vert_dist_sum - mindist < pos_tol: edge_list = [el, el1] is_parallel = parallel_edges actual_point = new_point mindist = vert_dist_sum - elif port_direction > 2 and actual_point - new_point < tol and vert_dist_sum - mindist < pos_tol: + elif direction > 2 and actual_point - new_point < tol and vert_dist_sum - mindist < pos_tol: edge_list = [el, el1] is_parallel = parallel_edges actual_point = new_point mindist = vert_dist_sum return edge_list, is_parallel - @pyaedt_function_handler() - def get_equivalent_parallel_edges(self, edgelist, portonplane=True, axisdir=0, startobj="", endobject=""): + @pyaedt_function_handler( + edgelist="assignment", + portonplane="port_on_plane", + axisdir="axis", + startobj="start_object", + endobject="end_object", + ) + def get_equivalent_parallel_edges(self, assignment, port_on_plane=True, axis=0, start_object="", end_object=""): """Create two new edges that are parallel and equal to the smallest edge given a parallel couple of edges. Parameters ---------- - edgelist : list + assignment : list List of two parallel edges. - portonplane : bool, optional + port_on_plane : bool, optional Whether edges are to be on the plane orthogonal to the axis direction. The default is ``True``. - axisdir : int, optional + axis : int, optional Axis direction. Choices are ``0`` through ``5``. The default is ``0``. - startobj : str, optional + start_object : str, optional Name of the starting object. The default is ``""``. - endobject : str, optional + end_object : str, optional Name of the ending object. The default is ``""``. Returns @@ -7109,19 +7133,19 @@ def get_equivalent_parallel_edges(self, edgelist, portonplane=True, axisdir=0, s List of two created edges. """ - if isinstance(edgelist[0], str): - edgelist[0] = self.get_object_from_name(edgelist[0]) - if isinstance(edgelist[1], str): - edgelist[1] = self.get_object_from_name(edgelist[1]) + if isinstance(assignment[0], str): + assignment[0] = self.get_object_from_name(assignment[0]) + if isinstance(assignment[1], str): + assignment[1] = self.get_object_from_name(assignment[1]) - l1 = edgelist[0].length - l2 = edgelist[1].length + l1 = assignment[0].length + l2 = assignment[1].length if l1 < l2: - orig_edge = edgelist[0] - dest_edge = edgelist[1] + orig_edge = assignment[0] + dest_edge = assignment[1] else: - orig_edge = edgelist[1] - dest_edge = edgelist[0] + orig_edge = assignment[1] + dest_edge = assignment[0] first_edge = self.create_object_from_edge(orig_edge) second_edge = self.create_object_from_edge(orig_edge) @@ -7132,8 +7156,8 @@ def get_equivalent_parallel_edges(self, edgelist, portonplane=True, axisdir=0, s a1 = ver2[0].position a2 = ver2[1].position vect = GeometryOperators.distance_vector(p, a1, a2) - if portonplane: - vect[divmod(axisdir, 3)[1]] = 0 + if port_on_plane: + vect[divmod(axis, 3)[1]] = 0 # TODO: can we avoid this translate operation - is there another way to check ? self.move(second_edge, vect) p_check = second_edge.vertices[0].position @@ -7149,7 +7173,9 @@ def get_equivalent_parallel_edges(self, edgelist, portonplane=True, axisdir=0, s obj_check = self.get_bodynames_from_position(p_check) obj_check2 = self.get_bodynames_from_position(p_check2) # if (startobj in obj_check and endobject in obj_check2) or (startobj in obj_check2 and endobject in obj_check): - if (startobj in obj_check or endobject in obj_check) and (startobj in obj_check2 or endobject in obj_check2): + if (start_object in obj_check or end_object in obj_check) and ( + start_object in obj_check2 or end_object in obj_check2 + ): if l1 < l2: return_edges = [first_edge, second_edge] else: @@ -7160,13 +7186,13 @@ def get_equivalent_parallel_edges(self, edgelist, portonplane=True, axisdir=0, s self.delete(first_edge) return None - @pyaedt_function_handler() - def get_object_faces(self, partId): + @pyaedt_function_handler(partId="assignment") + def get_object_faces(self, assignment): """Retrieve the face IDs of a given object ID or object name. Parameters ---------- - partId : int or str + assignment : int or str Object ID or object name. Returns @@ -7181,23 +7207,23 @@ def get_object_faces(self, partId): """ oFaceIDs = [] - if isinstance(partId, str) and partId in self.objects_by_name: - oFaceIDs = self.oeditor.GetFaceIDs(partId) + if isinstance(assignment, str) and assignment in self.objects_by_name: + oFaceIDs = self.oeditor.GetFaceIDs(assignment) oFaceIDs = [int(i) for i in oFaceIDs] - elif partId in self.objects: - o = self.objects[partId] + elif assignment in self.objects: + o = self.objects[assignment] name = o.name oFaceIDs = self.oeditor.GetFaceIDs(name) oFaceIDs = [int(i) for i in oFaceIDs] return oFaceIDs - @pyaedt_function_handler() - def get_object_edges(self, partId): + @pyaedt_function_handler(partId="assignment") + def get_object_edges(self, assignment): """Retrieve the edge IDs of a given object ID or object name. Parameters ---------- - partId : int or str + assignment : int or str Object ID or object name. Returns @@ -7212,22 +7238,22 @@ def get_object_edges(self, partId): """ oEdgeIDs = [] - if isinstance(partId, str) and partId in self._object_names_to_ids: - oEdgeIDs = self.oeditor.GetEdgeIDsFromObject(partId) + if isinstance(assignment, str) and assignment in self._object_names_to_ids: + oEdgeIDs = self.oeditor.GetEdgeIDsFromObject(assignment) oEdgeIDs = [int(i) for i in oEdgeIDs] - elif partId in self.objects: - o = self.objects[partId] + elif assignment in self.objects: + o = self.objects[assignment] oEdgeIDs = self.oeditor.GetEdgeIDsFromObject(o.name) oEdgeIDs = [int(i) for i in oEdgeIDs] return oEdgeIDs - @pyaedt_function_handler() - def get_face_edges(self, partId): + @pyaedt_function_handler(partID="assignment") + def get_face_edges(self, assignment): """Retrieve the edge IDs of a given face name or face ID. Parameters ---------- - partId : int or str + assignment : int or str Object ID or object name. Returns @@ -7241,17 +7267,17 @@ def get_face_edges(self, partId): >>> oEditor.GetEdgeIDsFromFace """ - oEdgeIDs = self.oeditor.GetEdgeIDsFromFace(partId) + oEdgeIDs = self.oeditor.GetEdgeIDsFromFace(assignment) oEdgeIDs = [int(i) for i in oEdgeIDs] return oEdgeIDs - @pyaedt_function_handler() - def get_object_vertices(self, partID): + @pyaedt_function_handler(partID="assignment") + def get_object_vertices(self, assignment): """Retrieve the vertex IDs of a given object name or object ID. Parameters ---------- - partID : int or str + assignment : int or str Object ID or object name. Returns @@ -7266,22 +7292,22 @@ def get_object_vertices(self, partID): """ oVertexIDs = [] - if isinstance(partID, str) and partID in self._object_names_to_ids: - oVertexIDs = self.oeditor.GetVertexIDsFromObject(partID) + if isinstance(assignment, str) and assignment in self._object_names_to_ids: + oVertexIDs = self.oeditor.GetVertexIDsFromObject(assignment) oVertexIDs = [int(i) for i in oVertexIDs] - elif partID in self.objects: - o = self.objects[partID] + elif assignment in self.objects: + o = self.objects[assignment] oVertexIDs = self.oeditor.GetVertexIDsFromObject(o.name) oVertexIDs = [int(i) for i in oVertexIDs] return oVertexIDs - @pyaedt_function_handler() - def get_face_vertices(self, face_id): + @pyaedt_function_handler(face_id="assignment") + def get_face_vertices(self, assignment): """Retrieve the vertex IDs of a given face ID or face name. Parameters ---------- - face_id : int or str + assignment : int or str Object ID or object name, which is available using the methods :func:`pyaedt.modeler.Primitives3D.Primitives3D.get_object_vertices` or :func:`pyaedt.modeler.Primitives2D.Primitives2D.get_object_vertices`. @@ -7298,20 +7324,20 @@ def get_face_vertices(self, face_id): """ try: - oVertexIDs = self.oeditor.GetVertexIDsFromFace(face_id) + oVertexIDs = self.oeditor.GetVertexIDsFromFace(assignment) except Exception: oVertexIDs = [] else: oVertexIDs = [int(i) for i in oVertexIDs] return oVertexIDs - @pyaedt_function_handler() - def get_edge_length(self, edgeID): + @pyaedt_function_handler(edgeID="assignment") + def get_edge_length(self, assignment): """Get the length of an edge. Parameters ---------- - edgeID : int + assignment : int ID of the edge. Returns @@ -7320,7 +7346,7 @@ def get_edge_length(self, edgeID): Edge length. """ - vertexID = self.get_edge_vertices(edgeID) + vertexID = self.get_edge_vertices(assignment) pos1 = self.get_vertex_position(vertexID[0]) if len(vertexID) < 2: return 0 @@ -7328,13 +7354,13 @@ def get_edge_length(self, edgeID): length = GeometryOperators.points_distance(pos1, pos2) return length - @pyaedt_function_handler() - def get_edge_vertices(self, edgeID): + @pyaedt_function_handler(edgeID="assignment") + def get_edge_vertices(self, assignment): """Retrieve the vertex IDs of a given edge ID or edge name. Parameters ---------- - edgeID : int, str + assignment : int, str Object ID or object name, which is available using the methods :func:`pyaedt.modeler.Primitives3D.Primitives3D.get_object_vertices` or :func:`pyaedt.modeler.Primitives2D.Primitives2D.get_object_vertices`. @@ -7351,20 +7377,20 @@ def get_edge_vertices(self, edgeID): """ try: - oVertexIDs = self.oeditor.GetVertexIDsFromEdge(edgeID) + oVertexIDs = self.oeditor.GetVertexIDsFromEdge(assignment) except Exception: oVertexIDs = [] else: oVertexIDs = [int(i) for i in oVertexIDs] return oVertexIDs - @pyaedt_function_handler() - def get_vertex_position(self, vertex_id): + @pyaedt_function_handler(vertex_id="assignment") + def get_vertex_position(self, assignment): """Retrieve a vector of vertex coordinates. Parameters ---------- - vertex_id : int or str + assignment : int or str ID or name of the vertex. Returns @@ -7379,20 +7405,20 @@ def get_vertex_position(self, vertex_id): """ try: - pos = self.oeditor.GetVertexPosition(vertex_id) + pos = self.oeditor.GetVertexPosition(assignment) except Exception: position = [] else: position = [float(i) for i in pos] return position - @pyaedt_function_handler() - def get_face_area(self, face_id): + @pyaedt_function_handler(face_id="assignment") + def get_face_area(self, assignment): """Retrieve the area of a given face ID. Parameters ---------- - face_id : int + assignment : int ID of the face. Returns @@ -7407,16 +7433,16 @@ def get_face_area(self, face_id): """ - area = self.oeditor.GetFaceArea(face_id) + area = self.oeditor.GetFaceArea(assignment) return area - @pyaedt_function_handler() - def get_face_center(self, face_id): + @pyaedt_function_handler(face_id="assignment") + def get_face_center(self, assignment): """Retrieve the center position for a given planar face ID. Parameters ---------- - face_id : int + assignment : int ID of the face. Returns @@ -7432,22 +7458,22 @@ def get_face_center(self, face_id): """ try: - c = self.oeditor.GetFaceCenter(face_id) + c = self.oeditor.GetFaceCenter(assignment) except Exception: self.logger.warning("Non Planar Faces doesn't provide any Face Center") return False center = [float(i) for i in c] return center - @pyaedt_function_handler() - def get_mid_points_on_dir(self, sheet, axisdir): + @pyaedt_function_handler(sheet="assignment", axisdir="axis") + def get_mid_points_on_dir(self, assignment, axis): """Retrieve midpoints on a given axis direction. Parameters ---------- - sheet : + assignment : - axisdir : int + axis : int Axis direction. Choices are ``0`` through ``5``. Returns @@ -7455,8 +7481,8 @@ def get_mid_points_on_dir(self, sheet, axisdir): type """ - edgesid = self.get_object_edges(sheet) - id_ = divmod(axisdir, 3)[1] + edgesid = self.get_object_edges(assignment) + id_ = divmod(axis, 3)[1] midpoint_array = [] for ed in edgesid: midpoint_array.append(self.get_edge_midpoint(ed)) @@ -7466,19 +7492,19 @@ def get_mid_points_on_dir(self, sheet, axisdir): if not point0: point0 = el point1 = el - elif axisdir < 3 and el[id_] < point0[id_] or axisdir > 2 and el[id_] > point0[id_]: + elif axis < 3 and el[id_] < point0[id_] or axis > 2 and el[id_] > point0[id_]: point0 = el - elif axisdir < 3 and el[id_] > point1[id_] or axisdir > 2 and el[id_] < point1[id_]: + elif axis < 3 and el[id_] > point1[id_] or axis > 2 and el[id_] < point1[id_]: point1 = el return point0, point1 - @pyaedt_function_handler() - def get_edge_midpoint(self, partID): + @pyaedt_function_handler(partID="assignment") + def get_edge_midpoint(self, assignment): """Retrieve the midpoint coordinates of a given edge ID or edge name. Parameters ---------- - partID : int or str + assignment : int or str Object ID or object name. Returns @@ -7488,14 +7514,14 @@ def get_edge_midpoint(self, partID): two vertices, an empty list is returned. """ - if isinstance(partID, str) and partID in self._object_names_to_ids: - partID = self._object_names_to_ids[partID] + if isinstance(assignment, str) and assignment in self._object_names_to_ids: + assignment = self._object_names_to_ids[assignment] - if partID in self.objects and self.objects[partID].object_type == "Line": - vertices = self.get_object_vertices(partID) + if assignment in self.objects and self.objects[assignment].object_type == "Line": + vertices = self.get_object_vertices(assignment) else: try: - vertices = self.get_edge_vertices(partID) + vertices = self.get_edge_vertices(assignment) except Exception: vertices = [] if len(vertices) == 2: @@ -7547,15 +7573,15 @@ def get_bodynames_from_position(self, position, units=None, include_non_model=Tr list_of_bodies = [i for i in list_of_bodies if i not in non_models] return list_of_bodies - @pyaedt_function_handler() - def get_edgeid_from_position(self, position, obj_name=None, units=None): + @pyaedt_function_handler(obj_name="assignment") + def get_edgeid_from_position(self, position, assignment=None, units=None): """Get an edge ID from a position. Parameters ---------- position : list List of ``[x, y, z]`` coordinates for the position. - obj_name : str, optional + assignment : str, optional Name of the object. The default is ``None``, in which case all objects are searched. units : str, optional @@ -7567,8 +7593,8 @@ def get_edgeid_from_position(self, position, obj_name=None, units=None): type Edge ID of the first object touching this position. """ - if isinstance(obj_name, str): - object_list = [obj_name] + if isinstance(assignment, str): + object_list = [assignment] else: object_list = self.object_names @@ -7588,15 +7614,15 @@ def get_edgeid_from_position(self, position, obj_name=None, units=None): except Exception: pass - @pyaedt_function_handler() - def get_edgeids_from_vertexid(self, vertexid, obj_name): + @pyaedt_function_handler(vertexid="vertex", obj_name="assignment") + def get_edgeids_from_vertexid(self, vertex, assignment): """Retrieve edge IDs for a vertex ID. Parameters ---------- - vertexid : int + vertex : int Vertex ID. - obj_name : + assignment : str Name of the object. Returns @@ -7612,23 +7638,23 @@ def get_edgeids_from_vertexid(self, vertexid, obj_name): """ edgeID = [] - edges = self.get_object_edges(obj_name) + edges = self.get_object_edges(assignment) for edge in edges: vertices = self.get_edge_vertices(edge) - if vertexid in vertices: + if vertex in vertices: edgeID.append(edge) return edgeID - @pyaedt_function_handler() - def get_faceid_from_position(self, position, obj_name=None, units=None): + @pyaedt_function_handler(obj_name="assignment") + def get_faceid_from_position(self, position, assignment=None, units=None): """Retrieve a face ID from a position. Parameters ---------- position : list List of ``[x, y, z]`` coordinates for the position. - obj_name : str, optional + assignment : str, optional Name of the object. The default is ``None``, in which case all objects are searched. units : str, optional @@ -7646,8 +7672,8 @@ def get_faceid_from_position(self, position, obj_name=None, units=None): >>> oEditor.GetFaceByPosition """ - if isinstance(obj_name, str): - object_list = [obj_name] + if isinstance(assignment, str): + object_list = [assignment] else: object_list = self.object_names @@ -7666,8 +7692,8 @@ def get_faceid_from_position(self, position, obj_name=None, units=None): # Not Found, keep looking pass - @pyaedt_function_handler() - def get_edges_on_bounding_box(self, sheets, return_colinear=True, tol=1e-6): + @pyaedt_function_handler(sheets="assignment", tol="tolerance") + def get_edges_on_bounding_box(self, assignment, return_colinear=True, tolerance=1e-6): """Retrieve the edges of the sheets passed in the input that are lying on the bounding box. This method creates new lines for the detected edges and returns the IDs of these lines. @@ -7675,12 +7701,12 @@ def get_edges_on_bounding_box(self, sheets, return_colinear=True, tol=1e-6): Parameters ---------- - sheets : int, str, or list + assignment : int, str, or list ID or name for one or more sheets. return_colinear : bool, optional Whether to return only colinear edges. The default is ``True``. If ``False``, all edges on the bounding box are returned. - tol : float, optional + tolerance : float, optional Geometric tolerance. The default is ``1e-6``. Returns @@ -7689,7 +7715,7 @@ def get_edges_on_bounding_box(self, sheets, return_colinear=True, tol=1e-6): List of edge IDs lying on the bounding box. """ - port_sheets = self._modeler.convert_to_selections(sheets, return_list=True) + port_sheets = self._modeler.convert_to_selections(assignment, return_list=True) bb = self._modeler.get_model_bounding_box() candidate_edges = [] @@ -7701,11 +7727,11 @@ def get_edges_on_bounding_box(self, sheets, return_colinear=True, tol=1e-6): for vertex in vertices: v = vertex.position xyz_flag = 0 - if abs(v[0] - bb[0]) < tol or abs(v[0] - bb[3]) < tol: + if abs(v[0] - bb[0]) < tolerance or abs(v[0] - bb[3]) < tolerance: xyz_flag += 1 - if abs(v[1] - bb[1]) < tol or abs(v[1] - bb[4]) < tol: + if abs(v[1] - bb[1]) < tolerance or abs(v[1] - bb[4]) < tolerance: xyz_flag += 1 - if abs(v[2] - bb[2]) < tol or abs(v[2] - bb[5]) < tol: + if abs(v[2] - bb[2]) < tolerance or abs(v[2] - bb[5]) < tolerance: xyz_flag += 1 if xyz_flag >= 2: v_flag = True @@ -7725,7 +7751,7 @@ def get_edges_on_bounding_box(self, sheets, return_colinear=True, tol=1e-6): for j, edge_j in enumerate(candidate_edges[i + 1 :]): midpoint_j = edge_j.midpoint area = GeometryOperators.get_triangle_area(midpoint_i, midpoint_j, vertex1_i) - if area < tol**2: + if area < tolerance**2: selected_edges.extend([edge_i, edge_j]) break selected_edges = list(set(selected_edges)) @@ -7736,9 +7762,11 @@ def get_edges_on_bounding_box(self, sheets, return_colinear=True, tol=1e-6): return selected_edges - @pyaedt_function_handler() + @pyaedt_function_handler( + sheet="assignment", XY_plane="xy_plane", YZ_plane="yz_plane", XZ_plane="xz_plane", tol="tolerance" + ) def get_edges_for_circuit_port_from_sheet( - self, sheet, XY_plane=True, YZ_plane=True, XZ_plane=True, allow_perpendicular=False, tol=1e-6 + self, assignment, xy_plane=True, yz_plane=True, xz_plane=True, allow_perpendicular=False, tolerance=1e-6 ): """Retrieve two edge IDs that are suitable for a circuit port from a sheet. @@ -7753,21 +7781,21 @@ def get_edges_for_circuit_port_from_sheet( Parameters ---------- - sheet : int, str, or list + assignment : int, str, or list ID or name for one or more sheets. - XY_plane : bool, optional + xy_plane : bool, optional Whether the edge's pair are to be on the XY plane. The default is ``True``. - YZ_plane : bool, optional + yz_plane : bool, optional Whether the edge's pair are to be on the YZ plane. The default is ``True``. - XZ_plane : bool, optional + xz_plane : bool, optional Whether the edge's pair are to be on the XZ plane. The default is ``True``. allow_perpendicular : bool, optional Whether the edge's pair are to be perpendicular. The default is ``False``. - tol : float, optional + tolerance : float, optional Geometric tolerance. The default is ``1e-6``. Returns @@ -7776,8 +7804,8 @@ def get_edges_for_circuit_port_from_sheet( List of edge IDs. """ - tol2 = tol**2 - port_sheet = self._modeler.convert_to_selections(sheet, return_list=True) + tol2 = tolerance**2 + port_sheet = self._modeler.convert_to_selections(assignment, return_list=True) if len(port_sheet) > 1: return [] else: @@ -7844,7 +7872,7 @@ def get_edges_for_circuit_port_from_sheet( GeometryOperators.v_points(vertex1_j, vertex2_j), ) ) - < tol + < tolerance ): continue @@ -7852,11 +7880,11 @@ def get_edges_for_circuit_port_from_sheet( GeometryOperators.v_points(vertex1_i, vertex2_i), GeometryOperators.v_points(vertex1_i, vertex1_j) ) normal1_norm = GeometryOperators.v_norm(normal1) - if YZ_plane and abs(abs(GeometryOperators._v_dot(normal1, ux)) - normal1_norm) < tol: + if yz_plane and abs(abs(GeometryOperators._v_dot(normal1, ux)) - normal1_norm) < tolerance: pass - elif XZ_plane and abs(abs(GeometryOperators._v_dot(normal1, uy)) - normal1_norm) < tol: + elif xz_plane and abs(abs(GeometryOperators._v_dot(normal1, uy)) - normal1_norm) < tolerance: pass - elif XY_plane and abs(abs(GeometryOperators._v_dot(normal1, uz)) - normal1_norm) < tol: + elif xy_plane and abs(abs(GeometryOperators._v_dot(normal1, uz)) - normal1_norm) < tolerance: pass else: continue @@ -7865,7 +7893,7 @@ def get_edges_for_circuit_port_from_sheet( if abs(GeometryOperators._v_dot(normal1, vec1)) < tol2: # the 4th point is coplanar candidate_edges.append(ej) - minimum_distance = tol**-1 + minimum_distance = tolerance**-1 selected_edges = [] for ei in midpoints: midpoint_i = midpoints[ei] @@ -7884,9 +7912,11 @@ def get_edges_for_circuit_port_from_sheet( else: return [] - @pyaedt_function_handler() + @pyaedt_function_handler( + face_id="assignment", XY_plane="xy_plane", YZ_plane="yz_plane", XZ_plane="xz_plane", tol="tolerance" + ) def get_edges_for_circuit_port( - self, face_id, XY_plane=True, YZ_plane=True, XZ_plane=True, allow_perpendicular=False, tol=1e-6 + self, assignment, xy_plane=True, yz_plane=True, xz_plane=True, allow_perpendicular=False, tolerance=1e-6 ): """Retrieve two edge IDs suitable for the circuit port. @@ -7900,21 +7930,21 @@ def get_edges_for_circuit_port( Parameters ---------- - face_id : + assignment : ID of the face. - XY_plane : bool, optional + xy_plane : bool, optional Whether the edge's pair are to be on the XY plane. The default is ``True``. - YZ_plane : bool, optional + yz_plane : bool, optional Whether the edge's pair are to be on the YZ plane. The default is ``True``. - XZ_plane : bool, optional + xz_plane : bool, optional Whether the edge's pair are to be on the XZ plane. The default is ``True``. allow_perpendicular : bool, optional Whether the edge's pair are to be perpendicular. The default is ``False``. - tol : float, optional + tolerance : float, optional Geometric tolerance. The default is ``1e-6``. Returns @@ -7923,12 +7953,12 @@ def get_edges_for_circuit_port( List of edge IDs. """ - tol2 = tol**2 + tol2 = tolerance**2 - port_edges = self.get_face_edges(face_id) + port_edges = self.get_face_edges(assignment) # find the bodies to exclude - port_sheet_midpoint = self.get_face_center(face_id) + port_sheet_midpoint = self.get_face_center(assignment) point = self._modeler.Position(port_sheet_midpoint) list_of_bodies = self.get_bodynames_from_position(point) @@ -7950,10 +7980,10 @@ def get_edges_for_circuit_port( vertices_i = self.get_edge_vertices(ei) if len(vertices_i) == 1: # maybe a circle vertex1_i = self.get_vertex_position(vertices_i[0]) - area_i = self.get_face_area(face_id) + area_i = self.get_face_area(assignment) if area_i is None or area_i < tol2: # degenerated face continue - center_i = self.get_face_center(face_id) + center_i = self.get_face_center(assignment) if not center_i: # non planar face continue radius_i = GeometryOperators.points_distance(vertex1_i, center_i) @@ -7987,7 +8017,7 @@ def get_edges_for_circuit_port( GeometryOperators.v_points(vertex1_j, vertex2_j), ) ) - < tol + < tolerance ): continue @@ -7995,11 +8025,11 @@ def get_edges_for_circuit_port( GeometryOperators.v_points(vertex1_i, vertex2_i), GeometryOperators.v_points(vertex1_i, vertex1_j) ) normal1_norm = GeometryOperators.v_norm(normal1) - if YZ_plane and abs(abs(GeometryOperators._v_dot(normal1, ux)) - normal1_norm) < tol: + if yz_plane and abs(abs(GeometryOperators._v_dot(normal1, ux)) - normal1_norm) < tolerance: pass - elif XZ_plane and abs(abs(GeometryOperators._v_dot(normal1, uy)) - normal1_norm) < tol: + elif xz_plane and abs(abs(GeometryOperators._v_dot(normal1, uy)) - normal1_norm) < tolerance: pass - elif XY_plane and abs(abs(GeometryOperators._v_dot(normal1, uz)) - normal1_norm) < tol: + elif xy_plane and abs(abs(GeometryOperators._v_dot(normal1, uz)) - normal1_norm) < tolerance: pass else: continue @@ -8008,7 +8038,7 @@ def get_edges_for_circuit_port( if abs(GeometryOperators._v_dot(normal1, vec1)) < tol2: # the 4th point is coplanar candidate_edges.append(ej) - minimum_distance = tol**-1 + minimum_distance = tolerance**-1 selected_edges = [] for ei in midpoints: midpoint_i = midpoints[ei] @@ -8049,7 +8079,7 @@ def get_closest_edgeid_to_position(self, position, units=None): bodies = self.get_bodynames_from_position(position, units) # the function searches in all bodies, not efficient - face_id = self.get_faceid_from_position(position, obj_name=bodies[0], units=units) + face_id = self.get_faceid_from_position(position, assignment=bodies[0], units=units) edges = self.get_face_edges(face_id) distance = 1e6 selected_edge = None @@ -8482,7 +8512,7 @@ def _get_native_component_properties(self, name): return native_comp_properties - @pyaedt_function_handler + @pyaedt_function_handler() def _get_object_dict_by_material(self, material): obj_dict = {} for mat in material: @@ -8502,15 +8532,15 @@ def _get_object_dict_by_material(self, material): obj_dict[mat] = objs return obj_dict - @pyaedt_function_handler() - def convert_segments_to_line(self, object_name): + @pyaedt_function_handler(object_name="assignment") + def convert_segments_to_line(self, assignment): """Convert a CreatePolyline list of segments to lines. This method applies to splines and 3-point arguments. Parameters ---------- - object_name : int, str, or :class:`pyaedt.modeler.cad.object3d.Object3d` + assignment : int, str, or :class:`pyaedt.modeler.cad.object3d.Object3d` Specified for the object. Returns @@ -8533,7 +8563,7 @@ def convert_segments_to_line(self, object_name): >>> aedtapp.modeler.convert_segments_to_line(edge_object.name) """ - this_object = self._resolve_object(object_name) + this_object = self._resolve_object(assignment) edges = this_object.edges for i in reversed(range(len(edges))): self.oeditor.ChangeProperty( @@ -8573,7 +8603,7 @@ class PrimitivesBuilder(object): >>> aedtapp = Hfss() >>> primitive_file = "primitives_file.json" >>> primitives_builder = PrimitivesBuilder(aedtapp, input_file=primitive_file) - >>> primitives_builder.create() + >>> primitives_builder.create(),, >>> aedtapp.release_desktop() """ @@ -8752,11 +8782,11 @@ def _create_cylinder_instance(self, name, cs, origin, data): self._app.modeler.set_working_coordinate_system(cs) cyl1 = self._app.modeler.create_cylinder( - cs_axis=data.get("Plane"), - position=origin, + orientation=data.get("Plane"), + origin=origin, radius=data.get("Radius"), height=data.get("Height"), - numSides=int(data.get("Number of Segments")), + num_sides=int(data.get("Number of Segments")), name=name, ) @@ -8768,11 +8798,11 @@ def _create_cylinder_instance(self, name, cs, origin, data): self.logger.warning("Internal radius is larger than external radius.") elif internal_radius != 0: cyl2 = self._app.modeler.create_cylinder( - cs_axis=data.get("Plane"), - position=origin, + orientation=data.get("Plane"), + origin=origin, radius=internal_radius, height=data.get("Height"), - numSides=data.get("Number of Segments"), + num_sides=data.get("Number of Segments"), name=name, ) self._app.modeler.subtract(blank_list=cyl1, tool_list=cyl2, keep_originals=False) @@ -8808,9 +8838,7 @@ def _create_box_instance(self, name, cs, origin, data): self._app.modeler.set_working_coordinate_system(cs) box1 = self._app.modeler.create_box( - position=origin, - dimensions_list=[data["X Length"], data["Y Length"], data["Z Length"]], - name=name, + origin=origin, sizes=[data["X Length"], data["Y Length"], data["Z Length"]], name=name ) return box1 diff --git a/pyaedt/modeler/cad/Primitives2D.py b/pyaedt/modeler/cad/Primitives2D.py index 2222b4f72db..0d640ea7724 100644 --- a/pyaedt/modeler/cad/Primitives2D.py +++ b/pyaedt/modeler/cad/Primitives2D.py @@ -30,15 +30,15 @@ def plane2d(self): def __init__(self, application): GeometryModeler.__init__(self, application, is3d=False) - @pyaedt_function_handler() + @pyaedt_function_handler(position="origin", matname="material") def create_circle( - self, position, radius, num_sides=0, is_covered=True, name=None, matname=None, non_model=False, **kwargs + self, origin, radius, num_sides=0, is_covered=True, name=None, material=None, non_model=False, **kwargs ): """Create a circle. Parameters ---------- - position : list + origin : list ApplicationName.modeler.Position(x,y,z) object radius : float Radius of the object. @@ -49,7 +49,7 @@ def create_circle( name : str, optional Name of the object. The default is ``None``. If ``None`` , a unique name ``"NewObject_xxxxxx"`` will be assigned) - matname : str, optional + material : str, optional Name of the material. The default is ``None``. If ``None``, the default material is assigned. non_model : bool, optional @@ -71,15 +71,15 @@ def create_circle( Examples -------- - >>> circle1 = aedtapp.modeler.create_circle([0, -2, -2], 3) - >>> circle2 = aedtapp.modeler.create_circle(position=[0, -2, -2], radius=3, num_sides=6, - ... name="MyCircle", matname="Copper") + >>> circle1 = aedtapp.modeler.create_circle([0, -2, -2],3) + >>> circle2 = aedtapp.modeler.create_circle(origin=[0, -2, -2],radius=3, + ... num_sides=6,name="MyCircle",material="Copper") """ # TODO: kwargs such as 'matname' and 'nonmodel' should be deprecated. szAxis = self.plane2d - XCenter, YCenter, ZCenter = self._pos_with_arg(position) + XCenter, YCenter, ZCenter = self._pos_with_arg(origin) Radius = self._arg_with_dim(radius) vArg1 = ["NAME:CircleParameters"] @@ -91,19 +91,19 @@ def create_circle( vArg1.append("WhichAxis:="), vArg1.append(szAxis) vArg1.append("NumSegments:="), vArg1.append("{}".format(num_sides)) - vArg2 = self._default_object_attributes(name=name, matname=matname, flags="NonModel#" if non_model else "") + vArg2 = self._default_object_attributes(name=name, matname=material, flags="NonModel#" if non_model else "") new_object_name = self.oeditor.CreateCircle(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) - @pyaedt_function_handler() + @pyaedt_function_handler(position="origin", matname="material") def create_ellipse( - self, position, major_radius, ratio, is_covered=True, name=None, matname=None, non_model=False, **kwargs + self, origin, major_radius, ratio, is_covered=True, name=None, material=None, non_model=False, **kwargs ): """Create an ellipse. Parameters ---------- - position : list of float + origin : list of float Center Position of the ellipse major_radius : flost Length of the major axis of the ellipse @@ -114,7 +114,7 @@ def create_ellipse( name : str, default=None Name of the object. The default is ``None``. If ``None`` , a unique name NewObject_xxxxxx will be assigned) - matname : str, default=None + material : str, default=None Name of the material. The default is ``None``. If ``None``, the default material is assigned. non_model : bool, optional @@ -137,11 +137,11 @@ def create_ellipse( Examples -------- >>> ellipse1 = aedtapp.modeler.create_ellipse([0, -2, -2], 4.0, 0.2) - >>> ellipse2 = aedtapp.modeler.create_ellipse(position=[0, -2, -2], major_radius=4.0, ratio=0.2, - ... name="MyEllipse", matname="Copper") + >>> ellipse2 = aedtapp.modeler.create_ellipse(origin=[0, -2, -2], major_radius=4.0, ratio=0.2, + ... name="MyEllipse", material="Copper") """ szAxis = self.plane2d - XStart, YStart, ZStart = self._pos_with_arg(position) + XStart, YStart, ZStart = self._pos_with_arg(origin) vArg1 = ["NAME:EllipseParameters"] vArg1.append("IsCovered:="), vArg1.append(is_covered) @@ -152,28 +152,26 @@ def create_ellipse( vArg1.append("Ratio:="), vArg1.append(ratio) vArg1.append("WhichAxis:="), vArg1.append(szAxis) - vArg2 = self._default_object_attributes(name=name, matname=matname, flags="NonModel#" if non_model else "") + vArg2 = self._default_object_attributes(name=name, matname=material, flags="NonModel#" if non_model else "") new_object_name = self.oeditor.CreateEllipse(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) - @pyaedt_function_handler() - def create_rectangle( - self, position, dimension_list, is_covered=True, name=None, matname=None, non_model=False, **kwargs - ): + @pyaedt_function_handler(position="origin", dimension_list="sizes", matname="material") + def create_rectangle(self, origin, sizes, is_covered=True, name=None, material=None, non_model=False, **kwargs): """Create a rectangle. Parameters ---------- - position : list of float + origin : list Position of the lower-left corner of the rectangle - dimension_list : list of float + sizes : list List of rectangle sizes: [X size, Y size] for XY planes or [Z size, R size] for RZ planes is_covered : bool Specify whether the ellipse is a sheet (covered) or a line object name : str, default=None Name of the object. The default is ``None``. If ``None`` , a unique name NewObject_xxxxxx will be assigned) - matname : str, default=None + material : str, default=None Name of the material. The default is ``None``. If ``None``, the default material is assigned. non_model : bool, optional @@ -191,16 +189,15 @@ def create_rectangle( Examples -------- - >>> rect1 = aedtapp.modeler.create_rectangle([0, -2, -2], [3, 4]) - >>> rect2 = aedtapp.modeler.create_rectangle(position=[0, -2, -2], dimension_list=[3, 4], - ... name="MyCircle", matname="Copper") + >>> rect1 = aedtapp.modeler.create_rectangle([0, -2, -2],[3, 4]) + >>> rect2 = aedtapp.modeler.create_rectangle(origin=[0, -2, -2],sizes=[3, 4],name="MyCircle",material="Copper") """ # TODO: Primitives in Maxwell 2D must have Z=0, otherwise the transparency cannot be changed. (issue 4071) axis = self.plane2d - x_start, y_start, z_start = self._pos_with_arg(position) - width = self._arg_with_dim(dimension_list[0]) - height = self._arg_with_dim(dimension_list[1]) + x_start, y_start, z_start = self._pos_with_arg(origin) + width = self._arg_with_dim(sizes[0]) + height = self._arg_with_dim(sizes[1]) vArg1 = ["NAME:RectangleParameters"] vArg1.append("IsCovered:="), vArg1.append(is_covered) @@ -211,19 +208,19 @@ def create_rectangle( vArg1.append("Height:="), vArg1.append(height) vArg1.append("WhichAxis:="), vArg1.append(axis) - vArg2 = self._default_object_attributes(name=name, matname=matname, flags="NonModel#" if non_model else "") + vArg2 = self._default_object_attributes(name=name, matname=material, flags="NonModel#" if non_model else "") new_object_name = self.oeditor.CreateRectangle(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) - @pyaedt_function_handler() + @pyaedt_function_handler(position="origin", matname="material") def create_regular_polygon( - self, position, start_point, num_sides=6, name=None, matname=None, non_model=False, **kwargs + self, origin, start_point, num_sides=6, name=None, material=None, non_model=False, **kwargs ): """Create a rectangle. Parameters ---------- - position : list of float + origin : list of float Position of the center of the polygon in ``[x, y, z]``. start_point : list of float Start point for the outer path of the polygon in ``[x, y, z]``. @@ -232,7 +229,7 @@ def create_regular_polygon( name : str, default=None Name of the object. The default is ``None``. If ``None`` , a unique name NewObject_xxxxxx will be assigned) - matname : str, default=None + material : str, default=None Name of the material. The default is ``None``. If ``None``, the default material is assigned. non_model : bool, optional @@ -255,11 +252,11 @@ def create_regular_polygon( -------- >>> pg1 = aedtapp.modeler.create_regular_polygon([0, 0, 0], [0, 2, 0]) - >>> pg2 = aedtapp.modeler.create_regular_polygon(position=[0, 0, 0], start_point=[0, 2, 0], - ... name="MyPolygon", matname="Copper") + >>> pg2 = aedtapp.modeler.create_regular_polygon(origin=[0, 0, 0], start_point=[0, 2, 0], + ... name="MyPolygon", material="Copper") """ - x_center, y_center, z_center = self._pos_with_arg(position) + x_center, y_center, z_center = self._pos_with_arg(origin) x_start, y_start, z_start = self._pos_with_arg(start_point) n_sides = int(num_sides) @@ -276,12 +273,12 @@ def create_regular_polygon( vArg1.append("NumSides:="), vArg1.append(n_sides) vArg1.append("WhichAxis:="), vArg1.append(self.plane2d) - vArg2 = self._default_object_attributes(name=name, matname=matname, flags="NonModel#" if non_model else "") + vArg2 = self._default_object_attributes(name=name, matname=material, flags="NonModel#" if non_model else "") new_object_name = self.oeditor.CreateRegularPolygon(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) - @pyaedt_function_handler() - def create_region(self, pad_value=300, pad_type="Percentage Offset", region_name="Region", **kwarg): + @pyaedt_function_handler(region_name="name") + def create_region(self, pad_value=300, pad_type="Percentage Offset", name="Region", **kwarg): """Create an air region. Parameters @@ -298,7 +295,7 @@ def create_region(self, pad_value=300, pad_type="Percentage Offset", region_name ``"Transverse Percentage Offset"``. When using a list, different padding types can be provided for different directions. - region_name : str, optional + name : str, optional Region name. The default is ``None``, in which case the name is generated automatically. @@ -343,4 +340,4 @@ def create_region(self, pad_value=300, pad_type="Percentage Offset", region_name return False pad_value = [pad_value[0], 0, 0, 0, pad_value[1], pad_value[2]] - return self._create_region(pad_value, pad_type, region_name, region_type="Region") + return self._create_region(pad_value, pad_type, name, region_type="Region") diff --git a/pyaedt/modeler/cad/Primitives3D.py b/pyaedt/modeler/cad/Primitives3D.py index 050ba9e0f87..f4374148283 100644 --- a/pyaedt/modeler/cad/Primitives3D.py +++ b/pyaedt/modeler/cad/Primitives3D.py @@ -73,9 +73,8 @@ class Primitives3D(GeometryModeler): >>> from pyaedt import Hfss >>> app = Hfss() - >>> box = app.modeler.create_box(position=[0,0,0], dimensions_list=[10,5,3], name="my_box", - ... matname="copper", color=(240, 120, 0), - ... transparency=0.5) + >>> box = app.modeler.create_box(origin=[0,0,0],sizes=[10,5,3], + ... name="my_box",material="copper",color=(240, 120, 0),transparency=0.5) In this example, ``color`` and ``transparency`` are the variable named arguments that can be passed to any method that creates a primitive. @@ -85,20 +84,20 @@ def __init__(self, application): GeometryModeler.__init__(self, application, is3d=True) self.multiparts = [] - @pyaedt_function_handler() - def create_box(self, position, dimensions_list, name=None, matname=None, **kwargs): + @pyaedt_function_handler(position="origin", dimensions_list="sizes", matname="material") + def create_box(self, origin, sizes, name=None, material=None, **kwargs): """Create a box. Parameters ---------- - position : list + origin : list Anchor point for the box in Cartesian``[x, y, z]`` coordinates. - dimensions_list : list + sizes : list Length of the box edges in Cartesian``[x, y, z]`` coordinates. name : str, optional Name of the box. The default is ``None``, in which case the default name is assigned. - matname : str, optional + material : str, optional Name of the material. The default is ``None``, in which case the default material is assigned. If the material name supplied is invalid, the default material is assigned. @@ -128,21 +127,18 @@ def create_box(self, position, dimensions_list, name=None, matname=None, **kwarg >>> hfss = Hfss() >>> origin = [0,0,0] >>> dimensions = [10,5,20] - >>> box_object = hfss.modeler.create_box(position=origin, - ... dimensions_list=dimensions, - ... name="mybox", - ... matname="copper") + >>> box_object = hfss.modeler.create_box(origin=origin,sizes=dimensions,name="mybox",material="copper") """ - if len(position) != 3: + if len(origin) != 3: self.logger.error("The ``position`` argument must be a valid three-element list.") return False - if len(dimensions_list) != 3: + if len(sizes) != 3: self.logger.error("The ``dimension_list`` argument must be a valid three-element list.") return False - XPosition, YPosition, ZPosition = self._pos_with_arg(position) - XSize, YSize, ZSize = self._pos_with_arg(dimensions_list) + XPosition, YPosition, ZPosition = self._pos_with_arg(origin) + XSize, YSize, ZSize = self._pos_with_arg(sizes) vArg1 = ["NAME:BoxParameters"] vArg1.append("XPosition:="), vArg1.append(XPosition) vArg1.append("YPosition:="), vArg1.append(YPosition) @@ -150,32 +146,32 @@ def create_box(self, position, dimensions_list, name=None, matname=None, **kwarg vArg1.append("XSize:="), vArg1.append(XSize) vArg1.append("YSize:="), vArg1.append(YSize) vArg1.append("ZSize:="), vArg1.append(ZSize) - vArg2 = self._default_object_attributes(name=name, matname=matname) + vArg2 = self._default_object_attributes(name=name, matname=material) new_object_name = self.oeditor.CreateBox(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) - @pyaedt_function_handler() - def create_cylinder(self, cs_axis, position, radius, height, numSides=0, name=None, matname=None, **kwargs): + @pyaedt_function_handler(cs_axis="orientation", position="origin", numSides="num_sides", matname="material") + def create_cylinder(self, orientation, origin, radius, height, num_sides=0, name=None, material=None, **kwargs): """Create a cylinder. Parameters ---------- - cs_axis : int or str + orientation : int or str Axis of rotation of the starting point around the center point. :class:`pyaedt.constants.AXIS` Enumerator can be used as input. - position : list + origin : list Center point of the cylinder in a list of ``(x, y, z)`` coordinates. radius : float Radius of the cylinder. height : float Height of the cylinder. - numSides : int, optional + num_sides : int, optional Number of sides. The default is ``0``, which is correct for a cylinder. name : str, optional Name of the cylinder. The default is ``None``, in which case the default name is assigned. - matname : str, optional + material : str, optional Name of the material. The default is ``None``, in which case the default material is assigned. @@ -205,20 +201,20 @@ def create_cylinder(self, cs_axis, position, radius, height, numSides=0, name=No >>> from pyaedt import Hfss >>> aedtapp = Hfss() - >>> cylinder_object = aedtapp.modeler.create_cylinder(cs_axis='Z', position=[0,0,0], - ... radius=2, height=3, name="mycyl", - ... matname="vacuum") + >>> cylinder_object = aedtapp.modeler.create_cylinder(orientation='Z', + ... origin=[0,0,0],radius=2, + ... height=3,name="mycyl",material="vacuum") """ if isinstance(radius, (int, float)) and radius < 0: self.logger.error("The ``radius`` argument must be greater than 0.") return False - if len(position) != 3: + if len(origin) != 3: self.logger.error("The ``position`` argument must be a valid three-element list.") return False - szAxis = GeometryOperators.cs_axis_str(cs_axis) - XCenter, YCenter, ZCenter = self._pos_with_arg(position) + szAxis = GeometryOperators.cs_axis_str(orientation) + XCenter, YCenter, ZCenter = self._pos_with_arg(origin) Radius = self._arg_with_dim(radius) Height = self._arg_with_dim(height) @@ -230,26 +226,27 @@ def create_cylinder(self, cs_axis, position, radius, height, numSides=0, name=No vArg1.append("Radius:="), vArg1.append(Radius) vArg1.append("Height:="), vArg1.append(Height) vArg1.append("WhichAxis:="), vArg1.append(szAxis) - vArg1.append("NumSides:="), vArg1.append("{}".format(numSides)) - vArg2 = self._default_object_attributes(name=name, matname=matname) + vArg1.append("NumSides:="), vArg1.append("{}".format(num_sides)) + vArg2 = self._default_object_attributes(name=name, matname=material) new_object_name = self.oeditor.CreateCylinder(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) # fmt: off - @pyaedt_function_handler() - 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): # fmt: on + @pyaedt_function_handler(cs_axis="orientation", center_position="center", + start_position="origin", matname="material") + def create_polyhedron(self, orientation=None, center=(0.0, 0.0, 0.0), origin=(0.0, 1.0, 0.0), + height=1.0, num_sides=12, name=None, material=None, **kwargs): # fmt: on """Create a regular polyhedron. Parameters ---------- - cs_axis : optional + orientation : optional Axis of rotation of the starting point around the center point. The default is ``None``, in which case the Z axis is used. - center_position : list, optional + center : list, optional List of ``[x, y, z]`` coordinates for the center position. The default is ``(0.0, 0.0, 0.0)``. - start_position : list, optional + origin : list, optional List of ``[x, y, z]`` coordinates for the starting position. The default is ``(0.0, 0.0, 0.0)``. height : float, optional @@ -259,7 +256,7 @@ def create_polyhedron(self, cs_axis=None, center_position=(0.0, 0.0, 0.0), start name : str, optional Name of the polyhedron. The default is ``None``, in which the default name is assigned. - matname : str, optional + material : str, optional Name of the material. The default is ``None``, in which the default material is assigned. @@ -285,23 +282,23 @@ def create_polyhedron(self, cs_axis=None, center_position=(0.0, 0.0, 0.0), start >>> from pyaedt import Hfss >>> aedtapp = Hfss() - >>> ret_obj = aedtapp.modeler.create_polyhedron(cs_axis='X', center_position=[0, 0, 0], - ... start_position=[0,5,0], height=0.5, - ... num_sides=8, name="mybox", matname="copper") + >>> ret_obj = aedtapp.modeler.create_polyhedron(orientation='X',center=[0, 0, 0], + ... origin=[0,5,0],height=0.5,num_sides=8, + ... name="mybox",material="copper") """ - cs_axis = GeometryOperators.cs_axis_str(cs_axis) - if len(center_position) != 3: + orientation = GeometryOperators.cs_axis_str(orientation) + if len(center) != 3: self.logger.error("The ``center_position`` argument must be a valid three-element list.") return False - if len(start_position) != 3: + if len(origin) != 3: self.logger.error("The ``start_position`` argument must be a valid three-element list.") return False - if center_position == start_position: + if center == origin: self.logger.error("The ``center_position`` and ``start_position`` arguments must be different.") return False - x_center, y_center, z_center = self._pos_with_arg(center_position) - x_start, y_start, z_start = self._pos_with_arg(start_position) + x_center, y_center, z_center = self._pos_with_arg(center) + x_start, y_start, z_start = self._pos_with_arg(origin) height = self._arg_with_dim(height) @@ -314,21 +311,21 @@ def create_polyhedron(self, cs_axis=None, center_position=(0.0, 0.0, 0.0), start vArg1.append("ZStart:="), vArg1.append(z_start) vArg1.append("Height:="), vArg1.append(height) vArg1.append("NumSides:="), vArg1.append(int(num_sides)) - vArg1.append("WhichAxis:="), vArg1.append(cs_axis) - vArg2 = self._default_object_attributes(name=name, matname=matname) + vArg1.append("WhichAxis:="), vArg1.append(orientation) + vArg2 = self._default_object_attributes(name=name, matname=material) new_object_name = self.oeditor.CreateRegularPolyhedron(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) - @pyaedt_function_handler() - def create_cone(self, cs_axis, position, bottom_radius, top_radius, height, name=None, matname=None, **kwargs): + @pyaedt_function_handler(cs_axis="orientation", position="origin", matname="material") + def create_cone(self, orientation, origin, bottom_radius, top_radius, height, name=None, material=None, **kwargs): """Create a cone. Parameters ---------- - cs_axis : str + orientation : str Axis of rotation of the starting point around the center point. The default is ``None``, in which case the Z axis is used. - position : list, optional + origin : list, optional List of ``[x, y, z]`` coordinates for the center position of the bottom of the cone. bottom_radius : float @@ -340,7 +337,7 @@ def create_cone(self, cs_axis, position, bottom_radius, top_radius, height, name name : str, optional Name of the cone. The default is ``None``, in which case the default name is assigned. - matname : str, optional + material : str, optional Name of the material. The default is ``None``, in which case the default material is assigned. @@ -371,9 +368,9 @@ def create_cone(self, cs_axis, position, bottom_radius, top_radius, height, name >>> from pyaedt import Hfss >>> aedtapp = Hfss() - >>> cone_object = aedtapp.modeler.create_cone(cs_axis='Z', position=[0, 0, 0], - ... bottom_radius=2, top_radius=3, height=4, - ... name="mybox", matname="copper") + >>> cone_object = aedtapp.modeler.create_cone(orientation='Z',origin=[0, 0, 0], + ... bottom_radius=2,top_radius=3,height=4, + ... name="mybox",material="copper") """ if bottom_radius == top_radius: @@ -388,12 +385,12 @@ def create_cone(self, cs_axis, position, bottom_radius, top_radius, height, name if isinstance(height, (int, float)) and height <= 0: self.logger.error("The ``height`` argument must be greater than 0.") return False - if len(position) != 3: + if len(origin) != 3: self.logger.error("The ``position`` argument must be a valid three-element list.") return False - XCenter, YCenter, ZCenter = self._pos_with_arg(position) - szAxis = GeometryOperators.cs_axis_str(cs_axis) + XCenter, YCenter, ZCenter = self._pos_with_arg(origin) + szAxis = GeometryOperators.cs_axis_str(orientation) Height = self._arg_with_dim(height) RadiusBt = self._arg_with_dim(bottom_radius) RadiusUp = self._arg_with_dim(top_radius) @@ -406,17 +403,17 @@ def create_cone(self, cs_axis, position, bottom_radius, top_radius, height, name vArg1.append("Height:="), vArg1.append(Height) vArg1.append("BottomRadius:="), vArg1.append(RadiusBt) vArg1.append("TopRadius:="), vArg1.append(RadiusUp) - vArg2 = self._default_object_attributes(name=name, matname=matname) + vArg2 = self._default_object_attributes(name=name, matname=material) new_object_name = self.oeditor.CreateCone(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) - @pyaedt_function_handler() - def create_sphere(self, position, radius, name=None, matname=None, **kwargs): + @pyaedt_function_handler(position="origin", matname="material") + def create_sphere(self, origin, radius, name=None, material=None, **kwargs): """Create a sphere. Parameters ---------- - position : list + origin : list List of ``[x, y, z]`` coordinates for the center position of the sphere. radius : float @@ -424,7 +421,7 @@ def create_sphere(self, position, radius, name=None, matname=None, **kwargs): name : str, optional Name of the sphere. The default is ``None``, in which case the default name is assigned. - matname : str, optional + material : str, optional Name of the material. The default is ``None``, in which case the default material is assigned. @@ -451,17 +448,16 @@ def create_sphere(self, position, radius, name=None, matname=None, **kwargs): >>> from pyaedt import Hfss >>> aedtapp = Hfss() - >>> ret_object = aedtapp.modeler.create_sphere(position=[0,0,0], radius=2, - ... name="mysphere", matname="copper") + >>> ret_object = aedtapp.modeler.create_sphere(origin=[0,0,0],radius=2,name="mysphere",material="copper") """ - if len(position) != 3: + if len(origin) != 3: self.logger.error("The ``position`` argument must be a valid three-element list.") return False if isinstance(radius, (int, float)) and radius < 0: self.logger.error("The ``radius`` argument must be greater than 0.") return False - XCenter, YCenter, ZCenter = self._pos_with_arg(position) + XCenter, YCenter, ZCenter = self._pos_with_arg(origin) Radius = self._arg_with_dim(radius) @@ -470,17 +466,17 @@ def create_sphere(self, position, radius, name=None, matname=None, **kwargs): vArg1.append("YCenter:="), vArg1.append(YCenter) vArg1.append("ZCenter:="), vArg1.append(ZCenter) vArg1.append("Radius:="), vArg1.append(Radius) - vArg2 = self._default_object_attributes(name=name, matname=matname) + vArg2 = self._default_object_attributes(name=name, matname=material) new_object_name = self.oeditor.CreateSphere(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) - @pyaedt_function_handler() - def create_torus(self, center, major_radius, minor_radius, axis=None, name=None, material_name=None, **kwargs): + @pyaedt_function_handler(center="origin", material_name="material") + def create_torus(self, origin, major_radius, minor_radius, axis=None, name=None, material=None, **kwargs): """Create a torus. Parameters ---------- - center : list + origin : list Center point for the torus in a list of ``[x, y, z]`` coordinates. major_radius : float Major radius of the torus. @@ -492,7 +488,7 @@ def create_torus(self, center, major_radius, minor_radius, axis=None, name=None, name : str, optional Name of the torus. The default is ``None``, in which case the default name is assigned. - material_name : str, optional + material : str, optional Name of the material. The default is ``None``, in which case the default material is assigned. If the material name supplied is invalid, the default material is assigned. @@ -523,11 +519,11 @@ def create_torus(self, center, major_radius, minor_radius, axis=None, name=None, >>> from pyaedt import Hfss >>> hfss = Hfss() >>> origin = [0, 0, 0] - >>> torus = hfss.modeler.create_torus(center=origin, major_radius=1, - ... minor_radius=0.5, axis="Z", - ... name="mytorus", material_name="copper") + >>> torus = hfss.modeler.create_torus(origin=origin,major_radius=1,minor_radius=0.5, + ... axis="Z",name="mytorus",material="copper") + """ - if len(center) != 3: + if len(origin) != 3: self.logger.error("The ``center`` argument must be a valid three-element list.") return False # if major_radius <= 0 or minor_radius <= 0: @@ -535,7 +531,7 @@ def create_torus(self, center, major_radius, minor_radius, axis=None, name=None, # if minor_radius >= major_radius: # raise ValueError("Major radius must be greater than minor radius.") - x_center, y_center, z_center = self._pos_with_arg(center) + x_center, y_center, z_center = self._pos_with_arg(origin) axis = GeometryOperators.cs_axis_str(axis) major_radius = self._arg_with_dim(major_radius) minor_radius = self._arg_with_dim(minor_radius) @@ -547,24 +543,24 @@ def create_torus(self, center, major_radius, minor_radius, axis=None, name=None, first_argument.append("MajorRadius:="), first_argument.append(major_radius) first_argument.append("MinorRadius:="), first_argument.append(minor_radius) first_argument.append("WhichAxis:="), first_argument.append(axis) - second_argument = self._default_object_attributes(name=name, matname=material_name) + second_argument = self._default_object_attributes(name=name, matname=material) new_object_name = self.oeditor.CreateTorus(first_argument, second_argument) return self._create_object(new_object_name, **kwargs) # fmt: off - @pyaedt_function_handler() - def create_bondwire(self, start_position, end_position, h1=0.2, h2=0, alpha=80, beta=5, bond_type=0, - diameter=0.025, facets=6, name=None, matname=None, cs_axis="Z", **kwargs): # fmt: on + @pyaedt_function_handler(start_position="start", end_position="end", matname="material", cs_axis="orientation") + def create_bondwire(self, start, end, h1=0.2, h2=0, alpha=80, beta=5, bond_type=0, + diameter=0.025, facets=6, name=None, material=None, orientation="Z", **kwargs): # fmt: on # type : (list, list, float|str=0.2, float|str=0, float=80, float=5, int=0, float|str=0.025, int=6, str=None, # str=None) -> Object3d """Create a bondwire. Parameters ---------- - start_position : list + start : list List of ``[x, y, z]`` coordinates for the starting position of the bond pad. - end_position : list + end : list List of ``[x, y, z]`` coordinates for the ending position of the bond pad. h1 : float|str optional @@ -597,10 +593,10 @@ def create_bondwire(self, start_position, end_position, h1=0.2, h2=0, alpha=80, name : str, optional Name of the bondwire. The default is ``None``, in which case the default name is assigned. - matname : str, optional + material : str, optional Name of the material. The default is ``None``, in which case the default material is assigned. - cs_axis : str, optional + orientation : str, optional Coordinate system axis. The default is ``"Z"``. **kwargs : optional Additional keyword arguments may be passed when creating the primitive to set properties. See @@ -623,24 +619,24 @@ def create_bondwire(self, start_position, end_position, h1=0.2, h2=0, alpha=80, >>> origin = [0,0,0] >>> endpos = [10,5,20] >>> #Material and name are not mandatory fields - >>> object_id = hfss.modeler.create_bondwire(origin, endpos,h1=0.5, h2=0.1, alpha=75, beta=4, - ... bond_type=0, name="mybox", matname="copper") + >>> object_id = hfss.modeler.create_bondwire(origin,endpos,h1=0.5,h2=0.1,alpha=75, + ... beta=4,bond_type=0,name="mybox",material="copper") """ - if len(start_position) != 3: + if len(start) != 3: self.logger.error("The ``start_position`` argument must be a valid three-Element List") return False - x_position, y_position, z_position = self._pos_with_arg(start_position) - if len(end_position) != 3: + x_position, y_position, z_position = self._pos_with_arg(start) + if len(end) != 3: self.logger.error("The ``end_position`` argument must be a valid three-Element List") return False - x_position_end, y_position_end, z_position_end = self._pos_with_arg(end_position) + x_position_end, y_position_end, z_position_end = self._pos_with_arg(end) cont = 0 x_length = None y_length = None z_length = None - for m, n in zip(start_position, end_position): + for m, n in zip(start, end): if not isinstance(m, str): m = self._arg_with_dim(m) if not isinstance(n, str): @@ -694,30 +690,30 @@ def create_bondwire(self, start_position, end_position, h1=0.2, h2=0, alpha=80, first_argument.append("h2:="), first_argument.append(self._arg_with_dim(h2)) first_argument.append("alpha:="), first_argument.append(self._arg_with_dim(alpha, "deg")) first_argument.append("beta:="), first_argument.append(self._arg_with_dim(beta, "deg")) - first_argument.append("WhichAxis:="), first_argument.append(GeometryOperators.cs_axis_str(cs_axis)) + first_argument.append("WhichAxis:="), first_argument.append(GeometryOperators.cs_axis_str(orientation)) first_argument.append("ReverseDirection:="), first_argument.append(False) - second_argument = self._default_object_attributes(name=name, matname=matname) + second_argument = self._default_object_attributes(name=name, matname=material) new_object_name = self.oeditor.CreateBondwire(first_argument, second_argument) return self._create_object(new_object_name, **kwargs) - @pyaedt_function_handler() - def create_rectangle(self, csPlane, position, dimension_list, name=None, matname=None, is_covered=True, **kwargs): + @pyaedt_function_handler(csPlane="orientation", position="origin", dimension_list="sizes", matname="material") + def create_rectangle(self, orientation, origin, sizes, name=None, material=None, is_covered=True, **kwargs): """Create a rectangle. Parameters ---------- - csPlane : str or int + orientation : str or int Coordinate system plane for orienting the rectangle. :class:`pyaedt.constants.PLANE` Enumerator can be used as input. - position : list or Position + origin : list or Position List of ``[x, y, z]`` coordinates of the lower-left corner of the rectangle or the position ApplicationName.modeler.Position(x,y,z) object. - dimension_list : list + sizes : list List of ``[width, height]`` dimensions. name : str, optional Name of the rectangle. The default is ``None``, in which case the default name is assigned. - matname : str, optional + material : str, optional Name of the material. The default is ``None``, in which case the default material is assigned. is_covered : bool, optional @@ -736,14 +732,14 @@ def create_rectangle(self, csPlane, position, dimension_list, name=None, matname >>> oEditor.CreateRectangle """ - if len(dimension_list) != 2: - self.logger.error("The ``dimension_list`` argument must be a valid two-element list.") + if len(sizes) != 2: + self.logger.error("The ``sizes`` argument must be a valid two-element list.") return False - szAxis = GeometryOperators.cs_plane_to_axis_str(csPlane) - XStart, YStart, ZStart = self._pos_with_arg(position) + szAxis = GeometryOperators.cs_plane_to_axis_str(orientation) + XStart, YStart, ZStart = self._pos_with_arg(origin) - Width = self._arg_with_dim(dimension_list[0]) - Height = self._arg_with_dim(dimension_list[1]) + Width = self._arg_with_dim(sizes[0]) + Height = self._arg_with_dim(sizes[1]) vArg1 = ["NAME:RectangleParameters"] vArg1.append("IsCovered:="), vArg1.append(is_covered) @@ -753,31 +749,31 @@ def create_rectangle(self, csPlane, position, dimension_list, name=None, matname vArg1.append("Width:="), vArg1.append(Width) vArg1.append("Height:="), vArg1.append(Height) vArg1.append("WhichAxis:="), vArg1.append(szAxis) - vArg2 = self._default_object_attributes(name=name, matname=matname) + vArg2 = self._default_object_attributes(name=name, matname=material) new_object_name = self.oeditor.CreateRectangle(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) # fmt: off - @pyaedt_function_handler() - def create_circle(self, cs_plane, position, radius, numSides=0, is_covered=True, name=None, - matname=None, non_model=False, **kwargs): # fmt: on + @pyaedt_function_handler(cs_plane="orientation", position="origin", numSides="num_sides", matname="material") + def create_circle(self, orientation, origin, radius, num_sides=0, is_covered=True, name=None, + material=None, non_model=False, **kwargs): # fmt: on """Create a circle. Parameters ---------- - cs_plane : str or int + orientation : str or int Coordinate system plane for orienting the circle. :class:`pyaedt.constants.PLANE` Enumerator can be used as input. - position : list + origin : list List of ``[x, y, z]`` coordinates for the center point of the circle. radius : float Radius of the circle. - numSides : int, optional + num_sides : int, optional Number of sides. The default is ``0``, which is correct for a circle. name : str, optional Name of the circle. The default is ``None``, in which case the default name is assigned. - matname : str, optional + material : str, optional Name of the material. The default is ``None``, in which case the default material is assigned. non_model : bool, optional @@ -814,15 +810,15 @@ def create_circle(self, cs_plane, position, radius, numSides=0, is_covered=True, >>> from pyaedt import Hfss >>> aedtapp = Hfss() - >>> circle_object = aedtapp.modeler.create_circle(cs_plane='Z', position=[0,0,0], + >>> circle_object = aedtapp.modeler.create_circle(orientation='Z', origin=[0,0,0], ... radius=2, num_sides=8, name="mycyl", - ... matname="vacuum") + ... material="vacuum") """ non_model_flag = "" if non_model: non_model_flag = "NonModel#" - szAxis = GeometryOperators.cs_plane_to_axis_str(cs_plane) - XCenter, YCenter, ZCenter = self._pos_with_arg(position) + szAxis = GeometryOperators.cs_plane_to_axis_str(orientation) + XCenter, YCenter, ZCenter = self._pos_with_arg(origin) Radius = self._arg_with_dim(radius) vArg1 = ["NAME:CircleParameters"] vArg1.append("IsCovered:="), vArg1.append(is_covered) @@ -831,23 +827,23 @@ def create_circle(self, cs_plane, position, radius, numSides=0, is_covered=True, vArg1.append("ZCenter:="), vArg1.append(ZCenter) vArg1.append("Radius:="), vArg1.append(Radius) vArg1.append("WhichAxis:="), vArg1.append(szAxis) - vArg1.append("NumSegments:="), vArg1.append("{}".format(numSides)) - vArg2 = self._default_object_attributes(name=name, matname=matname, flags=non_model_flag) + vArg1.append("NumSegments:="), vArg1.append("{}".format(num_sides)) + vArg2 = self._default_object_attributes(name=name, matname=material, flags=non_model_flag) new_object_name = self.oeditor.CreateCircle(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) - @pyaedt_function_handler() + @pyaedt_function_handler(cs_plane="orientation", position="origin", matname="material") def create_ellipse( - self, cs_plane, position, major_radius, ratio, is_covered=True, name=None, matname=None, **kwargs + self, orientation, origin, major_radius, ratio, is_covered=True, name=None, material=None, **kwargs ): """Create an ellipse. Parameters ---------- - cs_plane : str or int + orientation : str or int Coordinate system plane for orienting the ellipse. :class:`pyaedt.constants.PLANE` Enumerator can be used as input. - position : list + origin : list List of ``[x, y, z]`` coordinates for the center point of the ellipse. major_radius : float Base radius of the ellipse. @@ -860,7 +856,7 @@ def create_ellipse( name : str, optional Name of the ellipse. The default is ``None``, in which case the default name is assigned. - matname : str, optional + material : str, optional Name of the material. The default is ``None``, in which case the default material is assigned. **kwargs : optional @@ -897,14 +893,14 @@ def create_ellipse( >>> from pyaedt import Hfss >>> aedtapp = Hfss() - >>> ellipse = aedtapp.modeler.create_ellipse(cs_plane='Z', position=[0,0,0], + >>> ellipse = aedtapp.modeler.create_ellipse(orientation='Z', origin=[0,0,0], ... major_radius=2, ratio=2, is_covered=True, name="myell", - ... matname="vacuum") + ... material="vacuum") """ - szAxis = GeometryOperators.cs_plane_to_axis_str(cs_plane) - XStart, YStart, ZStart = self._pos_with_arg(position) + szAxis = GeometryOperators.cs_plane_to_axis_str(orientation) + XStart, YStart, ZStart = self._pos_with_arg(origin) MajorRadius = self._arg_with_dim(major_radius) @@ -916,7 +912,7 @@ def create_ellipse( vArg1.append("MajRadius:="), vArg1.append(MajorRadius) vArg1.append("Ratio:="), vArg1.append(ratio) vArg1.append("WhichAxis:="), vArg1.append(szAxis) - vArg2 = self._default_object_attributes(name=name, matname=matname) + vArg2 = self._default_object_attributes(name=name, matname=material) new_object_name = self.oeditor.CreateEllipse(vArg1, vArg2) return self._create_object(new_object_name, **kwargs) @@ -1047,16 +1043,16 @@ def create_equationbased_curve(self, x_t=0, y_t=0, z_t=0, t_start=0, t_end=1, nu return self._create_object(new_name, **kwargs) # fmt: off - @pyaedt_function_handler() - def create_helix(self, polyline_name, position, x_start_dir, y_start_dir, z_start_dir, num_thread=1, + @pyaedt_function_handler(polyline_name="assignment", position="origin", num_thread="turns") + def create_helix(self, assignment, origin, x_start_dir, y_start_dir, z_start_dir, turns=1, right_hand=True, radius_increment=0.0, thread=1, **kwargs): # fmt: on """Create an helix from a polyline. Parameters ---------- - polyline_name : str + assignment : str Name of the polyline used as the base for the helix. - position : list + origin : list List of ``[x, y, z]`` coordinates for the center point of the circle. x_start_dir : float Distance along x axis from the polyline. @@ -1064,7 +1060,7 @@ def create_helix(self, polyline_name, position, x_start_dir, y_start_dir, z_star Distance along y axis from the polyline. z_start_dir : float Distance along z axis from the polyline. - num_thread : int, optional + turns : int, optional Number of turns. The default value is ``1``. right_hand : bool, optional Whether the helix turning direction is right hand. The default value is ``True``. @@ -1097,33 +1093,23 @@ def create_helix(self, polyline_name, position, x_start_dir, y_start_dir, z_star >>> udp2 = [5, 0, 0] >>> udp3 = [10, 5, 0] >>> udp4 = [15, 3, 0] - >>> polyline = aedtapp.modeler.create_polyline( - ... [udp1, udp2, udp3, udp4], cover_surface=False, name="helix_polyline" - ... ) - - >>> helix_right_turn = aedtapp.modeler.create_helix( - ... polyline_name=polyline.name, - ... position=[0, 0, 0], - ... x_start_dir=0, - ... y_start_dir=1.0, - ... z_start_dir=1.0, - ... num_thread=1, - ... right_hand=True, - ... radius_increment=0.0, - ... thread=1.0, - ... ) + >>> polyline = aedtapp.modeler.create_polyline([udp1, udp2, udp3, udp4],cover_surface=False, + ... name="helix_polyline") + >>> helix_right_turn = aedtapp.modeler.create_helix(assignment=polyline.name,origin=[0, 0, 0], + ... x_start_dir=0,y_start_dir=1.0,z_start_dir=1.0, + ... turns=1,right_hand=True,radius_increment=0.0,thread=1.0) """ - if not polyline_name or polyline_name == "": + if not assignment or assignment == "": self.logger.error("The name of the polyline cannot be an empty string.") return False - if len(position) != 3: + if len(origin) != 3: self.logger.error("The ``position`` argument must be a valid three-element list.") return False - x_center, y_center, z_center = self._pos_with_arg(position) + x_center, y_center, z_center = self._pos_with_arg(origin) vArg1 = ["NAME:Selections"] - vArg1.append("Selections:="), vArg1.append(polyline_name) + vArg1.append("Selections:="), vArg1.append(assignment) vArg1.append("NewPartsModelFlag:="), vArg1.append("Model") vArg2 = ["NAME:HelixParameters"] @@ -1140,7 +1126,7 @@ def create_helix(self, polyline_name, position, x_start_dir, y_start_dir, z_star vArg2.append("ZStartDir:=") vArg2.append(self._arg_with_dim(z_start_dir)) vArg2.append("NumThread:=") - vArg2.append(num_thread) + vArg2.append(turns) vArg2.append("RightHand:=") vArg2.append(right_hand) vArg2.append("RadiusIncrement:=") @@ -1149,27 +1135,27 @@ def create_helix(self, polyline_name, position, x_start_dir, y_start_dir, z_star vArg2.append(self._arg_with_dim(thread)) self.oeditor.CreateHelix(vArg1, vArg2) - if polyline_name in self.objects_by_name: - del self.objects[self.objects_by_name[polyline_name].id] - return self._create_object(polyline_name, **kwargs) + if assignment in self.objects_by_name: + del self.objects[self.objects_by_name[assignment].id] + return self._create_object(assignment, **kwargs) - @pyaedt_function_handler() + @pyaedt_function_handler(udmfullname="udm_full_name", udm_params_list="parameters", udm_library="library") def create_udm( self, - udmfullname, - udm_params_list, - udm_library="syslib", + udm_full_name, + parameters, + library="syslib", name=None, ): """Create a user-defined model. Parameters ---------- - udmfullname : str + udm_full_name : str Full name for the user-defined model, including the folder name. - udm_params_list : + parameters : List of user-defined object pairs for the model. - udm_library : str, optional + library : str, optional Name of the library for the user-defined model. The default is ``"syslib"``. name : str, optional Name of the user-defined model. The default is ``None```. @@ -1188,7 +1174,7 @@ def create_udm( vArg1 = ["NAME:UserDefinedModelParameters", ["NAME:Definition"], ["NAME:Options"]] vArgParamVector = ["NAME:GeometryParams"] - for pair in udm_params_list: + for pair in parameters: if isinstance(pair, list): name_param = pair[0] val = pair[1] @@ -1226,9 +1212,9 @@ def create_udm( vArg1.append(vArgParamVector) vArg1.append("DllName:=") - vArg1.append(udmfullname) + vArg1.append(udm_full_name) vArg1.append("Library:=") - vArg1.append(udm_library) + vArg1.append(library) vArg1.append("Version:=") vArg1.append("2.0") vArg1.append("ConnectionID:=") @@ -1306,16 +1292,15 @@ def create_spiral(self, internal_radius=10, spacing=1, faces=8, turns=10, width= pts.append((x1, y1, elevation)) pts.append((x1, 0, elevation)) - p1 = self.create_polyline( - pts, xsection_type="Rectangle", xsection_width=width, xsection_height=thickness, matname=material - ) + p1 = self.create_polyline(pts, material=material, xsection_type="Rectangle", xsection_width=width, + xsection_height=thickness) if name: p1.name = name self._create_object(name, **kwargs) return p1 - @pyaedt_function_handler() - def _create_reference_cs_from_3dcomp(self, udm_obj, password): + @pyaedt_function_handler(udm_obj="assignment") + def _create_reference_cs_from_3dcomp(self, assignment, password): """Create a new coordinate system from the 3d component reference one. Returns @@ -1324,7 +1309,7 @@ def _create_reference_cs_from_3dcomp(self, udm_obj, password): Name of the created coordinate system that mirrors the reference one of the 3d component. """ - app = udm_obj.edit_definition(password=password) + app = assignment.edit_definition(password=password) wcs = app.modeler.oeditor.GetActiveCoordinateSystem() if wcs != "Global": temp_folder = os.path.join( @@ -1344,13 +1329,13 @@ def _create_reference_cs_from_3dcomp(self, udm_obj, password): os.rmdir(os.path.join(root, name)) os.rmdir(temp_folder) phi, theta, psi = GeometryOperators.quaternion_to_euler_zxz(q) - cs_name = udm_obj.name + "_" + wcs + "_ref" + cs_name = assignment.name + "_" + wcs + "_ref" if cs_name not in [i.name for i in self.coordinate_systems]: self.create_coordinate_system( mode="zxz", origin=o, name=cs_name, - reference_cs=udm_obj.target_coordinate_system, + reference_cs=assignment.target_coordinate_system, psi=psi, theta=theta, phi=phi, @@ -1358,39 +1343,42 @@ def _create_reference_cs_from_3dcomp(self, udm_obj, password): return cs_name else: app.oproject.Close() - return udm_obj.target_coordinate_system + return assignment.target_coordinate_system - @pyaedt_function_handler() + @pyaedt_function_handler(comp_file="input_file", geo_params="geometry_parameters", + sz_mat_params="material_parameters", + sz_design_params="design_parameters", + targetCS="coordinate_system", auxiliary_dict="auxiliary_parameters") def insert_3d_component( self, - comp_file, - geo_params=None, - sz_mat_params="", - sz_design_params="", - targetCS="Global", + input_file, + geometry_parameters=None, + material_parameters="", + design_parameters="", + coordinate_system="Global", name=None, password="", - auxiliary_dict=False, + auxiliary_parameters=False, ): """Insert a new 3D component. Parameters ---------- - comp_file : str + input_file : str Name of the component file. - geo_params : dict, optional + geometry_parameters : dict, optional Geometrical parameters. - sz_mat_params : str, optional + material_parameters : str, optional Material parameters. The default is ``""``. - sz_design_params : str, optional + design_parameters : str, optional Design parameters. The default is ``""``. - targetCS : str, optional + coordinate_system : str, optional Target coordinate system. The default is ``"Global"``. name : str, optional 3D component name. The default is ``None``. password : str, optional Password for encrypted components. The default is an empty string. - auxiliary_dict : bool or str, optional + auxiliary_parameters : bool or str, optional Enable the advanced 3d component import. It is possible to set explicitly the json file. The default is ``False``. @@ -1404,7 +1392,7 @@ def insert_3d_component( >>> oEditor.Insert3DComponent """ - aedt_fh = open_file(comp_file, "rb") + aedt_fh = open_file(input_file, "rb") if aedt_fh: temp = aedt_fh.read().splitlines() _all_lines = [] @@ -1421,17 +1409,17 @@ def insert_3d_component( aedt_fh.close() vArg1 = ["NAME:InsertComponentData"] sz_geo_params = "" - if not geo_params: - geometryparams = self._app.get_components3d_vars(comp_file) + if not geometry_parameters: + geometryparams = self._app.get_components3d_vars(input_file) if geometryparams: - geo_params = geometryparams + geometry_parameters = geometryparams - if geo_params: - sz_geo_params = "".join(["{0}='{1}' ".format(par, val) for par, val in geo_params.items()]) + if geometry_parameters: + sz_geo_params = "".join(["{0}='{1}' ".format(par, val) for par, val in geometry_parameters.items()]) vArg1.append("TargetCS:=") - vArg1.append(targetCS) + vArg1.append(coordinate_system) vArg1.append("ComponentFile:=") - vArg1.append(comp_file) + vArg1.append(input_file) vArg1.append("IsLocal:=") vArg1.append(False) vArg1.append("UniqueIdentifier:=") @@ -1441,9 +1429,9 @@ def insert_3d_component( "GeometryParameters:=", sz_geo_params, "MaterialParameters:=", - sz_mat_params, + material_parameters, "DesignParameters:=", - sz_design_params, + design_parameters, ] vArg1.append(varg2) vArg1.append("Password:=") @@ -1454,10 +1442,10 @@ def insert_3d_component( obj_list = list(self.oeditor.Get3DComponentPartNames(new_object_name)) for new_name in obj_list: self._create_object(new_name) - if auxiliary_dict: - if isinstance(auxiliary_dict, bool): - auxiliary_dict = comp_file + ".json" - aux_dict = json.load(open(auxiliary_dict, "r")) + if auxiliary_parameters: + if isinstance(auxiliary_parameters, bool): + auxiliary_parameters = input_file + ".json" + aux_dict = json.load(open(auxiliary_parameters, "r")) if aux_dict.get("datasets", None): for dat in aux_dict["datasets"]: key = dat["Name"] @@ -1480,11 +1468,11 @@ def insert_3d_component( dat["vunit"], ) udm_obj = self._create_user_defined_component(new_object_name) - if name and not auxiliary_dict: + if name and not auxiliary_parameters: udm_obj.name = name except Exception: # pragma: no cover udm_obj = False - if auxiliary_dict and udm_obj: + if auxiliary_parameters and udm_obj: mapping_dict = {} if aux_dict.get("native components", None): if aux_dict.get("coordinatesystems", None): @@ -1523,15 +1511,15 @@ def insert_3d_component( old_udm = set(list(self._app.modeler.user_defined_components)) old_cs = set(self._app.modeler.coordinate_systems) self._app.configurations.import_config(temp_dict_file, exclude_set) - targetCS = self._create_reference_cs_from_3dcomp(udm_obj, password) - if targetCS != "Global": + coordinate_system = self._create_reference_cs_from_3dcomp(udm_obj, password) + if coordinate_system != "Global": self._app.modeler.refresh_all_ids() for udm in set(list(self._app.modeler.user_defined_components)) - old_udm: if self._app.modeler.user_defined_components[udm].target_coordinate_system == "Global": - self._app.modeler.user_defined_components[udm].target_coordinate_system = targetCS + self._app.modeler.user_defined_components[udm].target_coordinate_system = coordinate_system for cs in set(self._app.modeler.coordinate_systems) - old_cs: if cs.ref_cs == "Global": - cs.ref_cs = targetCS + cs.ref_cs = coordinate_system if aux_dict.get("monitors", None): temp_proj_name = generate_unique_project_name() ipkapp_temp = Icepak(projectname=os.path.join(self._app.toolkit_directory, temp_proj_name)) @@ -1600,7 +1588,7 @@ def insert_3d_component( m_case = mon["Type"] if m_case == "Point": cs_old = self._app.odesign.SetActiveEditor("3D Modeler").GetActiveCoordinateSystem() - self._app.modeler.set_working_coordinate_system(targetCS) + self._app.modeler.set_working_coordinate_system(coordinate_system) self._app.monitor.assign_point_monitor( mon["Location"], monitor_quantity=mon["Quantity"], monitor_name=key ) @@ -1636,10 +1624,10 @@ def insert_3d_component( else: return udm_obj - @pyaedt_function_handler() + @pyaedt_function_handler(comp_file="input_file") def insert_layout_component( self, - comp_file, + input_file, coordinate_system="Global", name=None, parameter_mapping=False, @@ -1650,7 +1638,7 @@ def insert_layout_component( Parameters ---------- - comp_file : str + input_file : str Path of the component file. Either ``".aedb"`` and ``".aedbcomp"`` are allowed. coordinate_system : str, optional Target coordinate system. The default is ``"Global"``. @@ -1687,7 +1675,7 @@ def insert_layout_component( self.logger.warning("Solution type must be terminal in HFSS or APhi in Maxwell") return False - component_name = os.path.splitext(os.path.basename(comp_file))[0] + component_name = os.path.splitext(os.path.basename(input_file))[0] aedt_component_name = component_name if component_name not in self._app.o_component_manager.GetNames(): compInfo = ["NAME:" + str(component_name), "Info:=", []] @@ -1707,7 +1695,7 @@ def insert_layout_component( "CompExtID:=", 9, "ModelEDBFilePath:=", - comp_file, + input_file, "EDBCompPassword:=", "", ] @@ -1719,8 +1707,8 @@ def insert_layout_component( name = generate_unique_name("LC") # Open Layout component and get information - aedb_component_path = comp_file - if os.path.splitext(os.path.basename(comp_file))[1] == ".aedbcomp": + aedb_component_path = input_file + if os.path.splitext(os.path.basename(input_file))[1] == ".aedbcomp": aedb_project_path = os.path.join(self._app.project_path, self._app.project_name + ".aedb") aedb_component_path = os.path.join( aedb_project_path, "LayoutComponents", aedt_component_name, aedt_component_name + ".aedb" @@ -1905,13 +1893,13 @@ def insert_layout_component( udm_obj = False return udm_obj - @pyaedt_function_handler() - def get_3d_component_object_list(self, componentname): + @pyaedt_function_handler(componentname="name") + def get_3d_component_object_list(self, name): """Retrieve all objects belonging to a 3D component. Parameters ---------- - componentname : str + name : str Name of the 3D component. Returns @@ -1925,7 +1913,7 @@ def get_3d_component_object_list(self, componentname): >>> oeditor.GetChildObject """ if self._app._is_object_oriented_enabled(): - compobj = self.oeditor.GetChildObject(componentname) + compobj = self.oeditor.GetChildObject(name) if compobj: return list(compobj.GetChildNames()) else: @@ -1951,17 +1939,17 @@ def _initialize_multipart(self): else: return MultiPartComponent.start(self._app) - @pyaedt_function_handler() + @pyaedt_function_handler(actor_folder="input_dir", relative_cs_name="coordinate_system", actor_name="name") def add_person( self, - actor_folder, + input_dir, speed=0.0, global_offset=[0, 0, 0], yaw=0, pitch=0, roll=0, - relative_cs_name=None, - actor_name=None, + coordinate_system=None, + name=None, ): """Add a Walking Person Multipart from 3D Components. @@ -2018,7 +2006,7 @@ def add_person( Parameters ---------- - actor_folder : str + input_dir : str Path to the actor folder. It must contain a json settings file and a 3dcomponent (.a3dcomp). speed : float, optional @@ -2031,9 +2019,9 @@ def add_person( Pitch Rotation from Global Coordinate System in deg. roll : float, optional Roll Rotation from Global Coordinate System in deg. - relative_cs_name : str + coordinate_system : str Relative CS Name of the actor. ``None`` for Global CS. - actor_name : str + name : str If provided, it overrides the actor name in the JSON. Returns @@ -2046,11 +2034,11 @@ def add_person( >>> oEditor.Insert3DComponent """ self._initialize_multipart() - if not self._check_actor_folder(actor_folder): + if not self._check_actor_folder(input_dir): return False - person1 = Person(actor_folder, speed=speed, relative_cs_name=relative_cs_name) - if actor_name: - person1._name = actor_name + person1 = Person(input_dir, speed=speed, relative_cs_name=coordinate_system) + if name: + person1._name = name person1.offset = global_offset person1.yaw = self._arg_with_dim(yaw, "deg") person1.pitch = self._arg_with_dim(pitch, "deg") @@ -2059,17 +2047,17 @@ def add_person( self.multiparts.append(person1) return person1 - @pyaedt_function_handler() + @pyaedt_function_handler(actor_folder="input_dir", relative_cs_name="coordinate_system", actor_name="name") def add_vehicle( self, - actor_folder, + input_dir, speed=0, global_offset=[0, 0, 0], yaw=0, pitch=0, roll=0, - relative_cs_name=None, - actor_name=None, + coordinate_system=None, + name=None, ): """Add a Moving Vehicle Multipart from 3D Components. @@ -2109,7 +2097,7 @@ def add_vehicle( Parameters ---------- - actor_folder : str + input_dir : str Path to the actor directory. It must contain a json settings file and a 3dcomponent (``.a3dcomp`` file). speed : float, optional @@ -2122,7 +2110,7 @@ def add_vehicle( Pitch Rotation from Global Coordinate System in deg. roll : float, optional Roll Rotation from Global Coordinate System in deg. - relative_cs_name : str + coordinate_system : str Relative CS Name of the actor. ``None`` for Global CS. Returns @@ -2136,11 +2124,11 @@ def add_vehicle( """ self._initialize_multipart() - if not self._check_actor_folder(actor_folder): + if not self._check_actor_folder(input_dir): return False - vehicle = Vehicle(actor_folder, speed=speed, relative_cs_name=relative_cs_name) - if actor_name: - vehicle._name = actor_name + vehicle = Vehicle(input_dir, speed=speed, relative_cs_name=coordinate_system) + if name: + vehicle._name = name vehicle.offset = global_offset vehicle.yaw = self._arg_with_dim(yaw, "deg") vehicle.pitch = self._arg_with_dim(pitch, "deg") @@ -2149,18 +2137,18 @@ def add_vehicle( self.multiparts.append(vehicle) return vehicle - @pyaedt_function_handler() + @pyaedt_function_handler(actor_folder="input_dir", relative_cs_name="coordinate_system", actor_name="name") def add_bird( self, - actor_folder, + input_dir, speed=0, global_offset=[0, 0, 0], yaw=0, pitch=0, roll=0, flapping_rate=50, - relative_cs_name=None, - actor_name=None, + coordinate_system=None, + name=None, ): """Add a Bird Multipart from 3D Components. @@ -2210,7 +2198,7 @@ def add_bird( Parameters ---------- - actor_folder : str + input_dir : str Path to the actor directory. It must contain a json settings file and a 3dcomponent (``.a3dcomp`` file) speed : float, optional @@ -2225,7 +2213,7 @@ def add_bird( Roll Rotation from Global Coordinate System in deg. flapping_rate : float, optional Motion flapping rate in Hz. - relative_cs_name : str + coordinate_system : str Relative CS Name of the actor. ``None`` for Global CS. Returns @@ -2242,21 +2230,21 @@ def add_bird( >>> from pyaedt import Hfss >>> app = Hfss() >>> bird_dir = "path/to/bird/directory" - >>> bird1 = app.modeler.add_bird(bird_dir, 1.0, [19, 4, 3], 120, -5, flapping_rate=30) + >>> bird1 = app.modeler.add_bird(bird_dir,1.0,[19, 4, 3],120,-5,flapping_rate=30) """ self._initialize_multipart() - if not self._check_actor_folder(actor_folder): + if not self._check_actor_folder(input_dir): return False bird = Bird( - actor_folder, + input_dir, speed=speed, flapping_rate=self._arg_with_dim(flapping_rate, "Hz"), - relative_cs_name=relative_cs_name, + relative_cs_name=coordinate_system, ) - if actor_name: - bird._name = actor_name + if name: + bird._name = name bird.offset = global_offset bird.yaw = self._arg_with_dim(yaw, "deg") bird.pitch = self._arg_with_dim(pitch, "deg") @@ -2265,10 +2253,10 @@ def add_bird( self.multiparts.append(bird) return bird - @pyaedt_function_handler() + @pyaedt_function_handler(env_folder="input_dir", relative_cs_name="coordinate_system", environment_name="name") def add_environment( - self, env_folder, global_offset=[0, 0, 0], yaw=0, pitch=0, roll=0, relative_cs_name=None, - environment_name=None + self, input_dir, global_offset=[0, 0, 0], yaw=0, pitch=0, roll=0, coordinate_system=None, + name=None ): """Add an Environment Multipart Component from JSON file. @@ -2295,7 +2283,7 @@ def add_environment( Parameters ---------- - env_folder : str + input_dir : str Path to the actor directory. It must contain a json settings file and a 3dcomponent (``.a3dcomp`` file). global_offset : list, optional @@ -2306,7 +2294,7 @@ def add_environment( Pitch Rotation from Global Coordinate System in deg. roll : float, optional Roll Rotation from Global Coordinate System in deg. - relative_cs_name : str + coordinate_system : str Relative CS Name of the actor. ``None`` for Global CS. Returns @@ -2320,11 +2308,11 @@ def add_environment( """ self._initialize_multipart() - if not self._check_actor_folder(env_folder): + if not self._check_actor_folder(input_dir): return False - environment = Environment(env_folder, relative_cs_name=relative_cs_name) - if environment_name: - environment._name = environment_name + environment = Environment(input_dir, relative_cs_name=coordinate_system) + if name: + environment._name = name environment.offset = global_offset environment.yaw = self._arg_with_dim(yaw, "deg") environment.pitch = self._arg_with_dim(pitch, "deg") @@ -2333,13 +2321,13 @@ def add_environment( self.multiparts.append(environment) return environment - @pyaedt_function_handler() - def create_choke(self, json_file): + @pyaedt_function_handler(json_file="input_file") + def create_choke(self, input_file): """Create a choke from a JSON setting file. Parameters ---------- - json_file : str + input_file : str Full path of the JSON file with the choke settings. Returns @@ -2368,7 +2356,7 @@ def create_choke(self, json_file): >>> mychoke = hfss.modeler.create_choke("C:/Example/Of/Path/myJsonFile_Corrected.json") """ - with open_file(json_file, "r") as read_file: + with open_file(input_file, "r") as read_file: values = json.load(read_file) self.logger.info("CHOKE INFO: " + str(values)) @@ -2511,9 +2499,8 @@ def create_choke(self, json_file): if values["Mode"]["Common"] and number_duplication == 2: if isinstance(list_object[0], list): for i in range(len(list_object)): - duplication = self.create_polyline( - position_list=list_object[i][1], name=name_wind, matname=material_wind - ) + duplication = self.create_polyline(points=list_object[i][1], name=name_wind, + material=material_wind) duplication.mirror([0, 0, 0], [-1, 0, 0]) duplication_points = self.get_vertices_of_line(duplication.name) success = duplication.set_crosssection_properties( @@ -2522,9 +2509,7 @@ def create_choke(self, json_file): list_duplicated_object.append([duplication, duplication_points]) else: - duplication = self.create_polyline( - position_list=list_object[1], name=name_wind, matname=material_wind - ) + duplication = self.create_polyline(points=list_object[1], name=name_wind, material=material_wind) duplication.mirror([0, 0, 0], [-1, 0, 0]) duplication_points = self.get_vertices_of_line(duplication.name) success = duplication.set_crosssection_properties(type=section, width=w_dia, num_seg=segment_number) @@ -2533,9 +2518,8 @@ def create_choke(self, json_file): if isinstance(list_object[0], list): for j in range(number_duplication - 1): for i in range(len(list_object)): - duplication = self.create_polyline( - position_list=list_object[i][1], name=name_wind, matname=material_wind - ) + duplication = self.create_polyline(points=list_object[i][1], name=name_wind, + material=material_wind) duplication.rotate("Z", (j + 1) * 360 / number_duplication) duplication_points = self.get_vertices_of_line(duplication.name) success = duplication.set_crosssection_properties( @@ -2544,9 +2528,8 @@ def create_choke(self, json_file): list_duplicated_object.append([duplication, duplication_points]) else: for j in range(number_duplication - 1): - duplication = self.create_polyline( - position_list=list_object[1], name=name_wind, matname=material_wind - ) + duplication = self.create_polyline(points=list_object[1], name=name_wind, + material=material_wind) duplication.rotate("Z", (j + 1) * 360 / number_duplication) duplication_points = self.get_vertices_of_line(duplication.name) success = duplication.set_crosssection_properties( @@ -2591,12 +2574,11 @@ def _make_winding(self, name, material, in_rad, out_rad, height, teta, turns, ch ] ) - polyline = self.create_polyline(position_list=points, name=name, matname=material) + polyline = self.create_polyline(points=points, name=name, material=material) union_polyline1 = [polyline.name] if turns > 1: - union_polyline2 = polyline.duplicate_around_axis( - cs_axis="Z", angle=2 * teta, nclones=turns, create_new_objects=True - ) + union_polyline2 = polyline.duplicate_around_axis(axis="Z", angle=2 * teta, clones=turns, + create_new_objects=True) else: union_polyline2 = [] union_polyline = union_polyline1 + union_polyline2 @@ -2614,7 +2596,7 @@ def _make_winding(self, name, material, in_rad, out_rad, height, teta, turns, ch positions.pop() positions.insert(0, [positions[0][0], positions[0][1], -height]) positions.append([positions[-1][0], positions[-1][1], -height]) - true_polyline = self.create_polyline(position_list=positions, name=name, matname=material) + true_polyline = self.create_polyline(points=positions, name=name, material=material) true_polyline.rotate("Z", 180 - (turns - 1) * teta) positions = self.get_vertices_of_line(true_polyline.name) return [true_polyline, positions] @@ -2665,9 +2647,9 @@ def _make_double_linked_winding( points_in_wind[-1] = [points_in_wind[-2][0], points_in_wind[-2][1], points_out_wind[1][2]] points_in_wind.append([points_in_wind[-3][0], points_in_wind[-3][1], points_out_wind[0][2]]) - outer_polyline = self.create_polyline(position_list=points_out_wind, name=name, matname=material) + outer_polyline = self.create_polyline(points=points_out_wind, name=name, material=material) outer_polyline.rotate("Z", 180 - (turns - 1) * teta) - inner_polyline = self.create_polyline(position_list=points_in_wind, name=name, matname=material) + inner_polyline = self.create_polyline(points=points_in_wind, name=name, material=material) inner_polyline.rotate("Z", 180 - (turns_in_wind - 1) * teta_in_wind) outer_polyline.mirror([0, 0, 0], [0, -1, 0]) outer_polyline.rotate("Z", turns_in_wind * teta_in_wind - turns * teta) @@ -2677,7 +2659,7 @@ def _make_double_linked_winding( for i in range(len(list_polyline)): list_positions = list_positions + self.get_vertices_of_line(list_polyline[i]) self.delete(list_polyline) - true_polyline = self.create_polyline(position_list=list_positions, name=name, matname=material) + true_polyline = self.create_polyline(points=list_positions, name=name, material=material) return [true_polyline, list_positions] @pyaedt_function_handler() @@ -2735,11 +2717,11 @@ def _make_triple_linked_winding( points_in_wind[-1] = [points_in_wind[-2][0], points_in_wind[-2][1], points_mid_wind[1][2]] points_in_wind.append([points_in_wind[-3][0], points_in_wind[-3][1], points_mid_wind[0][2]]) - outer_polyline = self.create_polyline(position_list=points_out_wind, name=name, matname=material) + outer_polyline = self.create_polyline(points=points_out_wind, name=name, material=material) outer_polyline.rotate("Z", 180 - (turns - 1) * teta) - mid_polyline = self.create_polyline(position_list=points_mid_wind, name=name, matname=material) + mid_polyline = self.create_polyline(points=points_mid_wind, name=name, material=material) mid_polyline.rotate("Z", 180 - (turns_mid_wind - 1) * teta_mid_wind) - inner_polyline = self.create_polyline(position_list=points_in_wind, name=name, matname=material) + inner_polyline = self.create_polyline(points=points_in_wind, name=name, material=material) inner_polyline.rotate("Z", 180 - (turns_in_wind - 1) * teta_in_wind) mid_polyline.mirror([0, 0, 0], [0, -1, 0]) @@ -2752,7 +2734,7 @@ def _make_triple_linked_winding( for i in range(len(list_polyline)): list_positions = list_positions + self.get_vertices_of_line(list_polyline[i]) self.delete(list_polyline) - true_polyline = self.create_polyline(position_list=list_positions, name=name, matname=material) + true_polyline = self.create_polyline(points=list_positions, name=name, material=material) return [true_polyline, list_positions] @pyaedt_function_handler() @@ -2850,20 +2832,20 @@ def _make_triple_winding( @pyaedt_function_handler() def _make_core(self, name, material, in_rad, out_rad, height, chamfer): - tool = self.create_cylinder("Z", [0, 0, -height / 2], in_rad, height, 0, "Tool", matname=material) - core = self.create_cylinder("Z", [0, 0, -height / 2], out_rad, height, 0, name=name, matname=material) + tool = self.create_cylinder("Z", [0, 0, -height / 2], in_rad, height, 0, "Tool", material=material) + core = self.create_cylinder("Z", [0, 0, -height / 2], out_rad, height, 0, name=name, material=material) core.subtract(tool, False) for n in core.edges: n.chamfer(chamfer) return core - @pyaedt_function_handler() - def check_choke_values(self, json_file, create_another_file=True): + @pyaedt_function_handler(json_file="input_dir", ) + def check_choke_values(self, input_dir, create_another_file=True): """Verify the values in the json file and create another one with corrected values next to the first one. Parameters ---------- - json_file : str + input_dir : str Full path to json file; Specific json file containing all the parameters to design your on choke. create_another_file : bool @@ -2933,7 +2915,7 @@ def check_choke_values(self, json_file, create_another_file=True): } are_inequations_checkable = True sr = 1.1 # Security factor - with open_file(json_file, "r") as read_file: + with open_file(input_dir, "r") as read_file: values = json.load(read_file) for key, value in dictionary_model.items(): @@ -3297,12 +3279,12 @@ def check_choke_values(self, json_file, create_another_file=True): values["Inner Winding"]["Occupation(%)"] = occ if create_another_file: - root_path, extension_path = os.path.splitext(json_file) + root_path, extension_path = os.path.splitext(input_dir) new_path = root_path + "_Corrected" + extension_path with open_file(new_path, "w") as outfile: json.dump(values, outfile) else: - with open_file(json_file, "w") as outfile: + with open_file(input_dir, "w") as outfile: json.dump(values, outfile) return [are_inequations_checkable, values] diff --git a/pyaedt/modeler/cad/component_array.py b/pyaedt/modeler/cad/component_array.py index c49f9dffa26..b0da2e6bd38 100644 --- a/pyaedt/modeler/cad/component_array.py +++ b/pyaedt/modeler/cad/component_array.py @@ -43,7 +43,7 @@ def __init__(self, app, name=None): # Leverage csv file if possible (aedt version > 2023.2) if self.__app.settings.aedt_version > "2023.2": # pragma: no cover - self.export_array_info(array_path=None) + self.export_array_info(output_file=None) self.__array_info_path = os.path.join(self.__app.toolkit_directory, "array_info.csv") else: self.__app.save_project() @@ -96,7 +96,7 @@ def cells(self): return self.__cells if self.__app.settings.aedt_version > "2023.2": # pragma: no cover - self.export_array_info(array_path=None) + self.export_array_info(output_file=None) else: self.__app.save_project() @@ -320,7 +320,7 @@ def update_properties(self): """ # From 2024R1, array information can be loaded from a CSV, and this method is not needed. if self.__app.settings.aedt_version > "2023.2": # pragma: no cover - self.export_array_info(array_path=None) + self.export_array_info(output_file=None) else: self.__app.save_project() new_properties = self.properties @@ -345,8 +345,8 @@ def delete(self): del self.__app.component_array[self.name] self.__app.component_array_names = list(self.__app.get_oo_name(self.__app.odesign, "Model")) - @pyaedt_function_handler() - def export_array_info(self, array_path=None): # pragma: no cover + @pyaedt_function_handler(array_path="output_file") + def export_array_info(self, output_file=None): # pragma: no cover """Export array information to a CSV file. Returns @@ -364,18 +364,18 @@ def export_array_info(self, array_path=None): # pragma: no cover self.logger.warning("This feature is not available in {}.".format(str(self.__app.settings.aedt_version))) return False - if not array_path: # pragma: no cover - array_path = os.path.join(self.__app.toolkit_directory, "array_info.csv") - self.__app.omodelsetup.ExportArray(self.name, array_path) - return array_path + if not output_file: # pragma: no cover + output_file = os.path.join(self.__app.toolkit_directory, "array_info.csv") + self.__app.omodelsetup.ExportArray(self.name, output_file) + return output_file - @pyaedt_function_handler() - def parse_array_info_from_csv(self, csv_file): # pragma: no cover + @pyaedt_function_handler(csv_file="input_file") + def parse_array_info_from_csv(self, input_file): # pragma: no cover """Parse component array information from the CSV file. Parameters ---------- - csv_file : str + input_file : str Name of the CSV file. Returns @@ -393,7 +393,7 @@ def parse_array_info_from_csv(self, csv_file): # pragma: no cover >>> array_info = array.array_info_parser(array_csv) """ - info = read_csv(csv_file) + info = read_csv(input_file) if not info: self.logger.error("Data from CSV file is not loaded.") return False diff --git a/pyaedt/modeler/cad/components_3d.py b/pyaedt/modeler/cad/components_3d.py index b4971146540..25e3d419424 100644 --- a/pyaedt/modeler/cad/components_3d.py +++ b/pyaedt/modeler/cad/components_3d.py @@ -485,13 +485,13 @@ def delete(self): self._primitives.cleanup_objects() self.__dict__ = {} - @pyaedt_function_handler() - def duplicate_and_mirror(self, position, vector): + @pyaedt_function_handler(position="origin") + def duplicate_and_mirror(self, origin, vector): """Duplicate and mirror a selection. Parameters ---------- - position : float + origin : float List of the ``[x, y, z]`` coordinates or Application.Position object for the selection. vector : float @@ -508,9 +508,7 @@ def duplicate_and_mirror(self, position, vector): >>> oEditor.DuplicateMirror """ - return self._primitives.duplicate_and_mirror( - self.name, position, vector, is_3d_comp=True, duplicate_assignment=True - ) + return self._primitives.duplicate_and_mirror(self.name, origin=origin, vector=vector, is_3d_comp=True) @pyaedt_function_handler() def mirror(self, position, vector): @@ -544,18 +542,18 @@ def mirror(self, position, vector): return self return False - @pyaedt_function_handler() - def rotate(self, cs_axis, angle=90.0, unit="deg"): + @pyaedt_function_handler(cs_axis="axis", unit="units") + def rotate(self, axis, angle=90.0, units="deg"): """Rotate the selection. Parameters ---------- - cs_axis + axis Coordinate system axis or the Application.AXIS object. angle : float, optional Angle of rotation. The units, defined by ``unit``, can be either degrees or radians. The default is ``90.0``. - unit : text, optional + units : text, optional Units for the angle. Options are ``"deg"`` or ``"rad"``. The default is ``"deg"``. @@ -570,11 +568,11 @@ def rotate(self, cs_axis, angle=90.0, unit="deg"): >>> oEditor.Rotate """ if self.is3dcomponent: - if self._primitives.rotate(self.name, cs_axis=cs_axis, angle=angle, unit=unit): + if self._primitives.rotate(self.name, axis=axis, angle=angle, units=units): return self else: for part in self.parts: - self._primitives.rotate(part, cs_axis=cs_axis, angle=angle, unit=unit) + self._primitives.rotate(part, axis=axis, angle=angle, units=units) return self return False @@ -598,26 +596,26 @@ def move(self, vector): >>> oEditor.Move """ if self.is3dcomponent: - if self._primitives.move(self.name, vector=vector): + if self._primitives.move(self.name, vector): return self else: for part in self.parts: - self._primitives.move(part, vector=vector) + self._primitives.move(part, vector) return self return False - @pyaedt_function_handler() - def duplicate_around_axis(self, cs_axis, angle=90, nclones=2, create_new_objects=True): + @pyaedt_function_handler(cs_axis="axis", nclones="clones") + def duplicate_around_axis(self, axis, angle=90, clones=2, create_new_objects=True): """Duplicate the component around the axis. Parameters ---------- - cs_axis : Application.AXIS object + axis : Application.AXIS object Coordinate system axis of the object. angle : float, optional Angle of rotation in degrees. The default is ``90``. - nclones : int, optional + clones : int, optional Number of clones. The default is ``2``. create_new_objects : bool, optional Whether to create copies as new objects. The default is ``True``. @@ -635,23 +633,23 @@ def duplicate_around_axis(self, cs_axis, angle=90, nclones=2, create_new_objects """ if self.is3dcomponent: ret, added_objects = self._primitives.duplicate_around_axis( - self.name, cs_axis, angle, nclones, create_new_objects, True + self.name, axis, angle, clones, create_new_objects=create_new_objects, is_3d_comp=True ) return added_objects self._logger.warning("User-defined models do not support this operation.") return False - @pyaedt_function_handler() - def duplicate_along_line(self, vector, nclones=2, attach_object=False, **kwargs): + @pyaedt_function_handler(nclones="clones", attach_object="attach") + def duplicate_along_line(self, vector, clones=2, attach=False, **kwargs): """Duplicate the object along a line. Parameters ---------- vector : list List of ``[x1 ,y1, z1]`` coordinates for the vector or the Application.Position object. - nclones : int, optional + clones : int, optional Number of clones. The default is ``2``. - attach_object : bool, optional + attach : bool, optional Whether to attach the object. The default is ``False``. Returns @@ -674,7 +672,9 @@ def duplicate_along_line(self, vector, nclones=2, attach_object=False, **kwargs) if self.is3dcomponent: old_component_list = self._primitives.user_defined_component_names - _, added_objects = self._primitives.duplicate_along_line(self.name, vector, nclones, attach_object, True) + _, added_objects = self._primitives.duplicate_along_line( + self.name, vector, clones, attach=attach, is_3d_comp=True + ) return list(set(added_objects) - set(old_component_list)) self._logger.warning("User-defined models do not support this operation.") return False @@ -819,15 +819,15 @@ def get_component_filepath(self): "3D Component File Path" ) - @pyaedt_function_handler() - def update_definition(self, password="", new_filepath=""): + @pyaedt_function_handler(new_filepath="output_file") + def update_definition(self, password="", output_file=""): """Update 3d component definition. Parameters ---------- password : str, optional Password for encrypted models. The default value is ``""``. - new_filepath : str, optional + output_file : str, optional New path containing the 3d component file. The default value is ``""``, which means that the 3d component file has not changed. @@ -847,7 +847,7 @@ def update_definition(self, password="", new_filepath=""): "Passwords:=", [password], "NewFilePath:=", - new_filepath, + output_file, ] ) self._primitives._app.modeler.refresh_all_ids() diff --git a/pyaedt/modeler/cad/elements3d.py b/pyaedt/modeler/cad/elements3d.py index 86728471185..ea55690aa8a 100644 --- a/pyaedt/modeler/cad/elements3d.py +++ b/pyaedt/modeler/cad/elements3d.py @@ -745,8 +745,8 @@ def bottom_edge_y(self): except Exception: return None - @pyaedt_function_handler() - def is_on_bounding(self, tol=1e-9): + @pyaedt_function_handler(tol="tolerance") + def is_on_bounding(self, tolerance=1e-9): """Check if the face is on bounding box or Not. Parameters @@ -762,12 +762,12 @@ def is_on_bounding(self, tol=1e-9): b = [float(i) for i in list(self.oeditor.GetModelBoundingBox())] c = self.center if c and ( - abs(c[0] - b[0]) < tol - or abs(c[1] - b[1]) < tol - or abs(c[2] - b[2]) < tol - or abs(c[0] - b[3]) < tol - or abs(c[1] - b[4]) < tol - or abs(c[2] - b[5]) < tol + abs(c[0] - b[0]) < tolerance + or abs(c[1] - b[1]) < tolerance + or abs(c[2] - b[2]) < tolerance + or abs(c[0] - b[3]) < tolerance + or abs(c[1] - b[4]) < tolerance + or abs(c[2] - b[5]) < tolerance ): return True return False diff --git a/pyaedt/modeler/cad/object3d.py b/pyaedt/modeler/cad/object3d.py index b7a529eaa57..695f7f061e3 100644 --- a/pyaedt/modeler/cad/object3d.py +++ b/pyaedt/modeler/cad/object3d.py @@ -48,7 +48,7 @@ class Object3d(object): Create a part, such as box, to return an :class:`pyaedt.modeler.Object3d.Object3d`. - >>> id = prim.create_box([0, 0, 0], [10, 10, 5], "Mybox", "Copper") + >>> id = prim.create_box([0, 0, 0],[10, 10, 5],"Mybox","Copper") >>> part = prim[id] """ @@ -258,8 +258,8 @@ def plot(self, show=True): show=show, ) - @pyaedt_function_handler() - def export_image(self, file_path=None): + @pyaedt_function_handler(file_path="output_file") + def export_image(self, output_file=None): """Export the current object to a specified file path. @@ -268,7 +268,7 @@ def export_image(self, file_path=None): Parameters ---------- - file_path : str, optional + output_file : str, optional File name with full path. If `None` the exported image will be a ``png`` file that will be saved in ``working_directory``. To access the ``working_directory`` the use ``app.working_directory`` property. @@ -279,12 +279,12 @@ def export_image(self, file_path=None): File path. """ if not is_ironpython and self._primitives._app._aedt_version >= "2021.2": - if not file_path: - file_path = os.path.join(self._primitives._app.working_directory, self.name + ".png") + if not output_file: + output_file = os.path.join(self._primitives._app.working_directory, self.name + ".png") model_obj = self._primitives._app.post.plot_model_obj( objects=[self.name], show=False, - export_path=file_path, + export_path=output_file, plot_as_separate_objects=True, clean_files=True, ) @@ -327,13 +327,13 @@ def touching_objects(self): list_names.extend(a) return list_names - @pyaedt_function_handler() - def get_touching_faces(self, object_name): + @pyaedt_function_handler(object_name="assignment") + def get_touching_faces(self, assignment): """Get the objects that touch one of the face center of each face of the object. Parameters ---------- - object_name : str, :class:`Object3d` + assignment : str, :class:`Object3d` Object to check. Returns ------- @@ -341,11 +341,11 @@ def get_touching_faces(self, object_name): list of objects and faces touching.""" _names = [] - if isinstance(object_name, Object3d): - object_name = object_name.name + if isinstance(assignment, Object3d): + assignment = assignment.name for face in self.faces: body_names = self._primitives.get_bodynames_from_position(face.center) - if object_name in body_names: + if assignment in body_names: _names.append(face) return _names @@ -1375,13 +1375,13 @@ def model(self, fModel): self._change_property(vArg1) self._model = fModel - @pyaedt_function_handler() - def unite(self, object_list): + @pyaedt_function_handler(object_list="assignment") + def unite(self, assignment): """Unite a list of objects with this object. Parameters ---------- - object_list : list of str or list of pyaedt.modeler.cad.object3d.Object3d + assignment : list of str or list of pyaedt.modeler.cad.object3d.Object3d List of objects. Returns @@ -1395,17 +1395,17 @@ def unite(self, object_list): >>> oEditor.Unite """ - unite_list = [self.name] + self._primitives.convert_to_selections(object_list, return_list=True) + unite_list = [self.name] + self._primitives.convert_to_selections(assignment, return_list=True) self._primitives.unite(unite_list) return self - @pyaedt_function_handler() - def intersect(self, theList, keep_originals=False): + @pyaedt_function_handler(theList="assignment") + def intersect(self, assignment, keep_originals=False): """Intersect the active object with a given list. Parameters ---------- - theList : list + assignment : list List of objects. keep_originals : bool, optional Whether to keep the original object. The default is ``False``. @@ -1420,8 +1420,8 @@ def intersect(self, theList, keep_originals=False): >>> oEditor.Intersect """ - theList = [self.name] + self._primitives.convert_to_selections(theList, return_list=True) - self._primitives.intersect(theList, keep_originals) + assignment = [self.name] + self._primitives.convert_to_selections(assignment, return_list=True) + self._primitives.intersect(assignment) return self @pyaedt_function_handler() @@ -1462,6 +1462,9 @@ def mirror(self, position, vector, duplicate=False): vector : list of float Vector in Cartesian coordinates ``[x1, y1, z1]`` or the ``Application.Position`` object for the vector normal to the plane used for the mirror operation. + duplicate : bool, optional + Whether to duplicate the object after mirroring it .n. The default + is ``False``, in which case AEDT is not duplicating the object. Returns ------- @@ -1478,18 +1481,18 @@ def mirror(self, position, vector, duplicate=False): return self return False - @pyaedt_function_handler() - def rotate(self, cs_axis, angle=90.0, unit="deg"): + @pyaedt_function_handler(cs_axis="axis", unit="units") + def rotate(self, axis, angle=90.0, units="deg"): """Rotate the selection. Parameters ---------- - cs_axis : int + axis : int Coordinate system axis or the Application.AXIS object. angle : float, optional Angle of rotation. The units, defined by ``unit``, can be either degrees or radians. The default is ``90.0``. - unit : text, optional + units : text, optional Units for the angle. Options are ``"deg"`` or ``"rad"``. The default is ``"deg"``. @@ -1503,7 +1506,7 @@ def rotate(self, cs_axis, angle=90.0, unit="deg"): >>> oEditor.Rotate """ - if self._primitives.rotate(self.id, cs_axis=cs_axis, angle=angle, unit=unit): + if self._primitives.rotate(self.id, axis=axis, angle=angle, units=units): return self return False @@ -1513,8 +1516,6 @@ def move(self, vector): Parameters ---------- - objid : list, Position object - List of object IDs. vector : list Vector of the direction move. It can be a list of the ``[x, y, z]`` coordinates or a Position object. @@ -1529,20 +1530,21 @@ def move(self, vector): ---------- >>> oEditor.Move """ - if self._primitives.move(self.id, vector=vector): + if self._primitives.move(self.id, vector): return self return False - def duplicate_around_axis(self, cs_axis, angle=90, nclones=2, create_new_objects=True): + @pyaedt_function_handler(cs_axis="axis", nclones="clones") + def duplicate_around_axis(self, axis, angle=90, clones=2, create_new_objects=True): """Duplicate the object around the axis. Parameters ---------- - cs_axis : Application.AXIS object + axis : Application.AXIS object Coordinate system axis of the object. angle : float Angle of rotation in degrees. The default is ``90``. - nclones : int, optional + clones : int, optional Number of clones. The default is ``2``. create_new_objects : bool, optional Whether to create copies as new objects. The default is ``True``. @@ -1558,20 +1560,22 @@ def duplicate_around_axis(self, cs_axis, angle=90, nclones=2, create_new_objects >>> oEditor.DuplicateAroundAxis """ - _, added_objects = self._primitives.duplicate_around_axis(self, cs_axis, angle, nclones, create_new_objects) + _, added_objects = self._primitives.duplicate_around_axis( + self, axis, angle, clones, create_new_objects=create_new_objects + ) return added_objects - @pyaedt_function_handler() - def duplicate_along_line(self, vector, nclones=2, attachObject=False): + @pyaedt_function_handler(nclones="clones", attachObject="attach") + def duplicate_along_line(self, vector, clones=2, attach=False): """Duplicate the object along a line. Parameters ---------- vector : list List of ``[x1 ,y1, z1]`` coordinates for the vector or the Application.Position object. - nclones : int, optional + clones : int, optional Number of clones. The default is ``2``. - attachObject : bool, optional + attach : bool, optional Whether to attach the object. The default is ``False``. Returns @@ -1585,7 +1589,7 @@ def duplicate_along_line(self, vector, nclones=2, attachObject=False): >>> oEditor.DuplicateAlongLine """ - _, added_objects = self._primitives.duplicate_along_line(self, vector, nclones, attachObject) + _, added_objects = self._primitives.duplicate_along_line(self, vector, clones, attach=attach) return added_objects @pyaedt_function_handler() @@ -1652,13 +1656,13 @@ def sweep_along_path( ) return self - @pyaedt_function_handler() - def sweep_around_axis(self, cs_axis, sweep_angle=360, draft_angle=0): + @pyaedt_function_handler(cs_axis="axis") + def sweep_around_axis(self, axis, sweep_angle=360, draft_angle=0): """Sweep around an axis. Parameters ---------- - cs_axis : :class:`pyaedt.generic.constants.AXIS` + axis : :class:`pyaedt.generic.constants.AXIS` Coordinate system of the axis. sweep_angle : float, optional Sweep angle in degrees. The default is ``360``. @@ -1676,7 +1680,7 @@ def sweep_around_axis(self, cs_axis, sweep_angle=360, draft_angle=0): >>> oEditor.SweepAroundAxis """ - self._primitives.sweep_around_axis(self, cs_axis, sweep_angle, draft_angle) + self._primitives.sweep_around_axis(self, axis, sweep_angle, draft_angle) return self @pyaedt_function_handler() diff --git a/pyaedt/modeler/cad/polylines.py b/pyaedt/modeler/cad/polylines.py index ac22aa2b203..3df25284627 100644 --- a/pyaedt/modeler/cad/polylines.py +++ b/pyaedt/modeler/cad/polylines.py @@ -476,7 +476,7 @@ def vertex_positions(self): >>> oEditor.GetVertexPosition """ - id_list = self._primitives.get_object_vertices(partID=self.id) + id_list = self._primitives.get_object_vertices(assignment=self.id) position_list = [self._primitives.get_vertex_position(id) for id in id_list] return position_list @@ -723,19 +723,8 @@ def _add_new_polyline(self): new_polyline._id = None return self._primitives._create_object(new_name) - @pyaedt_function_handler() - def remove_vertex(self, position, abstol=1e-9): - """Remove a vertex from an existing polyline by position. - - .. deprecated:: 0.6.55 - Use :func:``remove_point`` method instead. - - """ - warnings.warn("`remove_vertex` is deprecated. Use `remove_point` method instead.", DeprecationWarning) - return self.remove_point(position, abstol) - - @pyaedt_function_handler() - def remove_point(self, position, abstol=1e-9): + @pyaedt_function_handler(abstol="tolerance") + def remove_point(self, position, tolerance=1e-9): """Remove a point from an existing polyline by position. You must enter the exact position of the vertex as a list @@ -745,7 +734,7 @@ def remove_point(self, position, abstol=1e-9): ---------- position : list List of ``[x, y, z]`` coordinates specifying the vertex to remove. - abstol : float, optional + tolerance : float, optional Absolute tolerance of the comparison of a specified position to the vertex positions. The default is ``1e-9``. @@ -775,7 +764,7 @@ def remove_point(self, position, abstol=1e-9): tolerance when searching for the vertex to be removed. >>> P = modeler.create_polyline([[0, 1, 2], [0, 2, 3], [2, 1, 4]]) - >>> P.remove_point(["0mm", "1mm", "2mm"], abstol=1e-6) + >>> P.remove_point(["0mm", "1mm", "2mm"],tolerance=1e-6) """ found_vertex = False seg_id = None @@ -784,7 +773,7 @@ def remove_point(self, position, abstol=1e-9): for ind, point_pos in enumerate(self.points): # compare the specified point with the vertex data using an absolute tolerance # (default of math.isclose is 1e-9 which should be ok in almost all cases) - found_vertex = GeometryOperators.points_distance(point_pos, pos_xyz) <= abstol + found_vertex = GeometryOperators.points_distance(point_pos, pos_xyz) <= tolerance if found_vertex: if ind == len(self.points) - 1: at_start = False @@ -818,8 +807,8 @@ def remove_point(self, position, abstol=1e-9): return True - @pyaedt_function_handler() - def remove_edges(self, edge_id): + @pyaedt_function_handler(edge_id="assignment") + def remove_edges(self, assignment): """Remove a segment from an existing polyline by segment id. .. deprecated:: 0.6.55 @@ -827,17 +816,17 @@ def remove_edges(self, edge_id): """ warnings.warn("`remove_edges` is deprecated. Use `remove_segments` method instead.", DeprecationWarning) - return self.remove_segments(segment_id=edge_id) + return self.remove_segments(assignment=assignment) - @pyaedt_function_handler() - def remove_segments(self, segment_id): + @pyaedt_function_handler(segment_id="assignment") + def remove_segments(self, assignment): """Remove a segment from an existing polyline by segment id. You must enter the segment id or the list of the segment ids you want to remove. Parameters ---------- - segment_id : int or List of int + assignment : int or List of int One or more edge IDs within the total number of edges of the polyline. Returns @@ -853,12 +842,12 @@ def remove_segments(self, segment_id): Examples -------- >>> P = modeler.create_polyline([[0, 1, 2], [0, 2, 3], [2, 1, 4]]) - >>> P.remove_segments(segment_id=0) + >>> P.remove_segments(assignment=0) """ - if isinstance(segment_id, int): - segment_id = [segment_id] - elif isinstance(segment_id, list): - segment_id.sort() + if isinstance(assignment, int): + assignment = [assignment] + elif isinstance(assignment, list): + assignment.sort() else: raise TypeError("segment_id must be int or list of int.") try: @@ -868,16 +857,16 @@ def remove_segments(self, segment_id): "Selections:=", self.name + ":CreatePolyline:1", "Segment Indices:=", - segment_id, + assignment, "At Start:=", True, ] ) except Exception: # pragma: no cover - raise ValueError("Invalid segment ID {} is specified on polyline {}.".format(segment_id, self.name)) + raise ValueError("Invalid segment ID {} is specified on polyline {}.".format(assignment, self.name)) else: - segment_id.reverse() - for sid in segment_id: + assignment.reverse() + for sid in assignment: if sid == len(self._segment_types) - 1: # removing the last segment, AEDT removes ALWAYS the last polyline point at_start = False @@ -1055,13 +1044,13 @@ def _get_segment_id_from_point_n(self, pn, at_start, allow_inner_points=False): return i return False - @pyaedt_function_handler() - def insert_segment(self, position_list, segment=None): + @pyaedt_function_handler(position_list="points") + def insert_segment(self, points, segment=None): """Add a segment to an existing polyline. Parameters ---------- - position_list : List + points : List List of positions of the points that define the segment to insert. Either the starting point or ending point of the segment list must match one of the vertices of the existing polyline. @@ -1083,7 +1072,7 @@ def insert_segment(self, position_list, segment=None): """ # Check for a valid number of points - num_points = len(position_list) + num_points = len(points) # define the segment type from the number of points given if not segment: @@ -1102,20 +1091,20 @@ def insert_segment(self, position_list, segment=None): elif isinstance(segment, PolylineSegment): num_points = segment.num_points if segment.type == "AngularArc": - self._evaluate_arc_angle_extra_points(segment, start_point=position_list[0]) + self._evaluate_arc_angle_extra_points(segment, start_point=points[0]) else: raise TypeError('segment must be either "Line", "Arc" or PolylineSegment object.') - if segment.type != "AngularArc" and len(position_list) < num_points: + if segment.type != "AngularArc" and len(points) < num_points: raise ValueError("position_list must contain enough points for the specified segment type.") - elif segment.type == "AngularArc" and len(position_list) < 1: + elif segment.type == "AngularArc" and len(points) < 1: raise ValueError("position_list must contain the start point for AngularArc segment.") # Check whether start-point and end-point of the segment is in the existing polylines points - start_point = position_list[0] + start_point = points[0] # End point does not exist for an AngularArc if segment.type != "AngularArc": - end_point = position_list[-1] + end_point = points[-1] else: end_point = [] @@ -1133,14 +1122,14 @@ def insert_segment(self, position_list, segment=None): ): at_start = True p_insert_position = i - insert_points = position_list[: num_points - 1] # All points but last one. + insert_points = points[: num_points - 1] # All points but last one. if i == num_polyline_points - 1: if segment.type != "Line": # Inserting a segment in this position is not allowed in AEDT. # We can make it work only for "Line" segments. return False at_start = False - position_list = [self.points[-2], start_point] + points = [self.points[-2], start_point] break elif ( GeometryOperators.points_distance( @@ -1152,7 +1141,7 @@ def insert_segment(self, position_list, segment=None): at_start = False p_insert_position = i + 1 if segment.type != "AngularArc": - insert_points = position_list[1:num_points] # Insert all points but first one + insert_points = points[1:num_points] # Insert all points but first one else: insert_points = segment.extra_points[:] # For AngularArc insert the extra points if i == 0: @@ -1161,7 +1150,7 @@ def insert_segment(self, position_list, segment=None): # PyAEDT can make it work only for "Line" segments. return False at_start = True - position_list = [end_point, self.points[1]] + points = [end_point, self.points[1]] break assert p_insert_position is not None, "Point for the insert is not found." @@ -1193,7 +1182,7 @@ def insert_segment(self, position_list, segment=None): varg2 = ["NAME:PolylinePoints"] if segment.type == "Line" or segment.type == "Spline" or segment.type == "Arc": - for pt in position_list[0:num_points]: + for pt in points[0:num_points]: varg2.append(self._pl_point(pt)) varg1.append(varg2) elif segment.type == "AngularArc": diff --git a/pyaedt/modeler/circuits/PrimitivesCircuit.py b/pyaedt/modeler/circuits/PrimitivesCircuit.py index df733a3ee39..d04b70df0e3 100644 --- a/pyaedt/modeler/circuits/PrimitivesCircuit.py +++ b/pyaedt/modeler/circuits/PrimitivesCircuit.py @@ -1,7 +1,6 @@ import math import os import random -import warnings from pyaedt.application.Variables import decompose_variable_value from pyaedt.generic.LoadAEDTFile import load_keyword_in_aedt_file @@ -348,13 +347,13 @@ def create_gnd(self, location=None, angle=0): if name in self.components[el].composed_name: return self.components[el] - @pyaedt_function_handler() - def create_model_from_touchstone(self, touchstone_full_path, model_name=None, show_bitmap=True): + @pyaedt_function_handler(touchstone_full_path="input_file") + def create_model_from_touchstone(self, input_file, model_name=None, show_bitmap=True): """Create a model from a Touchstone file. Parameters ---------- - touchstone_full_path : str + input_file : str Full path to the Touchstone file. model_name : str, optional Name of the model. The default is ``None``. @@ -403,15 +402,15 @@ def _parse_ports_name(file, num_terminal): return portnames if not model_name: - model_name = os.path.splitext(os.path.basename(touchstone_full_path))[0] + model_name = os.path.splitext(os.path.basename(input_file))[0] if model_name in list(self.o_model_manager.GetNames()): model_name = generate_unique_name(model_name, n=2) - num_terminal = int(os.path.splitext(touchstone_full_path)[1].lower().strip(".sp")) + num_terminal = int(os.path.splitext(input_file)[1].lower().strip(".sp")) # with open_file(touchstone_full_path, "r") as f: # port_names = _parse_ports_name(f, num_terminal) port_names = [] - with open_file(touchstone_full_path, "r") as f: + with open_file(input_file, "r") as f: for line in f: line = line.strip() if line.startswith(("!", "#", "")): @@ -450,7 +449,7 @@ def _parse_ports_name(file, num_terminal): ["NAME:PortInfoBlk"], ["NAME:PortOrderBlk"], "filename:=", - touchstone_full_path, + input_file, "numberofports:=", num_terminal, "sssfilename:=", @@ -689,10 +688,10 @@ def create_touchstone_component( self.add_id_to_component(id) return self.components[id] - @pyaedt_function_handler() + @pyaedt_function_handler(inst_name="name") def create_component( self, - inst_name=None, + name=None, component_library="Resistors", component_name="RES_", location=None, @@ -704,7 +703,7 @@ def create_component( Parameters ---------- - inst_name : str, optional + name : str, optional Name of the instance. The default is ``None.`` component_library : str, optional Name of the component library. The default is ``"Resistors"``. @@ -736,16 +735,16 @@ def create_component( >>> from pyaedt import TwinBuilder >>> aedtapp = TwinBuilder() - >>> cmp = aedtapp.modeler.schematic.create_component(component_library="", component_name="ExcitationComponent") - >>> cmp.set_property("ShowPin", True) + >>> cmp = aedtapp.modeler.schematic.create_component(component_library="",component_name="ExcitationComponent") + >>> cmp.set_property("ShowPin",True) >>> aedtapp.release_desktop(True, True) """ id = self.create_unique_id() if component_library: - name = self.design_libray + "\\" + component_library + ":" + component_name + inst_name = self.design_libray + "\\" + component_library + ":" + component_name else: - name = component_name - arg1 = ["NAME:ComponentProps", "Name:=", name, "Id:=", str(id)] + inst_name = component_name + arg1 = ["NAME:ComponentProps", "Name:=", inst_name, "Id:=", str(id)] xpos, ypos = self._get_location(location) angle = math.pi * angle / 180 arg2 = ["NAME:Attributes", "Page:=", 1, "X:=", xpos, "Y:=", ypos, "Angle:=", angle, "Flip:=", False] @@ -753,21 +752,21 @@ def create_component( id = int(id.split(";")[1]) # self.refresh_all_ids() self.add_id_to_component(id) - if inst_name: - self.components[id].set_property("InstanceName", inst_name) + if name: + self.components[id].set_property("InstanceName", name) if use_instance_id_netlist: self.enable_use_instance_name(component_library, component_name) elif global_netlist_list: self.enable_global_netlist(component_name, global_netlist_list) return self.components[id] - @pyaedt_function_handler() - def disable_data_netlist(self, component_name): + @pyaedt_function_handler(component_name="assignment") + def disable_data_netlist(self, assignment): """Disable the Nexxim global net list. Parameters ---------- - component_name : str + assignment : str Name of the component. Returns @@ -781,7 +780,7 @@ def disable_data_netlist(self, component_name): >>> oComponentManager.GetData >>> oComponentManager.Edit """ - name = component_name + name = assignment properties = self.o_component_manager.GetData(name) if len(properties) > 0: @@ -792,17 +791,17 @@ def disable_data_netlist(self, component_name): nexxim_data[1] = "" nexxim[nexxim.index(el) + 1] = nexxim_data self.o_component_manager.Edit( - name, ["Name:" + component_name, ["NAME:CosimDefinitions", nexxim, "DefaultCosim:=", "DefaultNetlist"]] + name, ["Name:" + assignment, ["NAME:CosimDefinitions", nexxim, "DefaultCosim:=", "DefaultNetlist"]] ) return True - @pyaedt_function_handler() - def enable_global_netlist(self, component_name, global_netlist_list=None): + @pyaedt_function_handler(component_name="assignment") + def enable_global_netlist(self, assignment, global_netlist_list=None): """Enable Nexxim global net list. Parameters ---------- - component_name : str + assignment : str Name of the component. global_netlist_list : list A list of lines to include. The default is ``None``. @@ -821,7 +820,7 @@ def enable_global_netlist(self, component_name, global_netlist_list=None): if global_netlist_list is None: global_netlist_list = [] - name = component_name + name = assignment properties = self.o_component_manager.GetData(name) if len(properties) > 0: @@ -833,19 +832,19 @@ def enable_global_netlist(self, component_name, global_netlist_list=None): nexxim[nexxim.index(el) + 1] = nexxim_data self.o_component_manager.Edit( name, - ["Name:" + component_name, ["NAME:CosimDefinitions", nexxim, "DefaultCosim:=", "DefaultNetlist"]], + ["Name:" + assignment, ["NAME:CosimDefinitions", nexxim, "DefaultCosim:=", "DefaultNetlist"]], ) return True - @pyaedt_function_handler() - def create_symbol(self, symbol_name, pin_lists): + @pyaedt_function_handler(symbol_name="name", pin_lists="pins") + def create_symbol(self, name, pins): """Create a symbol. Parameters ---------- - symbol_name : str + name : str Name of the symbol. - pin_lists : list + pins : list List of the pins. Returns @@ -858,7 +857,7 @@ def create_symbol(self, symbol_name, pin_lists): >>> oSymbolManager.Add """ - numpins = len(pin_lists) + numpins = len(pins) h = int(numpins / 2) x1 = 0 y2 = 0 @@ -868,7 +867,7 @@ def create_symbol(self, symbol_name, pin_lists): yp = 0.00254 * (h + 2) angle = 0 arg = [ - "NAME:" + symbol_name, + "NAME:" + name, "ModTime:=", 1591858230, "Library:=", @@ -891,7 +890,7 @@ def create_symbol(self, symbol_name, pin_lists): i = 1 id += 2 r = numpins - (h * 2) - for pin in pin_lists: + for pin in pins: arg.append( [ "NAME:PinDef", @@ -914,7 +913,7 @@ def create_symbol(self, symbol_name, pin_lists): ["NAME:1", "Rect:=", [0, 0, 0, 0, (x1 + x2) / 2, (y1 + y2) / 2, x2 - x1, y1 - y2, 0, 0, 8192]], ] ) - self.o_symbol_manager.EditWithComps(symbol_name, arg, []) + self.o_symbol_manager.EditWithComps(name, arg, []) return True @pyaedt_function_handler() @@ -1025,13 +1024,13 @@ def add_id_to_component(self, id): return len(self.components) - @pyaedt_function_handler() - def get_obj_id(self, objname): + @pyaedt_function_handler(objname="assignment") + def get_obj_id(self, assignment): """Retrieve the ID of an object. Parameters ---------- - objname : str + assignment : str Name of the object. Returns @@ -1041,17 +1040,17 @@ def get_obj_id(self, objname): """ for el in self.components: - if self.components[el].name == objname: + if self.components[el].name == assignment: return el return None - @pyaedt_function_handler() - def get_pins(self, partid): + @pyaedt_function_handler(partid="assignment") + def get_pins(self, assignment): """Retrieve one or more pins. Parameters ---------- - partid : int or str + assignment : int or str One or more IDs or names for the pins to retrieve. Returns @@ -1064,25 +1063,25 @@ def get_pins(self, partid): >>> oEditor.GetComponentPins """ - if isinstance(partid, CircuitComponent): - pins = self.oeditor.GetComponentPins(partid.composed_name) - elif isinstance(partid, str): - pins = self.oeditor.GetComponentPins(partid) + if isinstance(assignment, CircuitComponent): + pins = self.oeditor.GetComponentPins(assignment.composed_name) + elif isinstance(assignment, str): + pins = self.oeditor.GetComponentPins(assignment) # pins = self.oeditor.GetComponentPins(partid) else: - pins = self.oeditor.GetComponentPins(self.components[partid].composed_name) + pins = self.oeditor.GetComponentPins(self.components[assignment].composed_name) # pins = self.oeditor.GetComponentPins(self.components[partid].composed_name) return list(pins) - @pyaedt_function_handler() - def get_pin_location(self, partid, pinname): + @pyaedt_function_handler(partid="assignment", pinname="pin") + def get_pin_location(self, assignment, pin): """Retrieve the location of a pin. Parameters ---------- - partid : int + assignment : int ID of the part. - pinname : + pin : Name of the pin. Returns @@ -1096,36 +1095,14 @@ def get_pin_location(self, partid, pinname): >>> oEditor.GetComponentPinLocation """ - if isinstance(partid, str): - x = self.oeditor.GetComponentPinLocation(partid, pinname, True) - y = self.oeditor.GetComponentPinLocation(partid, pinname, False) + if isinstance(assignment, str): + x = self.oeditor.GetComponentPinLocation(assignment, pin, True) + y = self.oeditor.GetComponentPinLocation(assignment, pin, False) else: - x = self.oeditor.GetComponentPinLocation(self.components[partid].composed_name, pinname, True) - y = self.oeditor.GetComponentPinLocation(self.components[partid].composed_name, pinname, False) + x = self.oeditor.GetComponentPinLocation(self.components[assignment].composed_name, pin, True) + y = self.oeditor.GetComponentPinLocation(self.components[assignment].composed_name, pin, False) return self._convert_point_to_units([x, y]) - @pyaedt_function_handler() - def arg_with_dim(self, Value, sUnits=None): - """Format an argument with dimensions. - - .. deprecated:: 0.6.56 - Use :func:`number_with_units` instead. - - Parameters - ---------- - Value : str - Value of the quantity. - sUnits : - The default is ``None``. - - Returns - ------- - type - - """ - warnings.warn("Use :func:`number_with_units` instead.", DeprecationWarning) - return self._app.number_with_units(Value, sUnits) - @pyaedt_function_handler() def number_with_units(self, value, units=None): """Convert a number to a string with units. If value is a string, it's returned as is. @@ -1145,18 +1122,18 @@ def number_with_units(self, value, units=None): """ return self._app.number_with_units(value, units) - @pyaedt_function_handler() - def create_line(self, points_array, color=0, line_width=0): + @pyaedt_function_handler(points_array="points", line_width="width") + def create_line(self, points, color=0, width=0): """Draw a graphical line. Parameters ---------- - points_array : list + points : list A nested list of point coordinates. For example, ``[[x1, y1], [x2, y2], ...]``. color : string or 3 item list, optional Color or the line. The default is ``"0"``. - line_width : float, optional + width : float, optional Width of the line. The default is ``0``. Returns @@ -1166,23 +1143,23 @@ def create_line(self, points_array, color=0, line_width=0): >>> oEditor.CreateLine """ - points = [str(tuple(self._convert_point_to_meter(i))) for i in points_array] + points = [str(tuple(self._convert_point_to_meter(i))) for i in points] id = self.create_unique_id() return self.oeditor.CreateLine( - ["NAME:LineData", "Points:=", points, "LineWidth:=", line_width, "Color:=", color, "Id:=", id], + ["NAME:LineData", "Points:=", points, "LineWidth:=", width, "Color:=", color, "Id:=", id], ["NAME:Attributes", "Page:=", 1], ) - @pyaedt_function_handler() - def create_wire(self, points_array, wire_name=""): + @pyaedt_function_handler(points_array="points", wire_name="name") + def create_wire(self, points, name=""): """Create a wire. Parameters ---------- - points_array : list + points : list A nested list of point coordinates. For example, ``[[x1, y1], [x2, y2], ...]``. - wire_name : str, optional + name : str, optional Name of the wire. Default value is ``""``. Returns @@ -1195,9 +1172,9 @@ def create_wire(self, points_array, wire_name=""): >>> oEditor.CreateWire """ - points = [str(tuple(self._convert_point_to_meter(i))) for i in points_array] + points = [str(tuple(self._convert_point_to_meter(i))) for i in points] wire_id = self.create_unique_id() - arg1 = ["NAME:WireData", "Name:=", wire_name, "Id:=", wire_id, "Points:=", points] + arg1 = ["NAME:WireData", "Name:=", name, "Id:=", wire_id, "Points:=", points] arg2 = ["NAME:Attributes", "Page:=", 1] try: wire_id = self.oeditor.CreateWire(arg1, arg2) @@ -1211,9 +1188,9 @@ def create_wire(self, points_array, wire_name=""): wire_id = int(wire_id.split(";")[1].split(":")[0]) else: wire_id = int(wire_id.split(";")[1]) - if not wire_name: - wire_name = generate_unique_name("Wire") - w.name = wire_name + if not name: + name = generate_unique_name("Wire") + w.name = name w.id = int(wire_id) self.wires[w.id] = w return w @@ -1238,13 +1215,13 @@ def props(self): self._props = load_keyword_in_aedt_file(self.file_name, self.name) return self._props - @pyaedt_function_handler() - def place(self, inst_name, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(inst_name="assignment") + def place(self, assignment, location=None, angle=0, use_instance_id_netlist=False): """Create a component from a library. Parameters ---------- - inst_name : str, optional + assignment : str, optional Name of the instance. The default is ``None.`` location : list of float, optional Position on the X axis and Y axis. @@ -1267,7 +1244,7 @@ def place(self, inst_name, location=None, angle=0, use_instance_id_netlist=False if location is None: location = [] return self._component_manager.create_component( - inst_name=inst_name, + name=assignment, component_library=self.component_library, component_name=self.name, location=location, diff --git a/pyaedt/modeler/circuits/PrimitivesMaxwellCircuit.py b/pyaedt/modeler/circuits/PrimitivesMaxwellCircuit.py index 866cff70164..2d2928fccff 100644 --- a/pyaedt/modeler/circuits/PrimitivesMaxwellCircuit.py +++ b/pyaedt/modeler/circuits/PrimitivesMaxwellCircuit.py @@ -55,13 +55,13 @@ def __init__(self, modeler): self._modeler = modeler self._currentId = 0 - @pyaedt_function_handler() - def create_resistor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_resistor(self, name=None, value=50, location=None, angle=0, use_instance_id_netlist=False): """Create a resistor. Parameters ---------- - compname : str, optional + name : str, optional Name of the resistor. The default is ``None``. value : float, optional Value for the resistor. The default is ``50``. @@ -86,7 +86,7 @@ def create_resistor(self, compname=None, value=50, location=None, angle=0, use_i location = [] id = self.create_component( - compname, + name, component_library="Passive Elements", component_name="Res", location=location, @@ -95,16 +95,16 @@ def create_resistor(self, compname=None, value=50, location=None, angle=0, use_i ) id.set_property("R", value) - id.set_property("Name", compname) + id.set_property("Name", name) return id - @pyaedt_function_handler() - def create_inductor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_inductor(self, name=None, value=50, location=None, angle=0, use_instance_id_netlist=False): """Create an inductor. Parameters ---------- - compname : str, optional + name : str, optional Name of the inductor. The default is ``None``. value : float, optional Value for the inductor. The default is ``50``. @@ -129,7 +129,7 @@ def create_inductor(self, compname=None, value=50, location=None, angle=0, use_i location = [] id = self.create_component( - compname, + name, component_library="Passive Elements", component_name="Ind", location=location, @@ -138,16 +138,16 @@ def create_inductor(self, compname=None, value=50, location=None, angle=0, use_i ) id.set_property("L", value) - id.set_property("Name", compname) + id.set_property("Name", name) return id - @pyaedt_function_handler() - def create_capacitor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_capacitor(self, name=None, value=50, location=None, angle=0, use_instance_id_netlist=False): """Create a capacitor. Parameters ---------- - compname : str, optional + name : str, optional Name of the capacitor. The default is ``None``. value : float, optional Value for the capacitor. The default is ``50``. @@ -171,7 +171,7 @@ def create_capacitor(self, compname=None, value=50, location=None, angle=0, use_ if location is None: location = [] id = self.create_component( - compname, + name, component_library="Passive Elements", component_name="Cap", location=location, @@ -180,16 +180,16 @@ def create_capacitor(self, compname=None, value=50, location=None, angle=0, use_ ) id.set_property("C", value) - id.set_property("Name", compname) + id.set_property("Name", name) return id - @pyaedt_function_handler() - def create_diode(self, compname=None, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_diode(self, name=None, location=None, angle=0, use_instance_id_netlist=False): """Create a diode. Parameters ---------- - compname : str, optional + name : str, optional Name of the diode. The default is ``None``. location : list of float, optional Position on the X axis and Y axis. The default is ``None``. @@ -212,7 +212,7 @@ def create_diode(self, compname=None, location=None, angle=0, use_instance_id_ne location = [] id = self.create_component( - compname, + name, component_library="Passive Elements", component_name="DIODE", location=location, @@ -220,16 +220,16 @@ def create_diode(self, compname=None, location=None, angle=0, use_instance_id_ne use_instance_id_netlist=use_instance_id_netlist, ) - id.set_property("Name", compname) + id.set_property("Name", name) return id - @pyaedt_function_handler() - def create_winding(self, compname=None, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_winding(self, name=None, location=None, angle=0, use_instance_id_netlist=False): """Create an NPN transistor. Parameters ---------- - compname : str, optional + name : str, optional Name of the NPN transistor. The default is ``None``. location : list of float, optional Position on the X axis and Y axis. @@ -251,12 +251,12 @@ def create_winding(self, compname=None, location=None, angle=0, use_instance_id_ if location is None: location = [] id = self.create_component( - compname, + name, component_library="Dedicated Elements", component_name="Winding", location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist, ) - id.set_property("Name", compname) + id.set_property("Name", name) return id diff --git a/pyaedt/modeler/circuits/PrimitivesNexxim.py b/pyaedt/modeler/circuits/PrimitivesNexxim.py index 262fe58b639..ea080cff015 100644 --- a/pyaedt/modeler/circuits/PrimitivesNexxim.py +++ b/pyaedt/modeler/circuits/PrimitivesNexxim.py @@ -196,8 +196,8 @@ def create_subcircuit(self, location=None, angle=None, name=None, nested_subcirc return self.components[el] return False - @pyaedt_function_handler() - def duplicate(self, component, location=None, angle=0, flip=False): # pragma: no cover + @pyaedt_function_handler(component="assignment") + def duplicate(self, assignment, location=None, angle=0, flip=False): # pragma: no cover """Add a new subcircuit to the design. .. note:: @@ -205,7 +205,7 @@ def duplicate(self, component, location=None, angle=0, flip=False): # pragma: n Parameters ---------- - component : class:`pyaedt.modeler.Object3d.CircuitComponent` Circuit Component Object + assignment : class:`pyaedt.modeler.Object3d.CircuitComponent` Circuit Component Object Component to duplicate. location : list of float, optional Position on the X axis and Y axis. @@ -220,10 +220,10 @@ def duplicate(self, component, location=None, angle=0, flip=False): # pragma: n when successful or ``False`` when failed. """ comp_names = [] - if isinstance(component, CircuitComponent): - comp_names.append(component.composed_name) + if isinstance(assignment, CircuitComponent): + comp_names.append(assignment.composed_name) else: - comp_names.append(component) + comp_names.append(assignment) self._modeler.oeditor.Copy(["NAME:Selections", "Selections:=", comp_names]) location = self._get_location(location) self._modeler.oeditor.Paste( @@ -236,13 +236,13 @@ def duplicate(self, component, location=None, angle=0, flip=False): # pragma: n return self.components[new_ids[0]] return False - @pyaedt_function_handler() - def connect_components_in_series(self, components_to_connect, use_wire=True): + @pyaedt_function_handler(components_to_connect="assignment") + def connect_components_in_series(self, assignment, use_wire=True): """Connect schematic components in series. Parameters ---------- - components_to_connect : list of :class:`pyaedt.modeler.cad.object3dcircuit.CircuitComponent` + assignment : list of :class:`pyaedt.modeler.cad.object3dcircuit.CircuitComponent` List of Components to connect. It can be a list of objects or component names. use_wire : bool, optional Whether to use wires or a page port to connect the pins. @@ -259,12 +259,12 @@ def connect_components_in_series(self, components_to_connect, use_wire=True): >>> from pyaedt import Circuit >>> circuit = Circuit() >>> circuit.modeler.schematic_units = "mil" - >>> myind = circuit.modeler.schematic.create_inductor(compname="L100", value=1e-9, location=[0,0]) - >>> myres = circuit.modeler.schematic.create_resistor(compname="R100", value=50, location=[100, 2000]) + >>> myind = circuit.modeler.schematic.create_inductor(value=1e-9,location=[0,0]) + >>> myres = circuit.modeler.schematic.create_resistor(value=50,location=[100, 2000]) >>> circuit.modeler.schematic.connect_components_in_series([myind, myres]) """ comps = [] - for component in components_to_connect: + for component in assignment: if isinstance(component, (CircuitComponent, Excitations)): comps.append(component) else: @@ -279,13 +279,13 @@ def connect_components_in_series(self, components_to_connect, use_wire=True): i += 1 return True - @pyaedt_function_handler() - def connect_components_in_parallel(self, components_to_connect): + @pyaedt_function_handler(components_to_connect="assignment") + def connect_components_in_parallel(self, assignment): """Connect schematic components in parallel. Parameters ---------- - components_to_connect : list of :class:`pyaedt.modeler.cad.object3dcircuit.CircuitComponent` + assignment : list of :class:`pyaedt.modeler.cad.object3dcircuit.CircuitComponent` List of Components to connect. It can be a list of objects or component names. Returns @@ -297,12 +297,12 @@ def connect_components_in_parallel(self, components_to_connect): -------- >>> from pyaedt import Circuit >>> circuit = Circuit() - >>> myind = circuit.modeler.schematic.create_inductor("L100", 1e-9) - >>> myres = circuit.modeler.schematic.create_resistor("R100", 50) + >>> myind = circuit.modeler.schematic.create_inductor("L100",1e-9) + >>> myres = circuit.modeler.schematic.create_resistor("R100",50) >>> circuit.modeler.schematic.connect_components_in_parallel([myind, myres.composed_name]) """ comps = [] - for component in components_to_connect: + for component in assignment: if isinstance(component, CircuitComponent): comps.append(component) else: @@ -317,13 +317,13 @@ def connect_components_in_parallel(self, components_to_connect): terminal_to_connect[0].pins[1].connect_to_component([i.pins[1] for i in terminal_to_connect[1:]]) return True - @pyaedt_function_handler() - def add_subcircuit_3dlayout(self, sourcename): + @pyaedt_function_handler(sourcename="name") + def add_subcircuit_3dlayout(self, name): """Add a subcircuit from a HFSS 3DLayout. Parameters ---------- - sourcename : str + name : str Name of the source design. Returns @@ -337,14 +337,14 @@ def add_subcircuit_3dlayout(self, sourcename): >>> oProject.CopyDesign >>> oEditor.PasteDesign """ - self._app._oproject.CopyDesign(sourcename) + self._app._oproject.CopyDesign(name) self.oeditor.PasteDesign( 0, ["NAME:Attributes", "Page:=", 1, "X:=", 0, "Y:=", 0, "Angle:=", 0, "Flip:=", False], ) self.refresh_all_ids() for el in self.components: - if sourcename in self.components[el].composed_name: + if name in self.components[el].composed_name: return self.components[el] return False @@ -600,13 +600,13 @@ def create_field_model(self, design_name, solution_name, pin_names, model_type=" return el, self.components[el].composed_name return False - @pyaedt_function_handler() - def create_resistor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_resistor(self, name=None, value=50, location=None, angle=0, use_instance_id_netlist=False): """Create a resistor. Parameters ---------- - compname : str, optional + name : str, optional Name of the resistor. The default is ``None``. value : float, optional Resistance in ohms. The default is ``50``. @@ -631,19 +631,19 @@ def create_resistor(self, compname=None, value=50, location=None, angle=0, use_i if location is None: location = [] cmpid = self.create_component( - compname, location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist + name, location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist ) cmpid.set_property("R", value) return cmpid - @pyaedt_function_handler() - def create_inductor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_inductor(self, name=None, value=50, location=None, angle=0, use_instance_id_netlist=False): """Create an inductor. Parameters ---------- - compname : str, optional + name : str, optional Name of the inductor. The default is ``None``. value : float, optional Inductance value. The default is ``50``. @@ -668,7 +668,7 @@ def create_inductor(self, compname=None, value=50, location=None, angle=0, use_i if location is None: location = [] cmpid = self.create_component( - compname, + name, component_library="Inductors", component_name="IND_", location=location, @@ -680,13 +680,13 @@ def create_inductor(self, compname=None, value=50, location=None, angle=0, use_i return cmpid - @pyaedt_function_handler() - def create_capacitor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_capacitor(self, cname=None, value=50, location=None, angle=0, use_instance_id_netlist=False): """Create a capacitor. Parameters ---------- - compname : str, optional + cname : str, optional Name of the capacitor. The default is ``None``. value : float, optional Capacitor value. The default is ``50``. @@ -713,7 +713,7 @@ def create_capacitor(self, compname=None, value=50, location=None, angle=0, use_ location = [] cmpid = self.create_component( - compname, + cname, component_library="Capacitors", component_name="CAP_", location=location, @@ -724,13 +724,13 @@ def create_capacitor(self, compname=None, value=50, location=None, angle=0, use_ cmpid.set_property("C", value) return cmpid - @pyaedt_function_handler() - def create_voltage_dc(self, compname=None, value=1, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_voltage_dc(self, name=None, value=1, location=None, angle=0, use_instance_id_netlist=False): """Create a voltage DC source. Parameters ---------- - compname : str, optional + name : str, optional Name of the voltage DC source. The default is ``None``. value : float, optional Voltage value. The default is ``50``. @@ -756,7 +756,7 @@ def create_voltage_dc(self, compname=None, value=1, location=None, angle=0, use_ location = [] cmpid = self.create_component( - compname, + name, component_library="Independent Sources", component_name="V_DC", location=location, @@ -767,13 +767,13 @@ def create_voltage_dc(self, compname=None, value=1, location=None, angle=0, use_ cmpid.set_property("DC", value) return cmpid - @pyaedt_function_handler() - def create_voltage_probe(self, probe_name=None, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(probe_name="name") + def create_voltage_probe(self, name=None, location=None, angle=0, use_instance_id_netlist=False): """Create a voltage probe. Parameters ---------- - probe_name : + name : Name of the voltage probe. The default is ``None``. location : list of float, optional Position on the X axis and Y axis. The default is ``None``. @@ -807,18 +807,16 @@ def create_voltage_probe(self, probe_name=None, location=None, angle=0, use_inst use_instance_id_netlist=use_instance_id_netlist, ) - cmpid.set_property("Name", probe_name) + cmpid.set_property("Name", name) return cmpid - @pyaedt_function_handler() - def create_current_pulse( - self, compname=None, value_lists=None, location=None, angle=0, use_instance_id_netlist=False - ): + @pyaedt_function_handler(compname="name") + def create_current_pulse(self, name=None, value_lists=None, location=None, angle=0, use_instance_id_netlist=False): """Create a current pulse. Parameters ---------- - compname : str, optional + name : str, optional Name of the current pulse. The default is ``None``. value_lists : list, optional List of values for the current pulse. The default is ``[]``. @@ -845,7 +843,7 @@ def create_current_pulse( if location is None: location = [] cmpid = self.create_component( - compname, + name, component_library="Independent Sources", component_name="I_PULSE", location=location, @@ -870,15 +868,13 @@ def create_current_pulse( return cmpid - @pyaedt_function_handler() - def create_voltage_pulse( - self, compname=None, value_lists=None, location=None, angle=0, use_instance_id_netlist=False - ): + @pyaedt_function_handler(compname="name") + def create_voltage_pulse(self, name=None, value_lists=None, location=None, angle=0, use_instance_id_netlist=False): """Create a voltage pulse. Parameters ---------- - compname : str, optional + name : str, optional Name of the voltage pulse. The default is ``None``. value_lists : list, optional List of values for the voltage pulse. The default is ``[]``. @@ -905,7 +901,7 @@ def create_voltage_pulse( if location is None: location = [] cmpid = self.create_component( - compname, + name, component_library="Independent Sources", component_name="V_PULSE", location=location, @@ -930,15 +926,15 @@ def create_voltage_pulse( return cmpid - @pyaedt_function_handler() + @pyaedt_function_handler(compname="name") def create_voltage_pwl( - self, compname=None, time_list=None, voltage_list=None, location=None, angle=0, use_instance_id_netlist=False + self, name=None, time_list=None, voltage_list=None, location=None, angle=0, use_instance_id_netlist=False ): """Create a pwl voltage source. Parameters ---------- - compname : str, optional + name : str, optional Name of the voltage pulse. The default is ``None``. time_list : list, optional List of time points for the pwl voltage source. The default is ``[0]``. @@ -965,7 +961,7 @@ def create_voltage_pwl( location = [] cmpid = self.create_component( - compname, + name, component_library="Independent Sources", component_name="V_PWL", location=location, @@ -980,18 +976,18 @@ def create_voltage_pwl( return False else: for nr, pair in enumerate(zip(time_list, voltage_list)): - cmpid.set_property(property_name="time" + str(nr + 1), property_value=pair[0]) - cmpid.set_property(property_name="val" + str(nr + 1), property_value=pair[1]) + cmpid.set_property(name="time" + str(nr + 1), value=pair[0]) + cmpid.set_property(name="val" + str(nr + 1), value=pair[1]) return cmpid - @pyaedt_function_handler() - def create_current_dc(self, compname=None, value=1, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_current_dc(self, name=None, value=1, location=None, angle=0, use_instance_id_netlist=False): """Create a current DC source. Parameters ---------- - compname : str, optional + name : str, optional Name of the current DC source. The default is ``None``. value : float, optional Current value. The default is ``1``. @@ -1016,7 +1012,7 @@ def create_current_dc(self, compname=None, value=1, location=None, angle=0, use_ if location is None: location = [] cmpid = self.create_component( - compname, + name, component_library="Independent Sources", component_name="I_DC", location=location, @@ -1077,13 +1073,13 @@ def create_coupling_inductors( cmpid.set_property("CouplingFactor", value) return cmpid - @pyaedt_function_handler() - def create_diode(self, compname=None, model_name="required", location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_diode(self, name=None, model_name="required", location=None, angle=0, use_instance_id_netlist=False): """Create a diode. Parameters ---------- - compname : str + name : str Name of the diode. The default is ``None``. model_name : str, optional Name of the model. The default is ``"required"``. @@ -1108,7 +1104,7 @@ def create_diode(self, compname=None, model_name="required", location=None, angl if location is None: location = [] cmpid = self.create_component( - compname, + name, component_library="Diodes", component_name="DIODE_Level1", location=location, @@ -1119,13 +1115,13 @@ def create_diode(self, compname=None, model_name="required", location=None, angl cmpid.set_property("MOD", model_name) return cmpid - @pyaedt_function_handler() - def create_npn(self, compname=None, value=None, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_npn(self, name=None, value=None, location=None, angle=0, use_instance_id_netlist=False): """Create an NPN transistor. Parameters ---------- - compname : str + name : str Name of the NPN transistor. The default is ``None``. value : float, optional Value for the NPN transistor. The default is ``None``. @@ -1150,7 +1146,7 @@ def create_npn(self, compname=None, value=None, location=None, angle=0, use_inst if location is None: location = [] id = self.create_component( - compname, + name, component_library="BJTs", component_name="Level01_NPN", location=location, @@ -1161,13 +1157,13 @@ def create_npn(self, compname=None, value=None, location=None, angle=0, use_inst id.set_property("MOD", value) return id - @pyaedt_function_handler() - def create_pnp(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_pnp(self, name=None, value=50, location=None, angle=0, use_instance_id_netlist=False): """Create a PNP transistor. Parameters ---------- - compname : str + name : str Name of the PNP transistor. The default is ``None``. value : float, optional Value for the PNP transistor. The default is ``None``. @@ -1192,7 +1188,7 @@ def create_pnp(self, compname=None, value=50, location=None, angle=0, use_instan if location is None: location = [] id = self.create_component( - compname, + name, component_library="BJTs", component_name="Level01_PNP", location=location, @@ -1204,25 +1200,27 @@ def create_pnp(self, compname=None, value=50, location=None, angle=0, use_instan return id - @pyaedt_function_handler() + @pyaedt_function_handler( + symbol_name="name", pin_lists="pins", parameter_list="parameters", parameter_value="values" + ) def create_new_component_from_symbol( self, - symbol_name, - pin_lists, + name, + pins, time_stamp=1591858313, description="", refbase="x", - parameter_list=[], - parameter_value=[], + parameters=[], + values=[], gref="", ): """Create a component from a symbol. Parameters ---------- - symbol_name : str + name : str Name of the symbol. - pin_lists : list + pins : list List of pin names. time_stamp : int, optional UTC time stamp. @@ -1230,9 +1228,9 @@ def create_new_component_from_symbol( Component description. refbase : str, optional Reference base. The default is ``"U"``. - parameter_list : list + parameters : list List of parameters. The default is ``[]``. - parameter_value : list + values : list List of parameter values. The default is ``[]``. gref : str, optional Global Reference @@ -1249,13 +1247,13 @@ def create_new_component_from_symbol( >>> oComponentManager.Add """ arg = [ - "NAME:" + symbol_name, + "NAME:" + name, "Info:=", [ "Type:=", 0, "NumTerminals:=", - len(pin_lists), + len(pins), "DataSource:=", "", "ModifiedOn:=", @@ -1263,7 +1261,7 @@ def create_new_component_from_symbol( "Manufacturer:=", "", "Symbol:=", - symbol_name, + name, "ModelNames:=", "", "Footprint:=", @@ -1307,14 +1305,14 @@ def create_new_component_from_symbol( True, ] - for pin in pin_lists: + for pin in pins: arg.append("Terminal:=") arg.append([pin, pin, "A", False, 0, 1, "", "Electrical", "0"]) arg.append("CompExtID:=") arg.append(1) arg2 = ["NAME:Parameters"] - for el, val in zip(parameter_list, parameter_value): + for el, val in zip(parameters, values): if "MOD" in el: arg2.append("TextValueProp:=") arg2.append([el, "D", "", val]) @@ -1330,11 +1328,11 @@ def create_new_component_from_symbol( arg.append(arg2) spicesintax = refbase + "@ID " id = 0 - while id < len(pin_lists): + while id < len(pins): spicesintax += "%" + str(id) + " " id += 1 - spicesintax += symbol_name + " " - for el, val in zip(parameter_list, parameter_value): + spicesintax += name + " " + for el, val in zip(parameters, values): if "MOD" in el: spicesintax += "@{} ".format(el) else: @@ -1365,15 +1363,16 @@ def create_new_component_from_symbol( self.o_component_manager.Add(arg) return True - @pyaedt_function_handler() - def get_comp_custom_settings( - self, toolNum, dc=0, interp=0, extrap=1, conv=0, passivity=0, reciprocal="False", opt="", data_type=1 + @pyaedt_function_handler(toolNum="tool_index") + def _get_comp_custom_settings( + self, tool_index, dc=0, interp=0, extrap=1, conv=0, passivity=0, reciprocal="False", opt="", data_type=1 ): """Retrieve custom settings for a resistor. Parameters ---------- - toolNum : + tool_index : int + Tool index. dc : The default is ``0``. @@ -1398,9 +1397,9 @@ def get_comp_custom_settings( List of the custom settings for the resistor. """ - if toolNum == 1: + if tool_index == 1: custom = "NAME:DesignerCustomization" - elif toolNum == 2: + elif tool_index == 2: custom = "NAME:NexximCustomization" else: custom = "NAME:HSpiceCustomization" @@ -1427,7 +1426,7 @@ def get_comp_custom_settings( return res - @pyaedt_function_handler() + @pyaedt_function_handler(comp_name="name") def add_subcircuit_dynamic_link( self, pyaedt_app=None, @@ -1436,7 +1435,7 @@ def add_subcircuit_dynamic_link( enable_cable_modeling=True, default_matrix="Original", tline_port="", - comp_name=None, + name=None, ): """Add a subcircuit from `HFSS`, `Q3d` or `2D Extractor` in circuit design. @@ -1454,7 +1453,7 @@ def add_subcircuit_dynamic_link( Matrix to link to the subcircuit. Default to `"Original"`. It only applies to 2D Extractor and Q3D. tline_port : str, optional Port to be used for tramsission line. Only applies to Hfss. - comp_name : str, optional + name : str, optional Component name. Returns @@ -1470,8 +1469,8 @@ def add_subcircuit_dynamic_link( >>> oDesign.AddCompInstance >>> oDesign.AddDynamicLink """ - if not comp_name: - comp_name = generate_unique_name(pyaedt_app.design_name) + if not name: + name = generate_unique_name(pyaedt_app.design_name) source_project_path = pyaedt_app.project_file source_design_name = pyaedt_app.design_name if not solution_name: @@ -1479,7 +1478,7 @@ def add_subcircuit_dynamic_link( self._app.odesign.AddDynamicLink( source_design_name, source_project_path, - comp_name, + name, solution_name, tline_port, default_matrix, @@ -1488,7 +1487,7 @@ def add_subcircuit_dynamic_link( ) self.refresh_all_ids() for el in self.components: - if comp_name in self.components[el].composed_name: + if name in self.components[el].composed_name: if extrusion_length: _, units = decompose_variable_value(self.components[el].parameters["Length"]) self.components[el].set_property("Length", self.number_with_units(extrusion_length, units)) @@ -1571,9 +1570,9 @@ def _add_subcircuit_link( model = "siwave" owner = "Siwave" icon_file = "" - designer_customization = self.get_comp_custom_settings(1, 0, 0, 1, 0, 0, "False", "", 1) - nexxim_customization = self.get_comp_custom_settings(2, 3, 1, 3, 0, 0, "False", "", 2) - hspice_customization = self.get_comp_custom_settings(3, 1, 2, 3, 0, 0, "False", "", 3) + designer_customization = self._get_comp_custom_settings(1, 0, 0, 1, 0, 0, "False", "", 1) + nexxim_customization = self._get_comp_custom_settings(2, 3, 1, 3, 0, 0, "False", "", 2) + hspice_customization = self._get_comp_custom_settings(3, 1, 2, 3, 0, 0, "False", "", 3) if image_subcircuit_path: _, file_extension = os.path.splitext(image_subcircuit_path) @@ -1878,13 +1877,13 @@ def _edit_link_definition_hfss_subcircuit(self, component, edited_prop): self._app._oproject.ChangeProperty(arg) return True - @pyaedt_function_handler() - def refresh_dynamic_link(self, component_name): + @pyaedt_function_handler(component_name="name") + def refresh_dynamic_link(self, name): """Refresh a dynamic link component. Parameters ---------- - component_name : str + name : str Name of the dynamic link component. Returns @@ -1897,10 +1896,10 @@ def refresh_dynamic_link(self, component_name): >>> oComponentManager.UpdateDynamicLink """ - if "@" in component_name: - component_name = component_name.split("@")[1] - component_name = component_name.split(";")[0] - self.o_component_manager.UpdateDynamicLink(component_name) + if "@" in name: + name = name.split("@")[1] + name = name.split(";")[0] + self.o_component_manager.UpdateDynamicLink(name) return True @pyaedt_function_handler() @@ -1913,23 +1912,23 @@ def _parse_spice_model(self, model_path): models.append(pinNames[1]) return models - @pyaedt_function_handler() + @pyaedt_function_handler(model_path="input_file", model_name="model", symbol_name="symbol") def create_component_from_spicemodel( self, - model_path, - model_name=None, + input_file, + model=None, create_component=True, location=None, symbol_path="Nexxim Circuit Elements\\Nexxim_symbols:", - symbol_name="", + symbol="", ): """Create and place a new component based on a spice .lib file. Parameters ---------- - model_path : str + input_file : str Path to .lib file. - model_name : str, optional + model : str, optional Model name to import. If `None` the first subckt in the lib file will be placed. create_component : bool, optional If set to ``True``, create a spice model component. Otherwise, only import the spice model. @@ -1938,7 +1937,7 @@ def create_component_from_spicemodel( symbol_path : str, optional Path to the symbol library. Default value is ``"Nexxim Circuit Elements\\Nexxim_symbols:"``. - symbol_name : str, optional + symbol : str, optional Symbol name to replace the spice model with. Default value is an empty string which means the default symbol for spice is used. @@ -1952,49 +1951,42 @@ def create_component_from_spicemodel( >>> from pyaedt import Circuit >>> cir = Circuit(specified_version="2023.2") >>> model = os.path.join("Your path", "test.lib") - >>> cir.modeler.schematic.create_component_from_spicemodel(model_path=model, - >>> model_name="GRM1234", - >>> symbol_name="nexx_cap") + >>> cir.modeler.schematic.create_component_from_spicemodel(input_file=model,model="GRM1234",symbol="nexx_cap") >>> cir.release_desktop(False, False) """ - models = self._parse_spice_model(model_path) - if not model_name and models: - model_name = models[0] - elif model_name not in models: + models = self._parse_spice_model(input_file) + if not model and models: + model = models[0] + elif model not in models: return False arg = ["NAME:Options", "Mode:=", 2, "Overwrite:=", False, "SupportsSimModels:=", False, "LoadOnly:=", False] arg2 = ["NAME:Models"] for el in models: arg2.append(el + ":=") - if el == model_name: - if symbol_path and symbol_name: - arg2.append([True, symbol_path + symbol_name, "", False]) + if el == model: + if symbol_path and symbol: + arg2.append([True, symbol_path + symbol, "", False]) else: arg2.append([True, "", "", False]) else: arg2.append([False, "", "", False]) arg.append(arg2) - self.o_component_manager.ImportModelsFromFile(model_path.replace("\\", "/"), arg) + self.o_component_manager.ImportModelsFromFile(input_file.replace("\\", "/"), arg) if create_component: - return self.create_component( - None, - component_library=None, - component_name=model_name, - location=location, - ) + return self.create_component(None, component_library=None, component_name=model, location=location) else: return True - @pyaedt_function_handler() - def add_siwave_dynamic_link(self, model_path, solution_name=None, simulate_solutions=False): + @pyaedt_function_handler(model_path="input_file", solution_name="solution") + def add_siwave_dynamic_link(self, input_file, solution=None, simulate_solutions=False): """Add a siwave dinamyc link object. Parameters ---------- - model_path : str + input_file : str Full path to the .siw file. - solution_name : str, optional + solution : str, optional Solution name. simulate_solutions : bool, optional Either if simulate or interpolate existing solutions. @@ -2004,18 +1996,18 @@ def add_siwave_dynamic_link(self, model_path, solution_name=None, simulate_solut :class:`pyaedt.modeler.cad.object3dcircuit.CircuitComponent` Circuit Component Object. """ - assert os.path.exists(model_path), "Project file doesn't exist" - comp_name = os.path.splitext(os.path.basename(model_path))[0] - results_path = model_path + "averesults" - solution = os.path.join(results_path, comp_name + ".asol") + assert os.path.exists(input_file), "Project file doesn't exist" + comp_name = os.path.splitext(os.path.basename(input_file))[0] + results_path = input_file + "averesults" + solution_path = os.path.join(results_path, comp_name + ".asol") # out = load_entire_aedt_file(solution) - out = load_keyword_in_aedt_file(solution, "Solutions") - if not solution_name: - solution_name = list(out["Solutions"]["SYZSolutions"].keys())[0] + out = load_keyword_in_aedt_file(solution_path, "Solutions") + if not solution: + solution = list(out["Solutions"]["SYZSolutions"].keys())[0] results_folder = os.path.join( results_path, - out["Solutions"]["SYZSolutions"][solution_name]["DiskName"], - out["Solutions"]["SYZSolutions"][solution_name]["DiskName"] + ".syzinfo", + out["Solutions"]["SYZSolutions"][solution]["DiskName"], + out["Solutions"]["SYZSolutions"][solution]["DiskName"] + ".syzinfo", ) pin_names = [] @@ -2029,9 +2021,9 @@ def add_siwave_dynamic_link(self, model_path, solution_name=None, simulate_solut return self._add_subcircuit_link( comp_name, pin_names, - model_path, + input_file, comp_name, - solution_name=solution_name, + solution_name=solution, model_type="siwave", simulate_solutions=simulate_solutions, ) diff --git a/pyaedt/modeler/circuits/PrimitivesTwinBuilder.py b/pyaedt/modeler/circuits/PrimitivesTwinBuilder.py index 1f84e0abbef..1a76aa0b9f8 100644 --- a/pyaedt/modeler/circuits/PrimitivesTwinBuilder.py +++ b/pyaedt/modeler/circuits/PrimitivesTwinBuilder.py @@ -79,13 +79,13 @@ def components_catalog(self): self._components_catalog = ComponentCatalog(self) return self._components_catalog - @pyaedt_function_handler() - def create_resistor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_resistor(self, name=None, value=50, location=None, angle=0, use_instance_id_netlist=False): """Create a resistor. Parameters ---------- - compname : str, optional + name : str, optional Name of the resistor. The default value is ``None``. value : float, optional Value for the resistor. The default value is ``50``. @@ -110,7 +110,7 @@ def create_resistor(self, compname=None, value=50, location=None, angle=0, use_i location = [] id = self.create_component( - compname, + name, component_library="Basic Elements\\Circuit\\Passive Elements", component_name="R", location=location, @@ -122,13 +122,13 @@ def create_resistor(self, compname=None, value=50, location=None, angle=0, use_i return id - @pyaedt_function_handler() - def create_inductor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_inductor(self, name=None, value=50, location=None, angle=0, use_instance_id_netlist=False): """Create an inductor. Parameters ---------- - compname : str, optional + name : str, optional Name of the inductor. The default is ``None``. value : float, optional Value for the inductor. The default is ``50``. @@ -153,7 +153,7 @@ def create_inductor(self, compname=None, value=50, location=None, angle=0, use_i location = [] id = self.create_component( - compname, + name, component_library="Basic Elements\\Circuit\\Passive Elements", component_name="L", location=location, @@ -164,13 +164,13 @@ def create_inductor(self, compname=None, value=50, location=None, angle=0, use_i id.set_property("L", value) return id - @pyaedt_function_handler() - def create_capacitor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_capacitor(self, name=None, value=50, location=None, angle=0, use_instance_id_netlist=False): """Create a capacitor. Parameters ---------- - compname : str, optional + name : str, optional Name of the capacitor. The default value is ``None``. value : float, optional Value for the capacitor. The default value is ``50``. @@ -195,7 +195,7 @@ def create_capacitor(self, compname=None, value=50, location=None, angle=0, use_ location = [] id = self.create_component( - compname, + name, component_library="Basic Elements\\Circuit\\Passive Elements", component_name="C", location=location, @@ -207,15 +207,15 @@ def create_capacitor(self, compname=None, value=50, location=None, angle=0, use_ id.set_property("UseInitialConditions", True) return id - @pyaedt_function_handler() + @pyaedt_function_handler(compname="name") def create_voltage_source( - self, compname=None, type="E", amplitude=326, freq=50, location=None, angle=0, use_instance_id_netlist=False + self, name=None, type="E", amplitude=326, freq=50, location=None, angle=0, use_instance_id_netlist=False ): """Create a voltage source (conservative electrical output). Parameters ---------- - compname : str, optional + name : str, optional Name of the voltage source. The default is ``None``. type : str, optional Type of the source. The default is ``E``. @@ -244,7 +244,7 @@ def create_voltage_source( location = [] id = self.create_component( - compname, + name, component_library="Basic Elements\\Circuit\\Sources", component_name="E", location=location, @@ -264,13 +264,13 @@ def create_voltage_source( return id - @pyaedt_function_handler() - def create_diode(self, compname=None, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_diode(self, name=None, location=None, angle=0, use_instance_id_netlist=False): """Create a diode. Parameters ---------- - compname : str, optional + name : str, optional Name of the diode. The default is ``None``. location : list of float, optional Position on the X axis and Y axis. The default value is ``None``. @@ -293,7 +293,7 @@ def create_diode(self, compname=None, location=None, angle=0, use_instance_id_ne location = [] id = self.create_component( - compname, + name, component_library="Basic Elements\\Circuit\\Semiconductors System Level", component_name="D", location=location, @@ -302,13 +302,13 @@ def create_diode(self, compname=None, location=None, angle=0, use_instance_id_ne ) return id - @pyaedt_function_handler() - def create_npn(self, compname=None, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_npn(self, name=None, location=None, angle=0, use_instance_id_netlist=False): """Create an NPN transistor. Parameters ---------- - compname : str, optional + name : str, optional Name of the NPN transistor. The default value is ``None``. location : list of float, optional Position on the X axis and Y axis. The default value is ``None``. @@ -331,7 +331,7 @@ def create_npn(self, compname=None, location=None, angle=0, use_instance_id_netl location = [] id = self.create_component( - compname, + name, component_library="Basic Elements\\Circuit\\Semiconductors System Level", component_name="BJT", location=location, @@ -340,13 +340,13 @@ def create_npn(self, compname=None, location=None, angle=0, use_instance_id_netl ) return id - @pyaedt_function_handler() - def create_pnp(self, compname=None, location=None, angle=0, use_instance_id_netlist=False): + @pyaedt_function_handler(compname="name") + def create_pnp(self, name=None, location=None, angle=0, use_instance_id_netlist=False): """Create a PNP transistor. Parameters ---------- - compname : str, optional + name : str, optional Name of the PNP transistor. The default is ``None``. location : list of float, optional Position on the X axis and Y axis. The default value is ``None``. @@ -369,7 +369,7 @@ def create_pnp(self, compname=None, location=None, angle=0, use_instance_id_netl location = [] id = self.create_component( - compname, + name, component_library="Basic Elements\\Circuit\\Semiconductors System Level", component_name="BJT", location=location, @@ -379,10 +379,10 @@ def create_pnp(self, compname=None, location=None, angle=0, use_instance_id_netl return id - @pyaedt_function_handler() + @pyaedt_function_handler(compname="name") def create_periodic_waveform_source( self, - compname=None, + name=None, type="SINE", amplitude=100, freq=50, @@ -398,7 +398,7 @@ def create_periodic_waveform_source( Parameters ---------- - compname : str, optional + name : str, optional Name of the voltage source. The default is ``None``. type : str, optional Type of the source [SINE, PULSE, TRAING, SAWTOOTH]. The default is ``SINE``. @@ -433,7 +433,7 @@ def create_periodic_waveform_source( location = [] id = self.create_component( - compname, + name, component_library="Basic Elements\\Tools\\Time Functions", component_name=type, location=location, diff --git a/pyaedt/modeler/circuits/object3dcircuit.py b/pyaedt/modeler/circuits/object3dcircuit.py index 035ef031c7d..e8b932e882f 100644 --- a/pyaedt/modeler/circuits/object3dcircuit.py +++ b/pyaedt/modeler/circuits/object3dcircuit.py @@ -131,15 +131,15 @@ def _get_deltas(self, point, move_x=True, move_y=True, positive=True, units=1): deltay = point[1] return deltax, deltay - @pyaedt_function_handler() + @pyaedt_function_handler(component_pin="assignment") def connect_to_component( - self, component_pin, page_name=None, use_wire=False, wire_name="", clearance_units=1, page_port_angle=None + self, assignment, page_name=None, use_wire=False, wire_name="", clearance_units=1, page_port_angle=None ): """Connect schematic components. Parameters ---------- - component_pin : :class:`pyaedt.modeler.circuits.PrimitivesNexxim.CircuitPins` + assignment : :class:`pyaedt.modeler.circuits.PrimitivesNexxim.CircuitPins` Component pin to attach. page_name : str, optional Page port name. The default value is ``None``, in which case @@ -167,14 +167,14 @@ def connect_to_component( >>> oPadstackManager.CreatePagePort """ tol = 1e-8 - if not isinstance(component_pin, list): - component_pin = [component_pin] + if not isinstance(assignment, list): + assignment = [assignment] if use_wire: direction = (180 + self.angle + self._circuit_comp.angle) * math.pi / 180 points = [self.location] cangles = [self._circuit_comp.angle] negative = 0.0 >= direction >= (math.pi) - for cpin in component_pin: + for cpin in assignment: prev = [i for i in points[-1]] act = [i for i in cpin.location] pins_x = [i.location[0] for i in self._circuit_comp.pins if i.name != self.name] @@ -248,7 +248,7 @@ def connect_to_component( points.append(act) cangles.append(cpin._circuit_comp.angle) - self._circuit_comp._circuit_components.create_wire(points, wire_name=wire_name) + self._circuit_comp._circuit_components.create_wire(points, name=wire_name) return True comp_angle = self._circuit_comp.angle * math.pi / 180 if len(self._circuit_comp.pins) == 2: @@ -264,7 +264,7 @@ def connect_to_component( except Exception: pass else: - for cmp in component_pin: + for cmp in assignment: if "Port" in cmp._circuit_comp.composed_name: try: page_name = cmp._circuit_comp.name.split("@")[1].replace(";", "_") @@ -284,7 +284,7 @@ def connect_to_component( else: angle = math.pi + comp_angle ret1 = self._circuit_comp._circuit_components.create_page_port(page_name, self.location, angle=angle) - for cmp in component_pin: + for cmp in assignment: try: x_loc = AEDT_UNITS["Length"][decompose_variable_value(cmp._circuit_comp.location[0])[1]] * float( decompose_variable_value(cmp._circuit_comp.location[0])[0] @@ -715,13 +715,13 @@ def mirror(self, mirror_value=True): vMaterial = ["NAME:Component Mirror", "Value:=", mirror_value] self.change_property(vMaterial) - @pyaedt_function_handler() - def set_use_symbol_color(self, symbol_color=None): + @pyaedt_function_handler(symbol_color="color") + def set_use_symbol_color(self, color=None): """Set symbol color usage. Parameters ---------- - symbol_color : bool, optional + color : bool, optional The default is ``None``. Returns @@ -734,23 +734,23 @@ def set_use_symbol_color(self, symbol_color=None): >>> oEditor.ChangeProperty """ - if not symbol_color: - symbol_color = self.usesymbolcolor - vMaterial = ["NAME:Use Symbol Color", "Value:=", symbol_color] + if not color: + color = self.usesymbolcolor + vMaterial = ["NAME:Use Symbol Color", "Value:=", color] self.change_property(vMaterial) return True - @pyaedt_function_handler() - def set_color(self, R=255, G=128, B=0): + @pyaedt_function_handler(R="red", G="green", B="blue") + def set_color(self, red=255, green=128, blue=0): """Set symbol color. Parameters ---------- - R : int, optional + red : int, optional Red color value. The default is ``255``. - G : int, optional + green : int, optional Green color value. The default is ``128``. - B : int, optional + blue : int, optional Blue color value. The default is ``0`` Returns @@ -763,19 +763,19 @@ def set_color(self, R=255, G=128, B=0): >>> oEditor.ChangeProperty """ - vMaterial = ["NAME:Component Color", "R:=", R, "G:=", G, "B:=", B] + vMaterial = ["NAME:Component Color", "R:=", red, "G:=", green, "B:=", blue] self.change_property(vMaterial) return True - @pyaedt_function_handler() - def set_property(self, property_name, property_value): + @pyaedt_function_handler(property_name="name", property_value="value") + def set_property(self, name, value): """Set a part property. Parameters ---------- - property_name : str + name : str Name of the property. - property_value : + value : Value for the property. Returns @@ -788,8 +788,8 @@ def set_property(self, property_name, property_value): >>> oEditor.ChangeProperty """ - if isinstance(property_name, list): - for p, v in zip(property_name, property_value): + if isinstance(name, list): + for p, v in zip(name, value): v_prop = ["NAME:" + p, "Value:=", v] self.change_property(v_prop) if self.__dict__.get("_parameters", None) and p in self.__dict__["_parameters"]: @@ -797,16 +797,14 @@ def set_property(self, property_name, property_value): else: self.__dict__[p] = v else: - v_prop = ["NAME:" + property_name, "Value:=", property_value] + v_prop = ["NAME:" + name, "Value:=", value] self.change_property(v_prop) - if self.__dict__.get("_parameters", None) and property_name in self.__dict__["_parameters"]: - self.__dict__["_parameters"][property_name] = property_value - elif self.__dict__.get("_component_info", None) and property_name in self.__dict__.get( - "_component_info", None - ): - self.__dict__["_component_info"][property_name] = property_value + if self.__dict__.get("_parameters", None) and name in self.__dict__["_parameters"]: + self.__dict__["_parameters"][name] = value + elif self.__dict__.get("_component_info", None) and name in self.__dict__.get("_component_info", None): + self.__dict__["_component_info"][name] = value else: - self.__dict__[property_name] = property_value + self.__dict__[name] = value return True @pyaedt_function_handler() @@ -830,15 +828,15 @@ def _add_property(self, property_name, property_value): self.__dict__[property_name] = property_value return True - @pyaedt_function_handler() - def change_property(self, vPropChange, names_list=None): + @pyaedt_function_handler(vPropChange="property", names_list="names") + def change_property(self, property_name, names=None): """Modify a property. Parameters ---------- - vPropChange : - - names_list : list, optional + property_name : list + Property value in AEDT syntax. + names : list, optional The default is ``None``. Returns @@ -851,19 +849,19 @@ def change_property(self, vPropChange, names_list=None): >>> oEditor.GetPropertyValue >>> oEditor.ChangeProperty """ - vChangedProps = ["NAME:ChangedProps", vPropChange] - if names_list: + vChangedProps = ["NAME:ChangedProps", property_name] + if names: vPropServers = ["NAME:PropServers"] - for el in names_list: + for el in names: vPropServers.append(el) else: vPropServers = ["NAME:PropServers", self.composed_name] tabname = None - if vPropChange[0][5:] in self._oeditor.GetProperties(self.tabname, self.composed_name): + if property_name[0][5:] in self._oeditor.GetProperties(self.tabname, self.composed_name): tabname = self.tabname - elif vPropChange[0][5:] in self._oeditor.GetProperties("PassedParameterTab", self.composed_name): + elif property_name[0][5:] in self._oeditor.GetProperties("PassedParameterTab", self.composed_name): tabname = "PassedParameterTab" - elif vPropChange[0][5:] in self._oeditor.GetProperties("BaseElementTab", self.composed_name): + elif property_name[0][5:] in self._oeditor.GetProperties("BaseElementTab", self.composed_name): tabname = "BaseElementTab" if tabname: vGeo3dlayout = ["NAME:" + tabname, vPropServers, vChangedProps] @@ -902,14 +900,14 @@ def wires(self): wire_names.append(wire) return wire_names - @pyaedt_function_handler() - def display_wire_properties(self, wire_name="", property_to_display="NetName", visibility="Name", location="Top"): + @pyaedt_function_handler(wire_name="name") + def display_wire_properties(self, name="", property_to_display="NetName", visibility="Name", location="Top"): """ Display wire properties. Parameters ---------- - wire_name : str, optional + name : str, optional Wire name to display. Default value is ``""``. property_to_display : str, optional @@ -932,7 +930,7 @@ def display_wire_properties(self, wire_name="", property_to_display="NetName", v try: wire_exists = False for wire in self.wires: - if wire_name == wire.split("@")[1].split(";")[0]: + if name == wire.split("@")[1].split(";")[0]: wire_id = wire.split("@")[1].split(";")[1].split(":")[0] wire_exists = True break @@ -946,7 +944,7 @@ def display_wire_properties(self, wire_name="", property_to_display="NetName", v "NAME:AllTabs", [ "NAME:PropDisplayPropTab", - ["NAME:PropServers", "Wire@{};{};{}".format(wire_name, wire_id, 1)], + ["NAME:PropServers", "Wire@{};{};{}".format(name, wire_id, 1)], [ "NAME:NewProps", ["NAME:" + property_to_display, "Format:=", visibility, "Location:=", location], diff --git a/pyaedt/modeler/modeler2d.py b/pyaedt/modeler/modeler2d.py index cf5f0d47848..7698682ad46 100644 --- a/pyaedt/modeler/modeler2d.py +++ b/pyaedt/modeler/modeler2d.py @@ -73,13 +73,13 @@ def primitives(self): warn(mess, DeprecationWarning) return self._primitives - @pyaedt_function_handler() - def calculate_radius_2D(self, object_name, inner=False): + @pyaedt_function_handler(object_name="assignment") + def calculate_radius_2D(self, assignment, inner=False): """Calculate the extremity of an object in the radial direction. Parameters ---------- - object_name : str + assignment : str name of the object from which to calculate the radius. inner : bool, optional The default is ``False``. @@ -95,7 +95,7 @@ def calculate_radius_2D(self, object_name, inner=False): """ radius = 0 - oVertexIDs = self[object_name].vertices + oVertexIDs = self[assignment].vertices if oVertexIDs: if inner: radius = 0 @@ -111,8 +111,8 @@ def calculate_radius_2D(self, object_name, inner=False): else: if vertex_radius < radius: radius = vertex_radius - elif self[object_name].edges: - radius = self[object_name].edges[0].length / (2 * math.pi) + elif self[assignment].edges: + radius = self[assignment].edges[0].length / (2 * math.pi) return radius @@ -133,7 +133,7 @@ def radial_split_2D(self, radius, name): ``True`` when successful, ``False`` when failed. """ - cir = self.create_circle([0, 0, 0], 3, name=name + "_split", matname="vacuum") + cir = self.create_circle([0, 0, 0], 3, name=name + "_split", material="vacuum") self.oeditor.Copy(["NAME:Selections", "Selections:=", name]) objects = [i for i in self.object_names] self.oeditor.Paste() diff --git a/pyaedt/modeler/modeler3d.py b/pyaedt/modeler/modeler3d.py index 1d6579b23d9..590a94e0420 100644 --- a/pyaedt/modeler/modeler3d.py +++ b/pyaedt/modeler/modeler3d.py @@ -1095,38 +1095,34 @@ def import_nastran(self, file_path, import_lines=True, lines_thickness=0, import points = [nas_to_dict["Points"][id] for id in solid[1:]] if solid[0] == "CPENTA": element1 = self._app.modeler.create_polyline( - position_list=[points[0], points[1], points[2]], close_surface=True, cover_surface=True + points=[points[0], points[1], points[2]], cover_surface=True, close_surface=True ) element2 = self._app.modeler.create_polyline( - position_list=[points[3], points[4], points[5]], close_surface=True, cover_surface=True + points=[points[3], points[4], points[5]], cover_surface=True, close_surface=True ) self._app.modeler.connect([element1.name, element2.name]) element1.group_name = "PID_" + str(solid_pid) elif solid[0] == "CHEXA": element1 = self._app.modeler.create_polyline( - position_list=[points[0], points[1], points[2], points[3]], - close_surface=True, - cover_surface=True, + points=[points[0], points[1], points[2], points[3]], cover_surface=True, close_surface=True ) element2 = self._app.modeler.create_polyline( - position_list=[points[4], points[5], points[6], points[7]], - close_surface=True, - cover_surface=True, + points=[points[4], points[5], points[6], points[7]], cover_surface=True, close_surface=True ) self._app.modeler.connect([element1.name, element2.name]) element1.group_name = "PID_" + str(solid_pid) elif solid[0] == "CTETRA": element1 = self._app.modeler.create_polyline( - position_list=[points[0], points[1], points[2]], close_surface=True, cover_surface=True + points=[points[0], points[1], points[2]], cover_surface=True, close_surface=True ) element2 = self._app.modeler.create_polyline( - position_list=[points[0], points[1], points[3]], close_surface=True, cover_surface=True + points=[points[0], points[1], points[3]], cover_surface=True, close_surface=True ) element3 = self._app.modeler.create_polyline( - position_list=[points[0], points[2], points[3]], close_surface=True, cover_surface=True + points=[points[0], points[2], points[3]], cover_surface=True, close_surface=True ) element4 = self._app.modeler.create_polyline( - position_list=[points[1], points[2], points[3]], close_surface=True, cover_surface=True + points=[points[1], points[2], points[3]], cover_surface=True, close_surface=True ) self._app.modeler.unite([element1.name, element2.name, element3.name, element4.name]) element1.group_name = "PID_" + str(solid_pid) diff --git a/pyaedt/modeler/modelerpcb.py b/pyaedt/modeler/modelerpcb.py index 71b571e7b88..413cdc7856f 100644 --- a/pyaedt/modeler/modelerpcb.py +++ b/pyaedt/modeler/modelerpcb.py @@ -190,8 +190,8 @@ def primitives(self): warn(mess, DeprecationWarning) return self._primitives - @pyaedt_function_handler - def obounding_box(self, object_name): + @pyaedt_function_handler(object_name="assignment") + def obounding_box(self, assignment): """Bounding box of a specified object. Returns @@ -204,7 +204,7 @@ def obounding_box(self, object_name): >>> oEditor.GetBBox """ - bb = self.oeditor.GetBBox(object_name) + bb = self.oeditor.GetBBox(assignment) pll = bb.BBoxLL() pur = bb.BBoxUR() return [pll.GetX(), pll.GetY(), pur.GetX(), pur.GetY()] @@ -236,21 +236,23 @@ def _pos_with_arg(self, pos, units=None): return xpos, ypos, zpos - @pyaedt_function_handler() - def change_property(self, property_object, property_name, property_value, property_tab="BaseElementTab"): + @pyaedt_function_handler( + property_object="assignment", property_name="name", property_value="value", property_tab="aedt_tab" + ) + def change_property(self, assignment, name, value, aedt_tab="BaseElementTab"): """Change an oeditor property. Parameters ---------- - property_object : str + assignment : str Name of the property object. It can be the name of an excitation or field reporter. For example, ``Excitations:Port1`` or ``FieldsReporter:Mag_H``. - property_name : str + name : str Name of the property. For example, ``Rotation Angle``. - property_value : str, list + value : str, list Value of the property. It is a string for a single value and a list of three elements for ``[x,y,z]`` coordianates. - property_tab : str + aedt_tab : str Name of the tab to update. Options are ``BaseElementTab``, ``EM Design``, and ``FieldsPostProcessorTab``. The default is ``BaseElementTab``. @@ -264,71 +266,71 @@ def change_property(self, property_object, property_name, property_value, proper >>> oEditor.ChangeProperty """ - if isinstance(property_value, list) and len(property_value) == 3: - xpos, ypos, zpos = self._pos_with_arg(property_value) + if isinstance(value, list) and len(value) == 3: + xpos, ypos, zpos = self._pos_with_arg(value) self.oeditor.ChangeProperty( [ "NAME:AllTabs", [ - "NAME:" + property_tab, - ["NAME:PropServers", property_object], - ["NAME:ChangedProps", ["NAME:" + property_name, "X:=", xpos, "Y:=", ypos, "Z:=", zpos]], + "NAME:" + aedt_tab, + ["NAME:PropServers", assignment], + ["NAME:ChangedProps", ["NAME:" + name, "X:=", xpos, "Y:=", ypos, "Z:=", zpos]], ], ] ) - elif isinstance(property_value, bool): + elif isinstance(value, bool): self.oeditor.ChangeProperty( [ "NAME:AllTabs", [ - "NAME:" + property_tab, - ["NAME:PropServers", property_object], - ["NAME:ChangedProps", ["NAME:" + property_name, "Value:=", property_value]], + "NAME:" + aedt_tab, + ["NAME:PropServers", assignment], + ["NAME:ChangedProps", ["NAME:" + name, "Value:=", value]], ], ] ) - elif isinstance(property_value, (float, int)): - xpos = self._arg_with_dim(property_value, self.model_units) + elif isinstance(value, (float, int)): + xpos = self._arg_with_dim(value, self.model_units) self.oeditor.ChangeProperty( [ "NAME:AllTabs", [ - "NAME:" + property_tab, - ["NAME:PropServers", property_object], - ["NAME:ChangedProps", ["NAME:" + property_name, "Value:=", xpos]], + "NAME:" + aedt_tab, + ["NAME:PropServers", assignment], + ["NAME:ChangedProps", ["NAME:" + name, "Value:=", xpos]], ], ] ) - elif isinstance(property_value, str): + elif isinstance(value, str): self.oeditor.ChangeProperty( [ "NAME:AllTabs", [ - "NAME:" + property_tab, - ["NAME:PropServers", property_object], - ["NAME:ChangedProps", ["NAME:" + property_name, "Value:=", property_value]], + "NAME:" + aedt_tab, + ["NAME:PropServers", assignment], + ["NAME:ChangedProps", ["NAME:" + name, "Value:=", value]], ], ] ) else: self.logger.error("Wrong Property Value") return False - self.logger.info("Property {} Changed correctly.".format(property_name)) + self.logger.info("Property {} Changed correctly.".format(name)) return True - @pyaedt_function_handler() - def merge_design(self, merged_design=None, pos_x="0.0", pos_y="0.0", pos_z="0.0", rotation="0.0"): + @pyaedt_function_handler(pos_x="x", pos_y="y", pos_z="z") + def merge_design(self, merged_design=None, x="0.0", y="0.0", z="0.0", rotation="0.0"): """Merge a design into another. Parameters ---------- merged_design : :class:`pyaedt.hfss3dlayout.Hfss3dLayout` Design to merge. - pos_x : float, str + x : float, str X Offset. - pos_y : float, str + y : float, str Y Offset. - pos_z : float, str + z : float, str Z Offset. rotation : float, str Rotation angle in deg. @@ -356,23 +358,23 @@ def merge_design(self, merged_design=None, pos_x="0.0", pos_y="0.0", pos_z="0.0" self.components_3d[comp_name] = comp comp.is_3d_placement = True comp.local_origin = [0.0, 0.0, 0.0] - pos_x = self._arg_with_dim(pos_x) - pos_y = self._arg_with_dim(pos_y) - pos_z = self._arg_with_dim(pos_z) + x = self._arg_with_dim(x) + y = self._arg_with_dim(y) + z = self._arg_with_dim(z) rotation = self._arg_with_dim(rotation, "deg") comp.angle = rotation - comp.location = [pos_x, pos_y, pos_z] + comp.location = [x, y, z] return comp - @pyaedt_function_handler() - def change_clip_plane_position(self, clip_name, position): + @pyaedt_function_handler(clip_name="name", position="location") + def change_clip_plane_position(self, name, location): """Change the clip plane position. Parameters ---------- - clip_name : str + name : str Name of the clip plane. - position : list + location : list List of ``[x,y,z]`` coordinates for the new position. Returns @@ -385,15 +387,15 @@ def change_clip_plane_position(self, clip_name, position): >>> oEditor.ChangeProperty """ - return self.change_property(clip_name, "Location", position) + return self.change_property(name, "Location", location) - @pyaedt_function_handler() - def colinear_heal(self, selection, tolerance=0.1): + @pyaedt_function_handler(selection="assignment") + def colinear_heal(self, assignment, tolerance=0.1): """Remove small edges of one or more primitives. Parameters ---------- - selection : str or list + assignment : str or list One or more primitives to heal. tolerance : float, optional Tolerance value. The default is ``0.1``. @@ -415,19 +417,19 @@ def colinear_heal(self, selection, tolerance=0.1): >>> from pyaedt import Hfss3dLayout >>> h3d=Hfss3dLayout(specified_version="2021.2") >>> h3d.modeler.layers.add_layer("TOP") - >>> l1=h3d.modeler.create_line("TOP", [[0,0],[100,0]], 0.5, name="poly_1") - >>> l2=h3d.modeler.create_line("TOP", [[100,0],[120,-35]], 0.5, name="poly_2") + >>> l1=h3d.modeler.create_line("TOP",[[0,0],[100,0]],0.5) + >>> l2=h3d.modeler.create_line("TOP",[[100,0],[120,-35]],0.5) >>> h3d.modeler.unite([l1,l2]) - >>> h3d.modeler.colinear_heal("poly_2", 0.25) + >>> h3d.modeler.colinear_heal("poly_2",0.25) True """ - if isinstance(selection, str): - selection = [selection] + if isinstance(assignment, str): + assignment = [assignment] self.oeditor.Heal( [ "NAME:Repair", "Selection:=", - selection, + assignment, "Type:=", "Colinear", "Tol:=", @@ -437,13 +439,13 @@ def colinear_heal(self, selection, tolerance=0.1): return True - @pyaedt_function_handler() - def expand(self, object_to_expand, size=1, expand_type="ROUND", replace_original=False): + @pyaedt_function_handler(object_to_expand="assignment") + def expand(self, assignment, size=1, expand_type="ROUND", replace_original=False): """Expand the object by a specific size. Parameters ---------- - object_to_expand : str + assignment : str Name of the object. size : float, optional Size of the expansion. The default is ``1``. @@ -471,21 +473,19 @@ def expand(self, object_to_expand, size=1, expand_type="ROUND", replace_original >>> h3d=Hfss3dLayout(specified_version="2021.2") >>> h3d.modeler.layers.add_layer("TOP") >>> h3d.modeler.create_rectangle("TOP", [20,20],[50,50], name="rect_1") - >>> h3d.modeler.create_line("TOP",[[25,25],[40,40]], name="line_3") + >>> h3d.modeler.create_line("TOP",[[25,25],[40,40]]) >>> out1 = h3d.modeler.expand("line_3") >>> print(out1) line_4 """ - object_to_expand = self.convert_to_selections(object_to_expand) + assignment = self.convert_to_selections(assignment) self.cleanup_objects() - layer = self.oeditor.GetPropertyValue("BaseElementTab", object_to_expand, "PlacementLayer") - poly = self.oeditor.GetPolygonDef(object_to_expand).GetPoints() + layer = self.oeditor.GetPropertyValue("BaseElementTab", assignment, "PlacementLayer") + poly = self.oeditor.GetPolygonDef(assignment).GetPoints() pos = [poly[0].GetX(), poly[0].GetY()] geom_names = self.oeditor.FindObjectsByPoint(self.oeditor.Point().Set(pos[0], pos[1]), layer) - self.oeditor.Expand( - self.number_with_units(size), expand_type, replace_original, ["NAME:elements", object_to_expand] - ) + self.oeditor.Expand(self.number_with_units(size), expand_type, replace_original, ["NAME:elements", assignment]) self.cleanup_objects() if not replace_original: new_geom_names = [ @@ -494,20 +494,20 @@ def expand(self, object_to_expand, size=1, expand_type="ROUND", replace_original if i not in geom_names ] return new_geom_names[0] - return object_to_expand + return assignment - @pyaedt_function_handler() - def import_cadence_brd(self, brd_filename, edb_path=None, edb_name=None): + @pyaedt_function_handler(brd_filename="input_file", edb_path="output_dir", edb_name="name") + def import_cadence_brd(self, input_file, output_dir=None, name=None): """Import a cadence board. Parameters ---------- - brd_filename : str + input_file : str Full path and name of the BRD file to import. - edb_path : str, optional + output_dir : str, optional Path where the EDB is to be created. The default is ``None``, in which case the project directory is used. - edb_name : str, optional + name : str, optional Name of the EDB. The default is ``None``, in which case the board name is used. @@ -521,14 +521,14 @@ def import_cadence_brd(self, brd_filename, edb_path=None, edb_name=None): >>> oImportExport.ImportExtracta """ - if not edb_path: - edb_path = self.projdir - if not edb_name: - name = os.path.basename(brd_filename) - edb_name = os.path.splitext(name)[0] + if not output_dir: + output_dir = self.projdir + if not name: + name = os.path.basename(input_file) + name = os.path.splitext(name)[0] self._oimportexport.ImportExtracta( - brd_filename, os.path.join(edb_path, edb_name + ".aedb"), os.path.join(edb_path, edb_name + ".xml") + input_file, os.path.join(output_dir, name + ".aedb"), os.path.join(output_dir, name + ".xml") ) self._app.__init__(self._app._desktop.GetActiveProject().GetName()) return True @@ -550,18 +550,18 @@ def modeler_variable(self, value): else: return str(value) + self.model_units - @pyaedt_function_handler() - def import_ipc2581(self, ipc_filename, edb_path=None, edb_name=None): + @pyaedt_function_handler(ipc_filename="input_file", edb_path="output_dir", edb_name="name") + def import_ipc2581(self, input_file, output_dir=None, name=None): """Import an IPC file. Parameters ---------- - ipc_filename : str + input_file : str Full path and name of the IPC file. - edb_path : str, optional + output_dir : str, optional Path where the EDB is to be created. The default is ``None``, in which case the project directory is used. - edb_name : str, optional + name : str, optional Name of the EDB. The default is ``None``, in which case the board name is used. @@ -575,14 +575,14 @@ def import_ipc2581(self, ipc_filename, edb_path=None, edb_name=None): >>> oImportExport.ImportIPC """ - if not edb_path: - edb_path = self.projdir - if not edb_name: - name = os.path.basename(ipc_filename) - edb_name = os.path.splitext(name)[0] + if not output_dir: + output_dir = self.projdir + if not name: + name = os.path.basename(input_file) + name = os.path.splitext(name)[0] self._oimportexport.ImportIPC( - ipc_filename, os.path.join(edb_path, edb_name + ".aedb"), os.path.join(edb_path, edb_name + ".xml") + input_file, os.path.join(output_dir, name + ".aedb"), os.path.join(output_dir, name + ".xml") ) self._app.__init__(self._app._desktop.GetActiveProject().GetName()) return True @@ -619,13 +619,13 @@ def subtract(self, blank, tool): self.oeditor.Subtract(vArg1) return self.cleanup_objects() - @pyaedt_function_handler() - def convert_to_selections(self, objects_to_split, return_list=False): + @pyaedt_function_handler(objects_to_split="assignment") + def convert_to_selections(self, assignment, return_list=False): """Convert one or more object to selections. Parameters ---------- - objects_to_split : str, int, list + assignment : str, int, list One or more objects to convert to selections. A list can contain both strings (object names) and integers (object IDs). return_list : bool, option @@ -640,10 +640,10 @@ def convert_to_selections(self, objects_to_split, return_list=False): """ - if not isinstance(objects_to_split, list): - objects_to_split = [objects_to_split] + if not isinstance(assignment, list): + assignment = [assignment] objnames = [] - for el in objects_to_split: + for el in assignment: if isinstance(el, str): objnames.append(el) elif "name" in dir(el): @@ -655,13 +655,13 @@ def convert_to_selections(self, objects_to_split, return_list=False): else: return ",".join(objnames) - @pyaedt_function_handler() - def unite(self, objectlists): + @pyaedt_function_handler(objectlists="assignment") + def unite(self, assignment): """Unite objects from names. Parameters ---------- - objectlists : list + assignment : list List of objects to unite. Returns @@ -676,11 +676,11 @@ def unite(self, objectlists): """ vArg1 = ["NAME:primitives"] - if len(objectlists) >= 2: - objectlists = self.convert_to_selections(objectlists, True) + if len(assignment) >= 2: + assignment = self.convert_to_selections(assignment, True) self.cleanup_objects() - for el in objectlists: + for el in assignment: vArg1.append(el) self.oeditor.Unite(vArg1) return self.cleanup_objects() @@ -688,13 +688,13 @@ def unite(self, objectlists): self.logger.error("Input list must contain at least two elements.") return False - @pyaedt_function_handler() - def intersect(self, objectlists): + @pyaedt_function_handler(objectlists="assignment") + def intersect(self, assignment): """Intersect objects from names. Parameters ---------- - objectlists : list + assignment : list List of objects to intersect. Returns @@ -708,11 +708,11 @@ def intersect(self, objectlists): >>> oEditor.Intersect """ vArg1 = ["NAME:primitives"] - if len(objectlists) >= 2: - objectlists = self.convert_to_selections(objectlists, True) + if len(assignment) >= 2: + assignment = self.convert_to_selections(assignment, True) self.cleanup_objects() - for el in objectlists: + for el in assignment: vArg1.append(el) self.oeditor.Intersect(vArg1) return self.cleanup_objects() @@ -720,17 +720,17 @@ def intersect(self, objectlists): self.logger.error("Input list must contain at least two elements.") return False - @pyaedt_function_handler() - def duplicate(self, objectlists, count, direction_vector): + @pyaedt_function_handler(objectlists="assignment", direction_vector="vector") + def duplicate(self, assignment, count, vector): """Duplicate one or more elements along a vector. Parameters ---------- - objectlists : list + assignment : list List of elements to duplicate. count : int - direction_vector : list + vector : list List of ``[x,y]`` coordinates for the direction vector. Returns @@ -743,23 +743,21 @@ def duplicate(self, objectlists, count, direction_vector): >>> oEditor.Duplicate """ - objectlists = self.convert_to_selections(objectlists, True) + assignment = self.convert_to_selections(assignment, True) self.cleanup_objects() - if isinstance(objectlists, str): - objectlists = [objectlists] - self.oeditor.Duplicate( - ["NAME:options", "count:=", count], ["NAME:elements", ",".join(objectlists)], direction_vector - ) + if isinstance(assignment, str): + assignment = [assignment] + self.oeditor.Duplicate(["NAME:options", "count:=", count], ["NAME:elements", ",".join(assignment)], vector) return self.cleanup_objects() - @pyaedt_function_handler() - def duplicate_across_layers(self, objects, layers): + @pyaedt_function_handler(objects="assignment") + def duplicate_across_layers(self, assignment, layers): """Duplicate one or more elements along a vector. Parameters ---------- - objects : list + assignment : list List of elements to duplicate. layers : str, list Layer name on which duplicate object. @@ -774,12 +772,12 @@ def duplicate_across_layers(self, objects, layers): >>> oEditor.DuplicateAcrossLyrs """ - objects = self.convert_to_selections(objects, True) + assignment = self.convert_to_selections(assignment, True) self.cleanup_objects() if isinstance(layers, str): layers = [layers] - varg1 = ["NAME:elements"] + objects + varg1 = ["NAME:elements"] + assignment varg2 = ["NAME:layers"] + layers self.oeditor.DuplicateAcrossLyrs(varg1, varg2) @@ -841,15 +839,15 @@ def set_temperature_dependence( self.logger.info("Assigned Objects Temperature") return True - @pyaedt_function_handler() - def set_spice_model(self, component_name, model_path, model_name=None, subcircuit_name=None, pin_map=None): + @pyaedt_function_handler(component_name="assignment", model_path="input_file") + def set_spice_model(self, assignment, input_file, model_name=None, subcircuit_name=None, pin_map=None): """Assign a Spice model to a component. Parameters ---------- - component_name : str + assignment : str Name of the component. - model_path : str, optional + input_file : str, optional Full path to the model file. The default is ``None``. model_name : str, optional Name of the model. The default is ``None``, in which case the model name is the file name without an @@ -870,14 +868,11 @@ def set_spice_model(self, component_name, model_path, model_name=None, subcircui >>> from pyaedt import Hfss3dLayout >>> h3d = Hfss3dLayout("myproject") - >>> h3d.modeler.set_spice_model(component_name="A1", - ... modelpath="pathtospfile", - ... modelname="spicemodelname", - ... subcircuit_name="SUBCK1") + >>> h3d.modeler.set_spice_model(assignment="A1",input_file=,subcircuit_name="SUBCK1") """ if not model_name: - model_name = get_filename_without_extension(model_path) + model_name = get_filename_without_extension(input_file) if model_name not in list(self.o_model_manager.GetNames()): args = [ "NAME:" + model_name, @@ -900,21 +895,21 @@ def set_spice_model(self, component_name, model_path, model_name=None, subcircui ["NAME:PortInfoBlk"], ["NAME:PortOrderBlk"], "filename:=", - model_path, + input_file, "modelname:=", model_name, ] self.o_model_manager.Add(args) if not subcircuit_name: subcircuit_name = model_name - with open_file(model_path, "r") as f: + with open_file(input_file, "r") as f: for line in f: if "subckt" in line.lower(): pinNames = [i.strip() for i in re.split(" |\t", line) if i] pinNames.remove(pinNames[0]) pinNames.remove(pinNames[0]) break - componentPins = list(self.components[component_name].pins.keys()) + componentPins = list(self.components[assignment].pins.keys()) componentPins.reverse() if not pin_map: pin_map = [] @@ -938,7 +933,7 @@ def set_spice_model(self, component_name, model_path, model_name=None, subcircui "RLCModelType:=", 4, "SPICE_file_path:=", - model_path, + input_file, "SPICE_model_name:=", model_name, "SPICE_subckt:=", @@ -947,9 +942,9 @@ def set_spice_model(self, component_name, model_path, model_name=None, subcircui pin_map, ], ] - args = ["NAME:ModelChanges", ["NAME:UpdateModel0", ["NAME:ComponentNames", component_name], "Prop:=", args2]] + args = ["NAME:ModelChanges", ["NAME:UpdateModel0", ["NAME:ComponentNames", assignment], "Prop:=", args2]] self.oeditor.UpdateModels(args) - self.logger.info("Spice Model Correctly assigned to {}.".format(component_name)) + self.logger.info("Spice Model Correctly assigned to {}.".format(assignment)) return True @pyaedt_function_handler() diff --git a/pyaedt/modeler/pcb/Primitives3DLayout.py b/pyaedt/modeler/pcb/Primitives3DLayout.py index 93535a557a6..a457a33684d 100644 --- a/pyaedt/modeler/pcb/Primitives3DLayout.py +++ b/pyaedt/modeler/pcb/Primitives3DLayout.py @@ -165,13 +165,13 @@ def voids(self): geom[k] = v return geom - @pyaedt_function_handler() - def objects_by_layer(self, layer_name, object_filter=None, include_voids=False): + @pyaedt_function_handler(layer_name="layer", object_filter="filter") + def objects_by_layer(self, layer, object_filter=None, include_voids=False): """Retrieve the list of objects that belongs to a specific layer. Parameters ---------- - layer_name : str + layer : str Name of the layer to filter. object_filter : str, list, optional Name of the category to include in search. Options are `"poly"`, `"circle"`, @@ -192,24 +192,24 @@ def objects_by_layer(self, layer_name, object_filter=None, include_voids=False): for poly in object_filter: objs = self.modeler.oeditor.FilterObjectList( - "Type", poly, self.modeler.oeditor.FindObjects("Layer", layer_name) + "Type", poly, self.modeler.oeditor.FindObjects("Layer", layer) ) if include_voids: objs = self.modeler.oeditor.FilterObjectList( - "Type", poly + " void", self.modeler.oeditor.FindObjects("Layer", layer_name) + "Type", poly + " void", self.modeler.oeditor.FindObjects("Layer", layer) ) else: - objs = self.modeler.oeditor.FindObjects("Layer", layer_name) + objs = self.modeler.oeditor.FindObjects("Layer", layer) return objs - @pyaedt_function_handler() - def objects_by_net(self, net_name, object_filter=None, include_voids=False): + @pyaedt_function_handler(net_name="net") + def objects_by_net(self, net, object_filter=None, include_voids=False): """Retrieve the list of objects that belongs to a specific net. Parameters ---------- - net_name : str + net : str Name of the net to filter. object_filter : str, list, optional Name of the category to include in search. Options are `"poly"`, `"circle"`, @@ -229,16 +229,14 @@ def objects_by_net(self, net_name, object_filter=None, include_voids=False): object_filter = [object_filter] for poly in object_filter: - objs = self.modeler.oeditor.FilterObjectList( - "Type", poly, self.modeler.oeditor.FindObjects("Net", net_name) - ) + objs = self.modeler.oeditor.FilterObjectList("Type", poly, self.modeler.oeditor.FindObjects("Net", net)) if include_voids: objs = self.modeler.oeditor.FilterObjectList( - "Type", poly + " void", self.modeler.oeditor.FindObjects("Net", net_name) + "Type", poly + " void", self.modeler.oeditor.FindObjects("Net", net) ) else: - objs = self.modeler.oeditor.FindObjects("Net", net_name) + objs = self.modeler.oeditor.FindObjects("Net", net) return objs @pyaedt_function_handler() @@ -783,7 +781,7 @@ def padstacks(self): lay = prop[i] lay_name = lay[2] lay_id = int(lay[4]) - self._padstacks[name].add_layer(layername=lay_name, layer_id=lay_id) + self._padstacks[name].add_layer(layer=lay_name, layer_id=lay_id) self._padstacks[name].layers[lay_name].layername = lay_name self._padstacks[name].layers[lay_name].pad = self._padstacks[name].add_hole( lay[6][1], list(lay[6][3]), lay[6][5], lay[6][7], lay[6][9] @@ -804,13 +802,13 @@ def padstacks(self): return self._padstacks - @pyaedt_function_handler() - def change_net_visibility(self, netlist=None, visible=False): + @pyaedt_function_handler(netlist="assignment") + def change_net_visibility(self, assignment=None, visible=False): """Change the visibility of one or more nets. Parameters ---------- - netlist : str or list, optional + assignment : str or list, optional One or more nets to visualize. The default is ``None``. If no nets are provided all the nets in the design will be selected. visible : bool, optional @@ -828,13 +826,13 @@ def change_net_visibility(self, netlist=None, visible=False): >>> oEditor.SetNetVisible """ nets_dictionary = {} - if not netlist: - netlist = self.nets - elif [x for x in netlist if x not in self.nets]: + if not assignment: + assignment = self.nets + elif [x for x in assignment if x not in self.nets]: self.logger.error("Selected net doesn't exist in current design.") return False - if isinstance(netlist, str): - netlist = [netlist] + if isinstance(assignment, str): + assignment = [assignment] if isinstance(visible, str): if visible.lower() == "true": @@ -849,7 +847,7 @@ def change_net_visibility(self, netlist=None, visible=False): return False for net in self.nets: - if net not in netlist: + if net not in assignment: nets_dictionary[net] = not visible else: nets_dictionary[net] = visible @@ -867,7 +865,7 @@ def change_net_visibility(self, netlist=None, visible=False): self.logger.error("Couldn't change nets visibility.") return False - @pyaedt_function_handler() + @pyaedt_function_handler(netname="net") def create_via( self, padstack="PlanarEMVia", @@ -878,7 +876,7 @@ def create_via( top_layer=None, bot_layer=None, name=None, - netname=None, + net=None, ): # type: (str, float | str, float | str, float, float, str, str, str, str) -> Pins3DLayout """Create a via based on an existing padstack. @@ -902,7 +900,7 @@ def create_via( Bottom layer. If ``None`` the last layer is taken. name : str, optional Name of the via. If ``None`` a random name is generated. - netname : str, optional + net : str, optional Name of the net. The default is ``None``, in which case no name is assigned. @@ -947,14 +945,14 @@ def create_via( arg.append("lowest_layer:="), arg.append(bot_layer) self.oeditor.CreateVia(arg) - if netname: + if net: self.oeditor.ChangeProperty( [ "NAME:AllTabs", [ "NAME:BaseElementTab", ["NAME:PropServers", name], - ["NAME:ChangedProps", ["NAME:Net", "Value:=", netname]], + ["NAME:ChangedProps", ["NAME:Net", "Value:=", net]], ], ] ) @@ -964,13 +962,13 @@ def create_via( self.logger.error(str(e)) return False - @pyaedt_function_handler() - def create_circle(self, layername, x, y, radius, name=None, net_name=None, **kwargs): + @pyaedt_function_handler(layername="layer", netname="net", net_name="net") + def create_circle(self, layer, x, y, radius, name=None, net=None, **kwargs): """Create a circle on a layer. Parameters ---------- - layername : str + layer : str Name of the layer. x : float Position on the X axis. @@ -981,7 +979,7 @@ def create_circle(self, layername, x, y, radius, name=None, net_name=None, **kwa name : str, optional Name of the circle. The default is ``None``, in which case the default name is assigned. - net_name : str, optional + net : str, optional Name of the net. The default is ``None``, in which case the default name is assigned. @@ -995,12 +993,6 @@ def create_circle(self, layername, x, y, radius, name=None, net_name=None, **kwa >>> oEditor.CreateCircle """ - if "netname" in kwargs: - warnings.warn( - "`netname` is deprecated. Use `net_name` instead.", - DeprecationWarning, - ) - net_name = kwargs["netname"] if not name: name = _uname() else: @@ -1011,7 +1003,7 @@ def create_circle(self, layername, x, y, radius, name=None, net_name=None, **kwa vArg1 = ["NAME:Contents", "circleGeometry:="] vArg2 = [] vArg2.append("Name:="), vArg2.append(name) - vArg2.append("LayerName:="), vArg2.append(layername) + vArg2.append("LayerName:="), vArg2.append(layer) vArg2.append("lw:="), vArg2.append("0") vArg2.append("x:="), vArg2.append(self.number_with_units(x)) vArg2.append("y:="), vArg2.append(self.number_with_units(y)) @@ -1021,24 +1013,22 @@ def create_circle(self, layername, x, y, radius, name=None, net_name=None, **kwa primitive = Circle3dLayout(self, name, False) self._circles[name] = primitive - if net_name: - primitive.change_property(property_val=["NAME:Net", "Value:=", net_name]) + if net: + primitive.change_property(value=["NAME:Net", "Value:=", net]) return primitive - @pyaedt_function_handler() - def create_rectangle( - self, layername, origin, dimensions, corner_radius=0, angle=0, name=None, net_name=None, **kwargs - ): + @pyaedt_function_handler(layername="layer", dimensions="sizes", net_name="net", netname="net") + def create_rectangle(self, layer, origin, sizes, corner_radius=0, angle=0, name=None, net=None, **kwargs): """Create a rectangle on a layer. Parameters ---------- - layername : str + layer : str Name of the layer. origin : list Origin of the coordinate system in a list of ``[x, y]`` coordinates. - dimensions : list + sizes : list Dimensions for the box in a list of ``[x, y]`` coordinates. corner_radius : float, optional angle : float, optional @@ -1046,7 +1036,7 @@ def create_rectangle( name : str, optional Name of the rectangle. The default is ``None``, in which case the default name is assigned. - net_name : str, optional + net : str, optional Name of the net. The default is ``None``, in which case the default name is assigned. @@ -1060,12 +1050,6 @@ def create_rectangle( >>> oEditor.CreateRectangle """ - if "netname" in kwargs: - warnings.warn( - "`netname` is deprecated. Use `net_name` instead.", - DeprecationWarning, - ) - net_name = kwargs["netname"] if not name: name = _uname() else: @@ -1076,16 +1060,12 @@ def create_rectangle( vArg1 = ["NAME:Contents", "rectGeometry:="] vArg2 = [] vArg2.append("Name:="), vArg2.append(name) - vArg2.append("LayerName:="), vArg2.append(layername) + vArg2.append("LayerName:="), vArg2.append(layer) vArg2.append("lw:="), vArg2.append("0") vArg2.append("Ax:="), vArg2.append(self.number_with_units(origin[0])) vArg2.append("Ay:="), vArg2.append(self.number_with_units(origin[1])) - vArg2.append("Bx:="), vArg2.append( - self.number_with_units(origin[0]) + "+" + self.number_with_units(dimensions[0]) - ) - vArg2.append("By:="), vArg2.append( - self.number_with_units(origin[1]) + "+" + self.number_with_units(dimensions[1]) - ) + vArg2.append("Bx:="), vArg2.append(self.number_with_units(origin[0]) + "+" + self.number_with_units(sizes[0])) + vArg2.append("By:="), vArg2.append(self.number_with_units(origin[1]) + "+" + self.number_with_units(sizes[1])) vArg2.append("cr:="), vArg2.append(self.number_with_units(corner_radius)) vArg2.append("ang:=") vArg2.append(self.number_with_units(angle, "deg")) @@ -1094,18 +1074,18 @@ def create_rectangle( primitive = Rect3dLayout(self, name, False) self._rectangles[name] = primitive - if net_name: - primitive.change_property(property_val=["NAME:Net", "Value:=", net_name]) + if net: + primitive.change_property(value=["NAME:Net", "Value:=", net]) return primitive - @pyaedt_function_handler() - def create_polygon(self, layername, point_list, units=None, name=None, net_name=None): + @pyaedt_function_handler(layername="layer", net_name="net") + def create_polygon(self, layer, point_list, units=None, name=None, net=None): """Create a polygon on a specified layer. Parameters ---------- - layername : str + layer : str Name of the layer. point_list : list Origin of the coordinate system in a list of ``[x, y]`` coordinates. @@ -1114,7 +1094,7 @@ def create_polygon(self, layername, point_list, units=None, name=None, net_name= name : str, optional Name of the rectangle. The default is ``None``, in which case the default name is assigned. - net_name : str, optional + net : str, optional Name of the net. The default is ``None``, in which case the default name is assigned. @@ -1138,7 +1118,7 @@ def create_polygon(self, layername, point_list, units=None, name=None, net_name= vArg1 = ["NAME:Contents", "polyGeometry:="] vArg2 = [] vArg2.append("Name:="), vArg2.append(name) - vArg2.append("LayerName:="), vArg2.append(layername) + vArg2.append("LayerName:="), vArg2.append(layer) vArg2.append("lw:="), vArg2.append("0") vArg2.append("n:="), vArg2.append(len(point_list)) vArg2.append("U:="), vArg2.append(units if units else self.model_units) @@ -1150,22 +1130,22 @@ def create_polygon(self, layername, point_list, units=None, name=None, net_name= primitive = Polygons3DLayout(self, name, is_void=False) self._polygons[name] = primitive - if net_name: - primitive.change_property(property_val=["NAME:Net", "Value:=", net_name]) + if net: + primitive.change_property(value=["NAME:Net", "Value:=", net]) return primitive - @pyaedt_function_handler() - def create_polygon_void(self, layername, point_list, object_owner, units=None, name=None): + @pyaedt_function_handler(layername="layer", point_list="points", object_owner="assignment") + def create_polygon_void(self, layer, points, assignment, units=None, name=None): """Create a polygon void on a specified layer. Parameters ---------- - layername : str + layer : str Name of the layer. - point_list : list + points : list List of points in a list of ``[x, y]`` coordinates. - object_owner : str + assignment : str Object Owner. units : str, optional Polygon units. Default is modeler units. @@ -1189,18 +1169,18 @@ def create_polygon_void(self, layername, point_list, object_owner, units=None, n listnames = self.oeditor.FindObjects("Name", name) if listnames: name = _uname(name) - if not self.oeditor.FindObjects("Name", object_owner): + if not self.oeditor.FindObjects("Name", assignment): self._app.logger.error("Owner Polygon not found.") return False - vArg1 = ["NAME:Contents", "owner:=", object_owner, "poly voidGeometry:="] + vArg1 = ["NAME:Contents", "owner:=", assignment, "poly voidGeometry:="] vArg2 = [] vArg2.append("Name:="), vArg2.append(name) - vArg2.append("LayerName:="), vArg2.append(layername) + vArg2.append("LayerName:="), vArg2.append(layer) vArg2.append("lw:="), vArg2.append("0") - vArg2.append("n:="), vArg2.append(len(point_list)) + vArg2.append("n:="), vArg2.append(len(points)) vArg2.append("U:="), vArg2.append(units if units else self.model_units) - for point in point_list: + for point in points: vArg2.append("x:="), vArg2.append(point[0]) vArg2.append("y:="), vArg2.append(point[1]) vArg1.append(vArg2) @@ -1210,18 +1190,20 @@ def create_polygon_void(self, layername, point_list, object_owner, units=None, n return primitive - @pyaedt_function_handler() + @pyaedt_function_handler( + layername="layer", center_line_list="center_line_coordinates", net_name="net", netname="net" + ) def create_line( - self, layername, center_line_list, lw=1, start_style=0, end_style=0, name=None, net_name=None, **kwargs + self, layer, center_line_coordinates, lw=1, start_style=0, end_style=0, name=None, net=None, **kwargs ): # type: (str, list, float|str, int, int, str, str, any) -> Line3dLayout """Create a line based on a list of points. Parameters ---------- - layername : str + layer : str Name of the layer to create the line on. - center_line_list : list + center_line_coordinates : list List of centerline coordinates in the form of ``[x, y]``. lw : float, optional Line width. The default is ``1``. @@ -1239,7 +1221,7 @@ def create_line( name : str, optional Name of the line. The default is ``None``, in which case the default name is assigned. - net_name : str, optional + net : str, optional Name of the net. The default is ``None``, in which case the default name is assigned. @@ -1258,7 +1240,7 @@ def create_line( "`netname` is deprecated. Use `net_name` instead.", DeprecationWarning, ) - net_name = kwargs["netname"] + net = kwargs["netname"] if not name: name = _uname() else: @@ -1270,7 +1252,7 @@ def create_line( "Name:=", name, "LayerName:=", - layername, + layer, "lw:=", self.number_with_units(lw), "endstyle:=", @@ -1278,11 +1260,11 @@ def create_line( "StartCap:=", start_style, "n:=", - len(center_line_list), + len(center_line_coordinates), "U:=", self.model_units, ] - for a in center_line_list: + for a in center_line_coordinates: arg2.append("x:=") arg2.append(a[0]) arg2.append("y:=") @@ -1292,33 +1274,10 @@ def create_line( primitive = Line3dLayout(self, name, False) self._lines[name] = primitive - if net_name: - primitive.change_property(property_val=["NAME:Net", "Value:=", net_name]) + if net: + primitive.change_property(value=["NAME:Net", "Value:=", net]) return primitive - @pyaedt_function_handler() - def arg_with_dim(self, Value, sUnits=None): - """Format arguments with dimensions. - - .. deprecated:: 0.6.56 - Use :func:`number_with_units` instead. - - Parameters - ---------- - Value : - The value of the quantity. - sUnits : - The default is ``None``. - - Returns - ------- - str - String containing the value or value and the units if `sUnits` is not ``None``. - - """ - warnings.warn("Use :func:`number_with_units` instead.", DeprecationWarning) - return self._app.number_with_units(Value, sUnits) - @pyaedt_function_handler() def number_with_units(self, value, units=None): """Convert a number to a string with units. @@ -1340,7 +1299,7 @@ def number_with_units(self, value, units=None): """ return self._app.number_with_units(value, units) - @pyaedt_function_handler + @pyaedt_function_handler() def place_3d_component( self, component_path, @@ -1536,7 +1495,8 @@ def create_component_on_pins( comp = Components3DLayout(self, comp_name.split(";")[-1]) return comp - def create_text(self, text, position, placement_layer="PostProcessing", angle=0, font_size=12): + @pyaedt_function_handler(placement_layer="layer") + def create_text(self, text, position, layer="PostProcessing", angle=0, font_size=12): """Create a text primitive object. Parameters @@ -1545,7 +1505,7 @@ def create_text(self, text, position, placement_layer="PostProcessing", angle=0, Name for the text primitive object. position : list Position of the text. - placement_layer : str, optional + layer : str, optional Layer where text will be placed. The default value is ``"PostProcessing"``. angle : float, optional Angle of the text. The default value is ``0``. @@ -1565,7 +1525,7 @@ def create_text(self, text, position, placement_layer="PostProcessing", angle=0, "Name:=", name, "LayerName:=", - placement_layer, + layer, "x:=", position[0], "y:=", diff --git a/pyaedt/modeler/pcb/object3dlayout.py b/pyaedt/modeler/pcb/object3dlayout.py index 42965095a27..f6d238370b5 100644 --- a/pyaedt/modeler/pcb/object3dlayout.py +++ b/pyaedt/modeler/pcb/object3dlayout.py @@ -40,15 +40,15 @@ def object_units(self): """ return self._primitives.model_units - @pyaedt_function_handler() - def change_property(self, property_val, names_list=None): + @pyaedt_function_handler(property_val="value", names_list="names") + def change_property(self, value, names=None): """Modify a property. Parameters ---------- - property_val : list + value : list - names_list : list, optional + names : list, optional The default is ``None``. Returns @@ -61,10 +61,10 @@ def change_property(self, property_val, names_list=None): >>> oEditor.ChangeProperty """ - vChangedProps = ["NAME:ChangedProps", property_val] - if names_list: # pragma: no cover + vChangedProps = ["NAME:ChangedProps", value] + if names: # pragma: no cover vPropServers = ["NAME:PropServers"] - for el in names_list: + for el in names: vPropServers.append(el) else: vPropServers = ["NAME:PropServers", self.name] @@ -74,15 +74,15 @@ def change_property(self, property_val, names_list=None): self._oeditor.ChangeProperty(vOut) return True - @pyaedt_function_handler() - def set_property_value(self, property_name, property_value): + @pyaedt_function_handler(property_name="name", property_value="value") + def set_property_value(self, name, value): """Set a property value. Parameters ---------- - property_name : str + name : str Name of the property. - property_value : + value : Value of the property. Returns @@ -95,7 +95,7 @@ def set_property_value(self, property_name, property_value): >>> oEditor.ChangeProperty """ - vProp = ["NAME:" + property_name, "Value:=", property_value] + vProp = ["NAME:" + name, "Value:=", value] return self.change_property(vProp) @property @@ -1044,13 +1044,13 @@ def top_edge_y(self): result = [(edge[0][1] + edge[1][1]) for edge in self.edges] return result.index(max(result)) - @pyaedt_function_handler() - def get_property_value(self, propertyname): + @pyaedt_function_handler(propertyname="name") + def get_property_value(self, name): """Retrieve a property value. Parameters ---------- - propertyname : str + name : str Name of the property Returns @@ -1063,7 +1063,7 @@ def get_property_value(self, propertyname): >>> oEditor.GetPropertyValue """ - return self._oeditor.GetPropertyValue("BaseElementTab", self.name, propertyname) + return self._oeditor.GetPropertyValue("BaseElementTab", self.name, name) @property def negative(self): @@ -1531,7 +1531,7 @@ def add(self, point, position=0): point : list [x,y] coordinate point to add. position : int, optional - Position of the new point. + Position of the new point in the geometry. Returns ------- @@ -1541,14 +1541,7 @@ def add(self, point, position=0): [self._primitives.number_with_units(j, self.object_units) for j in i] for i in (self.center_line.values()) ] points.insert(position, [self._primitives.number_with_units(j, self.object_units) for j in point]) - line = self._primitives.create_line( - self.placement_layer, - points, - lw=self.width, - start_style=self.start_cap_type, - end_style=self.end_cap_type, - net_name=self.net_name, - ) + line = self._primitives.create_line(self.placement_layer, points) line_name = self.name self._primitives.oeditor.Delete([self.name]) line.name = line_name @@ -1576,14 +1569,7 @@ def remove(self, point): for i, v in self.center_line.items() if i not in point ] - line = self._primitives.create_line( - self.placement_layer, - points, - lw=self.width, - start_style=self.start_cap_type, - end_style=self.end_cap_type, - net_name=self.net_name, - ) + line = self._primitives.create_line(self.placement_layer, points) line_name = self.name self._primitives.oeditor.Delete([self.name]) line.name = line_name @@ -1653,13 +1639,13 @@ def position(self): else: return [self.point.GetX(), self.point.GetY()] - @pyaedt_function_handler() - def move(self, new_position): + @pyaedt_function_handler(new_position="location") + def move(self, location): """Move actual point to new location. Parameters ---------- - new_position : List + location : List New point location. Returns @@ -1668,7 +1654,7 @@ def move(self, new_position): ``True`` if the point was moved to the new location. """ - if self.point.Move(self._primitives.oeditor.Point().Set(new_position[0], new_position[1])): + if self.point.Move(self._primitives.oeditor.Point().Set(location[0], location[1])): return True @@ -2069,10 +2055,10 @@ def pads_args(self): arg.append([]) return arg - @pyaedt_function_handler() + @pyaedt_function_handler(layername="layer") def add_layer( self, - layername="Start", + layer="Start", pad_hole=None, antipad_hole=None, thermal_hole=None, @@ -2085,7 +2071,7 @@ def add_layer( Parameters ---------- - layername : str, optional + layer : str, optional Name of layer. The default is ``"Start"``. pad_hole : pyaedt.modeler.Object3d.Object3d.PDSHole Pad hole object, which you can create with the :func:`add_hole` method. @@ -2109,29 +2095,28 @@ def add_layer( ``True`` when successful, ``False`` when failed. """ - layer_id = None - if layername in self.layers: + if layer in self.layers: return False else: if not layer_id: layer_id = len(list(self.layers.keys())) + 1 - new_layer = self.PDSLayer(layername, layer_id) + new_layer = self.PDSLayer(layer, layer_id) new_layer.pad = pad_hole new_layer.antipad = antipad_hole new_layer.thermal = thermal_hole new_layer.connectionx = connx new_layer.connectiony = conny new_layer.connectiondir = conndir - self.layers[layername] = new_layer + self.layers[layer] = new_layer return True - @pyaedt_function_handler() - def add_hole(self, holetype="Cir", sizes=[1], xpos=0, ypos=0, rot=0): + @pyaedt_function_handler(holetype="hole_type", xpos="x", ypos="y", rot="rotation") + def add_hole(self, hole_type="Cir", sizes=None, x=0, y=0, rotation=0): """Add a hole. Parameters ---------- - holetype : str, optional + hole_type : str, optional Type of the hole. Options are: * No" - no pad @@ -2150,11 +2135,11 @@ def add_hole(self, holetype="Cir", sizes=[1], xpos=0, ypos=0, rot=0): sizes : array, optional Array of sizes, which depends on the object. For example, a circle ias an array of one element. The default is ``[1]``. - xpos : + x : Position on the X axis. The default is ``0``. - ypos : + y : Position on the Y axis. The default is ``0``. - rot : float, optional + rotation : float, optional Angle rotation in degrees. The default is ``0``. Returns @@ -2163,13 +2148,15 @@ def add_hole(self, holetype="Cir", sizes=[1], xpos=0, ypos=0, rot=0): Hole object to be passed to padstack or layer. """ + if sizes is None: + sizes = [1] hole = self.PDSHole() - hole.shape = holetype + hole.shape = hole_type sizes = [_dim_arg(i, self.units) for i in sizes if type(i) is int or float] hole.sizes = sizes - hole.x = _dim_arg(xpos, self.units) - hole.y = _dim_arg(ypos, self.units) - hole.rot = _dim_arg(rot, "deg") + hole.x = _dim_arg(x, self.units) + hole.y = _dim_arg(y, self.units) + hole.rot = _dim_arg(rotation, "deg") return hole @pyaedt_function_handler() diff --git a/pyaedt/modeler/schematic.py b/pyaedt/modeler/schematic.py index 02810f4a1f2..2a54297351f 100644 --- a/pyaedt/modeler/schematic.py +++ b/pyaedt/modeler/schematic.py @@ -90,20 +90,25 @@ def zoom_to_fit(self): """ self.oeditor.ZoomToFit() - @pyaedt_function_handler() - def connect_schematic_components(self, firstcomponent, secondcomponent, pinnum_first=2, pinnum_second=1): + @pyaedt_function_handler( + firstcomponent="starting_component", + secondcomponent="ending_component", + pinnum_first="pin_starting", + pinnum_second="pin_ending", + ) + def connect_schematic_components(self, starting_component, ending_component, pin_starting=2, pin_ending=1): """Connect schematic components. Parameters ---------- - firstcomponent : str + starting_component : str Starting (right) component. - secondcomponent : str + ending_component : str Ending (left) component for the connection line. - pinnum_first : str, optional + pin_starting : str, optional Number of the pin at which to terminate the connection from the right end of the starting component. The default is ``2``. - pinnum_second : str, optional + pin_ending : str, optional Number of the pin at which to terminate the connection from the left end of the ending component. The default is ``1``. @@ -119,10 +124,10 @@ def connect_schematic_components(self, firstcomponent, secondcomponent, pinnum_f """ if self._app.design_type == "Maxwell Circuit": components = self.schematic.components - obj1 = components[firstcomponent] + obj1 = components[starting_component] else: components = self.components - obj1 = components[firstcomponent] + obj1 = components[starting_component] if "Port" in obj1.composed_name: pos1 = self.oeditor.GetPropertyValue("BaseElementTab", obj1.composed_name, "Component Location").split(", ") pos1 = [float(i.strip()[:-3]) * 0.0000254 for i in pos1] @@ -132,9 +137,9 @@ def connect_schematic_components(self, firstcomponent, secondcomponent, pinnum_f if self._app.design_type == "Maxwell Circuit": pos1 = [float(re.sub(r"[^0-9.\-]", "", x)) * 0.0000254 for x in obj1.location] else: - pins1 = components.get_pins(firstcomponent) - pos1 = components.get_pin_location(firstcomponent, pins1[pinnum_first - 1]) - obj2 = components[secondcomponent] + pins1 = components.get_pins(starting_component) + pos1 = components.get_pin_location(starting_component, pins1[pin_starting - 1]) + obj2 = components[ending_component] if "Port" in obj2.composed_name: pos2 = self.oeditor.GetPropertyValue("BaseElementTab", obj2.composed_name, "Component Location").split(", ") pos2 = [float(i.strip()[:-3]) * 0.0000254 for i in pos2] @@ -145,8 +150,8 @@ def connect_schematic_components(self, firstcomponent, secondcomponent, pinnum_f if self._app.design_type == "Maxwell Circuit": pos2 = [float(re.sub(r"[^0-9.\-]", "", x)) * 0.0000254 for x in obj2.location] else: - pins2 = components.get_pins(secondcomponent) - pos2 = components.get_pin_location(secondcomponent, pins2[pinnum_second - 1]) + pins2 = components.get_pins(ending_component) + pos2 = components.get_pin_location(ending_component, pins2[pin_ending - 1]) try: self.schematic.create_wire([pos1, pos2]) return True @@ -326,17 +331,17 @@ def create_text( except Exception: return False - @pyaedt_function_handler - def change_text_property(self, property_id, property_name, property_value): # pragma: no cover + @pyaedt_function_handler(property_id="assignment", property_name="name", property_value="value") + def change_text_property(self, assignment, name, value): """Change an oeditor property. Parameters ---------- - property_id : str + assignment : str Object id. - property_name : str + name : str Name of the property. For example, ``Text``. - property_value : str, list, int + value : str, list, int Value of the property. It can be a string, an int for a single value, a list of three elements for ``[r,g,b]`` color values or a list of two elements for ``[x, y]`` coordinates. @@ -351,15 +356,11 @@ def change_text_property(self, property_id, property_name, property_value): # p >>> oEditor.ChangeProperty """ graphics_id = [id.split("@")[1] for id in self.oeditor.GetAllGraphics()] - if property_id not in graphics_id: + if assignment not in graphics_id: self.logger.error("Invalid id.") return False - if isinstance(property_value, list) and len(property_value) == 3: - if ( - not isinstance(property_value[0], int) - or not isinstance(property_value[1], int) - or not isinstance(property_value[2], int) - ): + if isinstance(value, list) and len(value) == 3: + if not isinstance(value[0], int) or not isinstance(value[1], int) or not isinstance(value[2], int): self.logger.error("Invalid RGB values for color") return False self.oeditor.ChangeProperty( @@ -367,61 +368,61 @@ def change_text_property(self, property_id, property_name, property_value): # p "NAME:AllTabs", [ "NAME:BaseElementTab", - ["NAME:PropServers", "SchObj@" + property_id], + ["NAME:PropServers", "SchObj@" + assignment], [ "NAME:ChangedProps", [ - "NAME:" + property_name, + "NAME:" + name, "R:=", - property_value[0], + value[0], "G:=", - property_value[1], + value[1], "B:=", - property_value[2], + value[2], ], ], ], ] ) - elif isinstance(property_value, list) and len(property_value) == 2: - xpos = self._arg_with_dim(property_value[0]) - ypos = self._arg_with_dim(property_value[1]) + elif isinstance(value, list) and len(value) == 2: + xpos = self._arg_with_dim(value[0]) + ypos = self._arg_with_dim(value[1]) self.oeditor.ChangeProperty( [ "NAME:AllTabs", [ "NAME:BaseElementTab", - ["NAME:PropServers", "SchObj@" + property_id], - ["NAME:ChangedProps", ["NAME:" + property_name, "X:=", xpos, "Y:=", ypos]], + ["NAME:PropServers", "SchObj@" + assignment], + ["NAME:ChangedProps", ["NAME:" + name, "X:=", xpos, "Y:=", ypos]], ], ] ) - elif isinstance(property_value, bool): + elif isinstance(value, bool): self.oeditor.ChangeProperty( [ "NAME:AllTabs", [ "NAME:BaseElementTab", - ["NAME:PropServers", "SchObj@" + property_id], - ["NAME:ChangedProps", ["NAME:" + property_name, "Value:=", property_value]], + ["NAME:PropServers", "SchObj@" + assignment], + ["NAME:ChangedProps", ["NAME:" + name, "Value:=", value]], ], ] ) - elif isinstance(property_value, (str, float, int)): + elif isinstance(value, (str, float, int)): self.oeditor.ChangeProperty( [ "NAME:AllTabs", [ "NAME:BaseElementTab", - ["NAME:PropServers", "SchObj@" + property_id], - ["NAME:ChangedProps", ["NAME:" + property_name, "Value:=", property_value]], + ["NAME:PropServers", "SchObj@" + assignment], + ["NAME:ChangedProps", ["NAME:" + name, "Value:=", value]], ], ] ) else: self.logger.error("Wrong Property Value") return False - self.logger.debug("Property {} Changed correctly.".format(property_name)) + self.logger.debug("Property {} Changed correctly.".format(name)) return True @pyaedt_function_handler() @@ -567,15 +568,15 @@ def model_units(self, units): assert units in AEDT_UNITS["Length"], "Invalid units string {0}".format(units) self.oeditor.SetActivelUnits(["NAME:Units Parameter", "Units:=", units, "Rescale:=", False]) - @pyaedt_function_handler() - def move(self, selections, pos, units=None): + @pyaedt_function_handler(selections="assignment", pos="offset") + def move(self, assignment, offset, units=None): """Move the selections by the specified ``[x, y]`` coordinates. Parameters ---------- - selections : list + assignment : list List of the selections. - pos : list + offset : list Offset for the ``[x, y]`` axis. units : str Units of the movement. The default is ``meter``. If ``None``, ``schematic_units`` are used. @@ -590,16 +591,16 @@ def move(self, selections, pos, units=None): >>> oEditor.Move """ - sels = self._get_components_selections(selections) + sels = self._get_components_selections(assignment) if not sels: self.logger.error("No Component Found.") return False if units: - x_location = AEDT_UNITS["Length"][units] * float(pos[0]) - y_location = AEDT_UNITS["Length"][units] * float(pos[1]) + x_location = AEDT_UNITS["Length"][units] * float(offset[0]) + y_location = AEDT_UNITS["Length"][units] * float(offset[1]) else: - x_location = AEDT_UNITS["Length"][self.schematic_units] * float(pos[0]) - y_location = AEDT_UNITS["Length"][self.schematic_units] * float(pos[1]) + x_location = AEDT_UNITS["Length"][self.schematic_units] * float(offset[0]) + y_location = AEDT_UNITS["Length"][self.schematic_units] * float(offset[1]) self.oeditor.Move( ["NAME:Selections", "Selections:=", sels], [ @@ -616,13 +617,13 @@ def move(self, selections, pos, units=None): ) return True - @pyaedt_function_handler() - def rotate(self, selections, degrees=90): + @pyaedt_function_handler(selections="assignment") + def rotate(self, assignment, degrees=90): """Rotate the selections by degrees. Parameters ---------- - selections : list + assignment : list List of the selections. degrees : optional Angle rotation in degrees. The default is ``90``. @@ -637,7 +638,7 @@ def rotate(self, selections, degrees=90): >>> oEditor.Rotate """ - sels = self._get_components_selections(selections) + sels = self._get_components_selections(assignment) if not sels: self.logger.error("No Component Found.") return False diff --git a/pyaedt/modules/Boundary.py b/pyaedt/modules/Boundary.py index 56297192319..6df48b98432 100644 --- a/pyaedt/modules/Boundary.py +++ b/pyaedt/modules/Boundary.py @@ -350,8 +350,8 @@ class BoundaryObject(BoundaryCommon, object): >>> from pyaedt import Hfss >>> hfss =Hfss() >>> origin = hfss.modeler.Position(0, 0, 0) - >>> inner = hfss.modeler.create_cylinder(hfss.PLANE.XY, origin, 3, 200, 0, "inner") - >>> inner_id = hfss.modeler.get_obj_id("inner") + >>> inner = hfss.modeler.create_cylinder(hfss.PLANE.XY,origin,3,200,0,"inner") + >>> inner_id = hfss.modeler.get_obj_id("inner",) >>> coat = hfss.assign_coating([inner_id],"copper",use_thickness=True,thickness="0.2mm") """ @@ -875,8 +875,8 @@ class MaxwellParameters(BoundaryCommon, object): >>> from pyaedt import Maxwell2d >>> maxwell_2d = Maxwell2d() - >>> coil1 = maxwell_2d.modeler.create_rectangle([8.5,1.5, 0], [8, 3], True, "Coil_1", "vacuum") - >>> coil2 = maxwell_2d.modeler.create_rectangle([8.5,1.5, 0], [8, 3], True, "Coil_2", "vacuum") + >>> coil1 = maxwell_2d.modeler.create_rectangle([8.5,1.5, 0],[8, 3],True,"Coil_1","vacuum") + >>> coil2 = maxwell_2d.modeler.create_rectangle([8.5,1.5, 0],[8, 3],True,"Coil_2","vacuum") >>> maxwell_2d.assign_matrix(["Coil_1", "Coil_2"]) """ @@ -4046,7 +4046,7 @@ def add_face_node( >>> import pyaedt >>> app = pyaedt.Icepak() >>> network = pyaedt.modules.Boundary.Network(app) - >>> box = app.modeler.create_box([5, 5, 5], [20, 50, 80]) + >>> box = app.modeler.create_box([5, 5, 5],[20, 50, 80]) >>> faces_ids = [face.id for face in box.faces] >>> network.add_face_node(faces_ids[0]) >>> network.add_face_node(faces_ids[1],name="TestNode",thermal_resistance="Compute", @@ -4166,7 +4166,7 @@ def add_nodes_from_dictionaries(self, nodes): >>> import pyaedt >>> app = pyaedt.Icepak() >>> network = pyaedt.modules.Boundary.Network(app) - >>> box = app.modeler.create_box([5, 5, 5], [20, 50, 80]) + >>> box = app.modeler.create_box([5, 5, 5],[20, 50, 80]) >>> faces_ids = [face.id for face in box.faces] >>> nodes_dict = [ >>> {"FaceID": faces_ids[0]}, @@ -4236,7 +4236,7 @@ def add_link(self, node1, node2, value, name=None): >>> import pyaedt >>> app = pyaedt.Icepak() >>> network = pyaedt.modules.Boundary.Network(app) - >>> box = app.modeler.create_box([5, 5, 5], [20, 50, 80]) + >>> box = app.modeler.create_box([5, 5, 5],[20, 50, 80]) >>> faces_ids = [face.id for face in box.faces] >>> connection = {"Name": "LinkTest", "Connection": [faces_ids[1], faces_ids[0]], "Value": "1cel_per_w"} >>> network.add_links_from_dictionaries(connection) @@ -4281,7 +4281,7 @@ def add_links_from_dictionaries(self, connections): >>> import pyaedt >>> app = pyaedt.Icepak() >>> network = pyaedt.modules.Boundary.Network(app) - >>> box = app.modeler.create_box([5, 5, 5], [20, 50, 80]) + >>> box = app.modeler.create_box([5, 5, 5],[20, 50, 80]) >>> faces_ids = [face.id for face in box.faces] >>> [network.add_face_node(faces_ids[i]) for i in range(2)] >>> connection = {"Name": "LinkTest", "Link": [faces_ids[1], faces_ids[0], "1cel_per_w"]} diff --git a/pyaedt/modules/LayerStackup.py b/pyaedt/modules/LayerStackup.py index d823baffe53..244caa484d4 100644 --- a/pyaedt/modules/LayerStackup.py +++ b/pyaedt/modules/LayerStackup.py @@ -1385,17 +1385,17 @@ def layers(self): layers[o.id] = o return layers - @pyaedt_function_handler() + @pyaedt_function_handler(layername="layer", layertype="layer_type") def add_layer( - self, layername, layertype="signal", thickness="0mm", elevation="0mm", material="copper", isnegative=False + self, layer, layer_type="signal", thickness="0mm", elevation="0mm", material="copper", isnegative=False ): """Add a layer. Parameters ---------- - layername : str + layer : str Name of the layer. - layertype : str, optional + layer_type : str, optional Type of the layer. The default is ``"signal"``. thickness : str, optional Thickness with units. The default is ``"0mm"``. @@ -1411,8 +1411,8 @@ def add_layer( :class:`pyaedt.modules.LayerStackup.Layer` Layer object. """ - newlayer = Layer(self, layertype, isnegative) - newlayer.name = layername + newlayer = Layer(self, layer_type, isnegative) + newlayer.name = layer newlayer._thickness = thickness if elevation == "0mm": diff --git a/pyaedt/modules/Material.py b/pyaedt/modules/Material.py index 256be73b51a..0c262427297 100644 --- a/pyaedt/modules/Material.py +++ b/pyaedt/modules/Material.py @@ -2072,7 +2072,7 @@ def get_core_loss_coefficients( >>> from pyaedt import Maxwell3d >>> m3d = Maxwell3d() - >>> box = m3d.modeler.create_box([-10, -10, 0], [20, 20, 20], "box_to_split") + >>> box = m3d.modeler.create_box([-10, -10, 0],[20, 20, 20],"box_to_split") >>> box.material = "magnesium" >>> coefficients = m3d.materials["magnesium"].get_core_loss_coefficients( ... points_list_at_freq={60 : [[0, 0], [1, 3], [2, 7]]}, @@ -2202,7 +2202,7 @@ def set_coreloss_at_frequency( >>> from pyaedt import Maxwell3d >>> m3d = Maxwell3d() - >>> box = m3d.modeler.create_box([-10, -10, 0], [20, 20, 20], "box_to_split") + >>> box = m3d.modeler.create_box([-10, -10, 0],[20, 20, 20],"box_to_split") >>> box.material = "magnesium" >>> m3d.materials["magnesium"].set_coreloss_at_frequency( ... points_list_at_freq={60 : [[0,0], [1,3.5], [2,7.4]]} @@ -2213,7 +2213,7 @@ def set_coreloss_at_frequency( >>> from pyaedt import Maxwell3d >>> m3d = Maxwell3d() - >>> box = m3d.modeler.create_box([-10, -10, 0], [20, 20, 20], "box_to_split") + >>> box = m3d.modeler.create_box([-10, -10, 0],[20, 20, 20],"box_to_split") >>> box.material = "magnesium" >>> m3d.materials["magnesium"].set_coreloss_at_frequency( ... points_list_at_freq={60 : [[0,0], [1,3.5], [2,7.4]], diff --git a/pyaedt/modules/Mesh.py b/pyaedt/modules/Mesh.py index b0902dc8620..02973d31cd1 100644 --- a/pyaedt/modules/Mesh.py +++ b/pyaedt/modules/Mesh.py @@ -324,7 +324,7 @@ class Mesh(object): >>> from pyaedt import Hfss >>> hfss = Hfss() - >>> cylinder = hfss.modeler.create_cylinder(0, [0, 0, 0], 3, 20, 0) + >>> cylinder = hfss.modeler.create_cylinder(0,[0, 0, 0],3,20,0) >>> model_resolution = hfss.mesh.assign_model_resolution(cylinder,1e-4,"ModelRes1") """ @@ -359,7 +359,7 @@ def __getitem__(self, part_id): >>> from pyaedt import Hfss >>> hfss = Hfss() - >>> cylinder = hfss.modeler.create_cylinder(0, [0, 0, 0], 3, 20, 0) + >>> cylinder = hfss.modeler.create_cylinder(0,[0, 0, 0],3,20,0) >>> mr1 = hfss.mesh.assign_model_resolution(cylinder,1e-4,"ModelRes1") >>> mr2 = hfss.mesh[mr1.name] """ @@ -385,7 +385,7 @@ def meshoperations(self): >>> from pyaedt import Hfss >>> hfss = Hfss() - >>> o = hfss.modeler.create_cylinder(0, [0, 0, 0], 3, 20, 0) + >>> o = hfss.modeler.create_cylinder(0,[0, 0, 0],3,20,0) >>> mr1 = hfss.mesh.assign_model_resolution(o,1e-4,"ModelRes1") >>> mesh_operations_list = hfss.mesh.meshoperations """ @@ -415,7 +415,7 @@ def meshoperation_names(self): >>> from pyaedt import Hfss >>> hfss = Hfss() - >>> o = hfss.modeler.create_cylinder(0, [0, 0, 0], 3, 20, 0) + >>> o = hfss.modeler.create_cylinder(0,[0, 0, 0],3,20,0) >>> mr1 = hfss.mesh.assign_model_resolution(o,1e-4,"ModelRes1") >>> mr2 = hfss.mesh.assign_model_resolution(o,1e-2,"ModelRes2") >>> mesh_operations_names = hfss.mesh.meshoperation_names @@ -565,7 +565,7 @@ def assign_surface_mesh(self, assignment, level, name=None): >>> from pyaedt import Hfss >>> hfss = Hfss() - >>> o = hfss.modeler.create_cylinder(0, [0, 0, 0], 3, 20, 0) + >>> o = hfss.modeler.create_cylinder(0,[0, 0, 0],3,20,0) >>> surface = hfss.mesh.assign_surface_mesh(o.id,3,"Surface") """ assignment = self.modeler.convert_to_selections(assignment, True) @@ -630,7 +630,7 @@ def assign_surface_mesh_manual( >>> from pyaedt import Hfss >>> hfss = Hfss() - >>> o = hfss.modeler.create_cylinder(0, [0, 0, 0], 3, 20, 0) + >>> o = hfss.modeler.create_cylinder(0,[0, 0, 0],3,20,0) >>> surface = hfss.mesh.assign_surface_mesh_manual(o.id,1e-6,aspect_ratio=3,name="Surface_Manual") """ assignment = self.modeler.convert_to_selections(assignment, True) @@ -707,7 +707,7 @@ def assign_model_resolution(self, assignment, defeature_length=None, name=None): >>> from pyaedt import Hfss >>> hfss = Hfss() - >>> o = hfss.modeler.create_cylinder(0, [0, 0, 0], 3, 20, 0) + >>> o = hfss.modeler.create_cylinder(0,[0, 0, 0],3,20,0) >>> surface = hfss.mesh.assign_model_resolution(o,1e-4,"ModelRes1") """ assignment = self.modeler.convert_to_selections(assignment, True) diff --git a/pyaedt/modules/monitor_icepak.py b/pyaedt/modules/monitor_icepak.py index 43c4ae2320e..4e3438d5b0d 100644 --- a/pyaedt/modules/monitor_icepak.py +++ b/pyaedt/modules/monitor_icepak.py @@ -391,8 +391,7 @@ def assign_surface_monitor(self, surface_name, monitor_quantity="Temperature", m Create a rectangle named ``"Surface1"`` and assign a temperature monitor to that surface. - >>> surface = icepak.modeler.create_rectangle(icepak.PLANE.XY, - ... [0, 0, 0], [10, 20], name="Surface1") + >>> surface = icepak.modeler.create_rectangle(icepak.PLANE.XY,[0, 0, 0],[10, 20],name="Surface1") >>> icepak.assign_surface_monitor("Surface1", monitor_name="monitor") 'monitor' """ @@ -495,7 +494,7 @@ def assign_point_monitor_in_object(self, name, monitor_quantity="Temperature", m Create a box named ``"BlockBox1"`` and assign a temperature monitor point to that object. - >>> box = icepak.modeler.create_box([1, 1, 1], [3, 3, 3], "BlockBox1", "copper") + >>> box = icepak.modeler.create_box([1, 1, 1],[3, 3, 3],"BlockBox1","copper") >>> icepak.assign_point_monitor(box.name, monitor_name="monitor2") "'monitor2' """ diff --git a/pyaedt/q3d.py b/pyaedt/q3d.py index ba919aa1172..b8c2a85e7b0 100644 --- a/pyaedt/q3d.py +++ b/pyaedt/q3d.py @@ -887,7 +887,7 @@ def export_equivalent_circuit( -------- >>> from pyaedt import Q3d >>> aedtapp = Q3d() - >>> box = aedtapp.modeler.create_box([30, 30, 30], [10, 10, 10], name="mybox") + >>> box = aedtapp.modeler.create_box([30, 30, 30],[10, 10, 10],name="mybox") >>> net = aedtapp.assign_net(box, "my_net") >>> source = aedtapp.assign_source_to_objectface(box.bottom_face_z.id, axisdir=0, ... source_name="Source1", net_name=net.name) @@ -1486,7 +1486,7 @@ def assign_net(self, objects, net_name=None, net_type="Signal"): -------- >>> from pyaedt import Q3d >>> q3d = Q3d() - >>> box = q3d.modeler.create_box([30, 30, 30], [10, 10, 10], name="mybox") + >>> box = q3d.modeler.create_box([30, 30, 30],[10, 10, 10],name="mybox") >>> net_name = "my_net" >>> net = q3d.assign_net(box, net_name) """ @@ -2140,20 +2140,20 @@ def __init__( def _init_from_design(self, *args, **kwargs): self.__init__(*args, **kwargs) - @pyaedt_function_handler() - def create_rectangle(self, position, dimension_list, name="", matname=""): + @pyaedt_function_handler(position="origin", dimension_list="sizes", matname="material") + def create_rectangle(self, origin, sizes, name="", material=""): """Create a rectangle. Parameters ---------- - position : list + origin : list List of ``[x, y]`` coordinates for the starting point of the rectangle. - dimension_list : list + sizes : list List of ``[width, height]`` dimensions. name : str, optional Name of the rectangle. The default is ``None``, in which case the default name is assigned. - matname : str, optional + material : str, optional Name of the material. The default is ``None``, in which case the default material is used. @@ -2167,7 +2167,7 @@ def create_rectangle(self, position, dimension_list, name="", matname=""): >>> oEditor.CreateRectangle """ - return self.modeler.create_rectangle(position, dimension_list=dimension_list, name=name, matname=matname) + return self.modeler.create_rectangle(origin=origin, sizes=sizes, name=name, material=material) @pyaedt_function_handler() def assign_single_signal_line(self, target_objects, name="", solve_option="SolveInside", thickness=None, unit="um"):