diff --git a/_unittest/test_02_3D_modeler.py b/_unittest/test_02_3D_modeler.py index e9e4ef510ec..b895b3293b0 100644 --- a/_unittest/test_02_3D_modeler.py +++ b/_unittest/test_02_3D_modeler.py @@ -1036,7 +1036,7 @@ def test_59a_region_property(self): self.aedtapp.modeler.create_coordinate_system( origin=[1, 1, 1], name=cs_name, mode="zxz", phi=10, theta=30, psi=50 ) - assert self.aedtapp.modeler.change_region_coordinate_system(region_cs=cs_name) + assert self.aedtapp.modeler.change_region_coordinate_system(assignment=cs_name) assert self.aedtapp.modeler.change_region_padding("10mm", padding_type="Absolute Offset", direction="-X") assert self.aedtapp.modeler.change_region_padding( ["1mm", "-2mm", "3mm", "-4mm", "5mm", "-6mm"], @@ -1052,7 +1052,7 @@ def test_59a_region_property(self): def test_59b_region_property_failing(self): self.aedtapp.modeler.create_air_region() - assert not self.aedtapp.modeler.change_region_coordinate_system(region_cs="NoCS") + assert not self.aedtapp.modeler.change_region_coordinate_system(assignment="NoCS") assert not self.aedtapp.modeler.change_region_padding( "10mm", padding_type="Absolute Offset", direction="-X", region_name="NoRegion" ) diff --git a/_unittest/test_07_Object3D.py b/_unittest/test_07_Object3D.py index 1fe9aada249..0cfed4d96d5 100644 --- a/_unittest/test_07_Object3D.py +++ b/_unittest/test_07_Object3D.py @@ -310,7 +310,9 @@ def test_10_chamfer(self): assert test test = initial_object.edges[4].chamfer(chamfer_type=4) assert not test - self.aedtapp.modeler.delete(initial_object) + self.aedtapp.modeler.delete( + initial_object, + ) initial_object = self.aedtapp.modeler.create_box([0, 0, 0], [10, 10, 5], "ChamferTest2", "Copper") assert initial_object.chamfer(edges=initial_object.faces[0].edges[0], chamfer_type=3) initial_object = self.aedtapp.modeler.create_box([0, 0, 0], [10, 10, 5], "ChamferTest3", "Copper") @@ -325,7 +327,9 @@ def test_11_fillet(self): test = initial_object.edges[0].fillet(radius=0.2) assert test test = initial_object.edges[1].fillet(radius=0.2, setback=0.1) - self.aedtapp.modeler.delete(initial_object) + self.aedtapp.modeler.delete( + initial_object, + ) def test_object_length(self): initial_object = self.aedtapp.modeler.create_box([0, 0, 0], [10, 10, 5], "FilletTest", "Copper") @@ -338,7 +342,9 @@ def test_object_length(self): for i in range(0, 3): sum_sq += (end_point.position[i] - start_point.position[i]) ** 2 assert isclose(math.sqrt(sum_sq), test_edge.length) - self.aedtapp.modeler.delete(initial_object) + self.aedtapp.modeler.delete( + initial_object, + ) def test_12_set_color(self): initial_object = self.aedtapp.modeler.create_box([0, 0, 0], [10, 10, 5], "ColorTest") @@ -365,7 +371,9 @@ def test_12_set_color(self): initial_object.color = (255, "Invalid", 0) assert initial_object.color == (255, 0, 0) - self.aedtapp.modeler.delete("ColorTest") + self.aedtapp.modeler.delete( + "ColorTest", + ) def test_print_object(self): o = self.create_copper_box() @@ -576,7 +584,9 @@ def test_26_unclassified_object(self): def test_26a_delete_unclassified_object(self): unclassified = self.aedtapp.modeler.unclassified_objects - assert self.aedtapp.modeler.delete(unclassified) + assert self.aedtapp.modeler.delete( + unclassified, + ) assert len(self.aedtapp.modeler.unclassified_objects) != unclassified assert len(self.aedtapp.modeler.unclassified_objects) == 0 diff --git a/_unittest/test_08_Primitives3D.py b/_unittest/test_08_Primitives3D.py index 9e02ec494ed..0e024b1a3e1 100644 --- a/_unittest/test_08_Primitives3D.py +++ b/_unittest/test_08_Primitives3D.py @@ -166,10 +166,14 @@ def create_polylines(self, name=None): test_points = [[0, 100, 0], [-100, 0, 0], [-50, -50, 0], [0, 0, 0]] if self.aedtapp.modeler[name + "segmented"]: - self.aedtapp.modeler.delete(name + "segmented") + self.aedtapp.modeler.delete( + name + "segmented", + ) if self.aedtapp.modeler[name + "compound"]: - self.aedtapp.modeler.delete(name + "compound") + self.aedtapp.modeler.delete( + name + "compound", + ) p1 = self.aedtapp.modeler.create_polyline(points=test_points, name=name + "segmented") p2 = self.aedtapp.modeler.create_polyline( @@ -590,7 +594,9 @@ def test_30_get_faces_from_position(self): def test_31_delete_object(self): self.create_rectangle(name="MyRectangle") assert "MyRectangle" in self.aedtapp.modeler.object_names - deleted = self.aedtapp.modeler.delete("MyRectangle") + deleted = self.aedtapp.modeler.delete( + "MyRectangle", + ) assert deleted assert "MyRectangle" not in self.aedtapp.modeler.object_names @@ -1215,38 +1221,35 @@ def test_64_create_3dcomponent(self): mr1 = self.aedtapp.mesh.assign_length_mesh([box1.name, box2.name]) assert self.aedtapp.modeler.create_3dcomponent( self.component3d_file, - object_list=["Solid", new_obj[1][0], box1.name, box2.name], - boundaries_list=[rad.name], - excitation_list=[exc.name], - included_cs="Global", variables_to_include=["test_variable"], + assignment=["Solid", new_obj[1][0], box1.name, box2.name], + boundaries=[rad.name], + excitations=[exc.name], + coordinate_systems="Global", ) assert os.path.exists(self.component3d_file) def test_64_create_3d_component_encrypted(self): assert self.aedtapp.modeler.create_3dcomponent( - self.component3d_file, - included_cs="Global", - is_encrypted=True, - password="password_test", + self.component3d_file, coordinate_systems="Global", is_encrypted=True, password="password_test" ) assert self.aedtapp.modeler.create_3dcomponent( self.component3d_file, - included_cs="Global", + coordinate_systems="Global", is_encrypted=True, password="password_test", hide_contents=["Solid"], ) assert not self.aedtapp.modeler.create_3dcomponent( self.component3d_file, - included_cs="Global", + coordinate_systems="Global", is_encrypted=True, password="password_test", password_type="Invalid", ) assert not self.aedtapp.modeler.create_3dcomponent( self.component3d_file, - included_cs="Global", + coordinate_systems="Global", is_encrypted=True, password="password_test", component_outline="Invalid", @@ -1799,15 +1802,11 @@ def test_84_replace_3d_component(self): box2 = self.aedtapp.modeler.create_box([0, 0, 0], ["test_variable", 100, 30]) mr1 = self.aedtapp.mesh.assign_length_mesh([box1.name, box2.name]) obj_3dcomp = self.aedtapp.modeler.replace_3dcomponent( - object_list=[box1.name], - variables_to_include=["test_variable"], + variables_to_include=["test_variable"], assignment=[box1.name] ) assert isinstance(obj_3dcomp, UserDefinedComponent) - self.aedtapp.modeler.replace_3dcomponent( - component_name="new_comp", - object_list=[box2.name], - ) + self.aedtapp.modeler.replace_3dcomponent(name="new_comp", assignment=[box2.name]) assert len(self.aedtapp.modeler.user_defined_components) == 2 @pytest.mark.skipif(config["desktopVersion"] < "2023.1", reason="Method available in beta from 2023.1") @@ -1853,13 +1852,9 @@ def test_85_insert_layout_component(self): def test_87_set_mesh_fusion_settings(self): self.aedtapp.insert_design("MeshFusionSettings") box1 = self.aedtapp.modeler.create_box([0, 0, 0], [10, 20, 30]) - obj_3dcomp = self.aedtapp.modeler.replace_3dcomponent( - object_list=[box1.name], - ) + obj_3dcomp = self.aedtapp.modeler.replace_3dcomponent(assignment=[box1.name]) box2 = self.aedtapp.modeler.create_box([0, 0, 0], [100, 20, 30]) - obj2_3dcomp = self.aedtapp.modeler.replace_3dcomponent( - object_list=[box2.name], - ) + obj2_3dcomp = self.aedtapp.modeler.replace_3dcomponent(assignment=[box2.name]) assert self.aedtapp.set_mesh_fusion_settings(assignment=obj2_3dcomp.name, volume_padding=None, priority=None) assert self.aedtapp.set_mesh_fusion_settings( diff --git a/_unittest/test_09_Primitives2D.py b/_unittest/test_09_Primitives2D.py index b688ede2849..92ace8bb9a7 100644 --- a/_unittest/test_09_Primitives2D.py +++ b/_unittest/test_09_Primitives2D.py @@ -104,7 +104,9 @@ def test_fillet_vertex(self): def test_06_create_region(self): if self.aedtapp.modeler["Region"]: - self.aedtapp.modeler.delete("Region") + self.aedtapp.modeler.delete( + "Region", + ) assert "Region" not in self.aedtapp.modeler.object_names assert self.aedtapp.modeler.create_region([20, "50", "100mm", 20], "Absolute Offset") self.aedtapp.modeler["Region"].delete() @@ -126,7 +128,9 @@ def test_06_create_region(self): def test_06_a_create_region_Z(self): if self.axisymmetrical.modeler["Region"]: - self.axisymmetrical.modeler.delete("Region") + self.axisymmetrical.modeler.delete( + "Region", + ) assert "Region" not in self.axisymmetrical.modeler.object_names assert not self.axisymmetrical.modeler.create_region(["100%", "50%", "20%"]) assert self.axisymmetrical.modeler.create_region([100, 50, 20]) @@ -154,7 +158,9 @@ def test_07_assign_material(self, material="steel_stainless"): def test_08_region(self, q2d_app): if q2d_app.modeler["Region"]: - q2d_app.modeler.delete("Region") + q2d_app.modeler.delete( + "Region", + ) assert "Region" not in q2d_app.modeler.object_names assert not q2d_app.modeler.create_region(["100%", "50%", "20%", "10%"]) assert q2d_app.modeler.create_region([100, 50, 20, 20]) diff --git a/_unittest/test_11_Setup.py b/_unittest/test_11_Setup.py index 5ac553f8e5f..5e8fbf18c8c 100644 --- a/_unittest/test_11_Setup.py +++ b/_unittest/test_11_Setup.py @@ -252,7 +252,7 @@ def test_27_create_doe(self): setup2 = self.aedtapp.optimizations.add( calculation, ranges={"Freq": "2.5GHz"}, - optim_type="DXDOE", + optimization_type="DXDOE", solution="{} : {}".format(new_setup.name, sweep.name), ) assert setup2.add_variation("w1", 0.1, 10) @@ -279,7 +279,7 @@ def test_28A_create_optislang(self): calculation=None, ranges=None, variables=None, - optim_type="optiSLang", + optimization_type="optiSLang", solution="{} : {}".format(new_setup.name, sweep.name), ) assert setup1.add_variation("w1", 1, 10, 51) @@ -287,7 +287,7 @@ def test_28A_create_optislang(self): calculation=None, ranges=None, variables={"w1": "1mm", "w2": "2mm"}, - optim_type="optiSLang", + optimization_type="optiSLang", solution="{} : {}".format(new_setup.name, sweep.name), ) assert setup2.add_variation("a1", 1, 10, 51) @@ -305,7 +305,7 @@ def test_28B_create_dx(self): None, ranges=None, variables=None, - optim_type="DesignExplorer", + optimization_type="DesignExplorer", solution="{} : {}".format(new_setup.name, sweep.name), ) assert setup1.add_variation("w1", 5, 10, 51) @@ -313,7 +313,7 @@ def test_28B_create_dx(self): None, ranges=None, variables={"w1": "1mm", "w2": "2mm"}, - optim_type="DesignExplorer", + optimization_type="DesignExplorer", solution="{} : {}".format(new_setup.name, sweep.name), ) assert setup2.add_variation("a1", 1, 10, 51) @@ -330,7 +330,7 @@ def test_29_create_sensitivity(self): setup2 = self.aedtapp.optimizations.add( calculation, ranges={"Freq": "2.5GHz"}, - optim_type="Sensitivity", + optimization_type="Sensitivity", solution="{} : {}".format(new_setup.name, sweep.name), ) assert setup2.add_variation("w1", 0.1, 10, 3.2) @@ -347,7 +347,7 @@ def test_29_create_statistical(self): setup2 = self.aedtapp.optimizations.add( calculation, ranges={"Freq": "2.5GHz"}, - optim_type="Statistical", + optimization_type="Statistical", solution="{} : {}".format(new_setup.name, sweep.name), ) assert setup2.add_variation("w1", 0.1, 10, 0.3) diff --git a/_unittest/test_28_Maxwell3D.py b/_unittest/test_28_Maxwell3D.py index f018e40a600..9cb02156b5e 100644 --- a/_unittest/test_28_Maxwell3D.py +++ b/_unittest/test_28_Maxwell3D.py @@ -922,7 +922,7 @@ def test_50_objects_segmentation(self, cyl_gap): segments_number = 5 object_name = "PM_I1" sheets = cyl_gap.modeler.objects_segmentation( - object_name, segments_number=segments_number, apply_mesh_sheets=True + assignment=object_name, segments=segments_number, apply_mesh_sheets=True ) assert isinstance(sheets, tuple) assert isinstance(sheets[0], dict) @@ -934,7 +934,7 @@ def test_50_objects_segmentation(self, cyl_gap): object_name = "PM_I1_1" magnet_id = [obj.id for obj in cyl_gap.modeler.object_list if obj.name == object_name][0] sheets = cyl_gap.modeler.objects_segmentation( - magnet_id, segments_number=segments_number, apply_mesh_sheets=True, mesh_sheets_number=mesh_sheets_number + magnet_id, segments=segments_number, apply_mesh_sheets=True, mesh_sheets=mesh_sheets_number ) assert isinstance(sheets, tuple) assert isinstance(sheets[0][object_name], list) @@ -953,11 +953,11 @@ def test_50_objects_segmentation(self, cyl_gap): assert len(sheets[0][object_name]) == segments_number - 1 assert not cyl_gap.modeler.objects_segmentation(object_name) assert not cyl_gap.modeler.objects_segmentation( - object_name, segments_number=segments_number, segmentation_thickness=segmentation_thickness + object_name, segmentation_thickness=segmentation_thickness, segments=segments_number ) object_name = "PM_O1_1" segments_number = 10 - sheets = cyl_gap.modeler.objects_segmentation(object_name, segments_number=segments_number) + sheets = cyl_gap.modeler.objects_segmentation(object_name, segments=segments_number) assert isinstance(sheets, dict) assert isinstance(sheets[object_name], list) assert len(sheets[object_name]) == segments_number - 1 diff --git a/_unittest/test_98_Icepak.py b/_unittest/test_98_Icepak.py index 203bc47562e..d90763447ae 100644 --- a/_unittest/test_98_Icepak.py +++ b/_unittest/test_98_Icepak.py @@ -851,9 +851,9 @@ def test_50_advanced3dcomp_export(self): ) assert self.aedtapp.modeler.create_3dcomponent( os.path.join(file_path, file_name), - component_name="board_assembly", - included_cs=["Global"], - auxiliary_dict=True, + name="board_assembly", + coordinate_systems=["Global"], + export_auxiliary=True, ) self.aedtapp.create_dataset( "test_ignore", @@ -873,10 +873,10 @@ def test_50_advanced3dcomp_export(self): self.aedtapp.modeler.create_coordinate_system() assert self.aedtapp.modeler.create_3dcomponent( os.path.join(file_path, file_name), - component_name="board_assembly", - included_cs=cs_list, - auxiliary_dict=True, - reference_cs="CS1", + name="board_assembly", + coordinate_systems=cs_list, + reference_coordinate_systems="CS1", + export_auxiliary=True, monitor_objects=mon_list, datasets=["test_dataset"], ) @@ -950,10 +950,10 @@ def test_51_advanced3dcomp_import(self): self.aedtapp.modeler.create_coordinate_system() assert self.aedtapp.modeler.create_3dcomponent( os.path.join(file_path, file_name), - component_name="board_assembly", - included_cs=cs_list, - auxiliary_dict=True, - reference_cs="CS1", + name="board_assembly", + coordinate_systems=cs_list, + reference_coordinate_systems="CS1", + export_auxiliary=True, monitor_objects=mon_list, datasets=["test_dataset"], ) diff --git a/examples/01-Modeling-Setup/Optimetrics.py b/examples/01-Modeling-Setup/Optimetrics.py index 3ed3a177148..cb8de89dd4d 100644 --- a/examples/01-Modeling-Setup/Optimetrics.py +++ b/examples/01-Modeling-Setup/Optimetrics.py @@ -100,7 +100,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create an optimetrics sensitivity analysis with output calculations. -sweep2 = hfss.optimizations.add(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optim_type="Sensitivity") +sweep2 = hfss.optimizations.add(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optimization_type="Sensitivity") sweep2.add_variation("w1", 0.1, 3, 0.5) sweep2.add_calculation(calculation="dB(S(1,1))", ranges={"Freq": "2.6GHz"}) @@ -124,7 +124,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create a DX (DesignXplorer) optimization based on a goal and a calculation. -sweep4 = hfss.optimizations.add(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optim_type="DesignExplorer") +sweep4 = hfss.optimizations.add(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optimization_type="DesignExplorer") sweep4.add_goal(calculation="dB(S(1,1))", ranges={"Freq": "2.6GHz"}) ############################################################################### @@ -132,7 +132,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create a DOE (Design of Experiments) based on a goal and a calculation. -sweep5 = hfss.optimizations.add(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optim_type="DXDOE") +sweep5 = hfss.optimizations.add(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optimization_type="DXDOE") ############################################################################### # Create DOE based on a goal and calculation @@ -142,12 +142,9 @@ region = hfss.modeler.create_region() hfss.assign_radiation_boundary_to_objects(region) hfss.insert_infinite_sphere(name="Infinite_1") -sweep6 = hfss.optimizations.add( - calculation="RealizedGainTotal", - solution=hfss.nominal_adaptive, - ranges={"Freq": "5GHz", "Theta": ["0deg", "10deg", "20deg"], "Phi": "0deg"}, - context="Infinite_1", -) +sweep6 = hfss.optimizations.add(calculation="RealizedGainTotal", + ranges={"Freq": "5GHz", "Theta": ["0deg", "10deg", "20deg"], "Phi": "0deg"}, + solution=hfss.nominal_adaptive, context="Infinite_1") ############################################################################### # Close AEDT diff --git a/examples/03-Maxwell/Maxwell2D_DCConduction.py b/examples/03-Maxwell/Maxwell2D_DCConduction.py index 7a693c8f97f..b24b7a8fe7b 100644 --- a/examples/03-Maxwell/Maxwell2D_DCConduction.py +++ b/examples/03-Maxwell/Maxwell2D_DCConduction.py @@ -122,9 +122,7 @@ # Create parametric sweep to sweep all the entries in the material array. # Save fields and mesh and use the mesh for all the materials. -param_sweep = m2d.parametrics.add( - "MaterialIndex", 0, no_materials-1, 1, "LinearStep", - parametricname="MaterialSweep") +param_sweep = m2d.parametrics.add("MaterialIndex", 0, no_materials - 1, 1, "LinearStep", name="MaterialSweep") param_sweep["SaveFields"] = True param_sweep["CopyMesh"] = True param_sweep["SolveWithCopiedMeshOnly"] = True diff --git a/examples/03-Maxwell/Maxwell3D_Segmentation.py b/examples/03-Maxwell/Maxwell3D_Segmentation.py index fa38433ff52..9886ca2e1f8 100644 --- a/examples/03-Maxwell/Maxwell3D_Segmentation.py +++ b/examples/03-Maxwell/Maxwell3D_Segmentation.py @@ -72,7 +72,7 @@ segments_number = 5 object_name = "PM_I1" -sheets_1 = modeler.objects_segmentation(object_name, segments_number=segments_number, apply_mesh_sheets=True) +sheets_1 = modeler.objects_segmentation(object_name, segments=segments_number, apply_mesh_sheets=True) ################################################################################## # Segment second magnet by specifying the number of segments @@ -83,7 +83,7 @@ segments_number = 4 object_name = "PM_I1_1" magnet_id = [obj.id for obj in modeler.object_list if obj.name == object_name][0] -sheets_2 = modeler.objects_segmentation(magnet_id, segments_number=segments_number, apply_mesh_sheets=True) +sheets_2 = modeler.objects_segmentation(magnet_id, segments=segments_number, apply_mesh_sheets=True) ################################################################################## # Segment third magnet by specifying the segmentation thickness @@ -104,7 +104,7 @@ object_name = "PM_O1_1" segments_number = 10 -sheets_4 = modeler.objects_segmentation(object_name, segments_number=segments_number) +sheets_4 = modeler.objects_segmentation(object_name, segments=segments_number) ################################################################################### # Save project and close AEDT diff --git a/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py b/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py index 1b1d485e9cc..009908b7aca 100644 --- a/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py +++ b/examples/03-Maxwell/Maxwell3D_Team3_bath_plate.py @@ -158,7 +158,7 @@ # Add a linear parametric sweep for the two coil positions. sweep_name = "CoilSweep" -param = m3d.parametrics.add("Coil_Position", -20, 0, 20, "LinearStep", parametricname=sweep_name) +param = m3d.parametrics.add("Coil_Position", -20, 0, 20, "LinearStep", name=sweep_name) param["SaveFields"] = True param["CopyMesh"] = False param["SolveWithCopiedMeshOnly"] = True diff --git a/examples/04-Icepak/Icepak_3DComponents_Example.py b/examples/04-Icepak/Icepak_3DComponents_Example.py index fecf8aec461..a8513e27d2b 100644 --- a/examples/04-Icepak/Icepak_3DComponents_Example.py +++ b/examples/04-Icepak/Icepak_3DComponents_Example.py @@ -83,11 +83,8 @@ # Export the heatsink 3D component and close project. auxiliary_dict is set to true in order to export the # monitor objects along with the .a3dcomp file. os.mkdir(os.path.join(temp_folder, "componentLibrary")) -ipk.modeler.create_3dcomponent( - os.path.join(temp_folder, "componentLibrary", "Heatsink.a3dcomp"), - component_name="Heatsink", - auxiliary_dict=True -) +ipk.modeler.create_3dcomponent(os.path.join(temp_folder, "componentLibrary", "Heatsink.a3dcomp"), name="Heatsink", + export_auxiliary=True) ipk.close_project(save=False) ############################################################################### @@ -125,12 +122,8 @@ # Export the QFP 3D component and close project. Here the auxiliary dictionary allows exporting not only the monitor # objects but also the dataset used for the power source assignment. -ipk.modeler.create_3dcomponent( - os.path.join(temp_folder, "componentLibrary", "QFP.a3dcomp"), - component_name="QFP", - auxiliary_dict=True, - datasets=["PowerDissipationDataset"] -) +ipk.modeler.create_3dcomponent(os.path.join(temp_folder, "componentLibrary", "QFP.a3dcomp"), name="QFP", + export_auxiliary=True, datasets=["PowerDissipationDataset"]) ipk.release_desktop(False, False) ############################################################################### @@ -175,13 +168,9 @@ # components are not natively supported. Then it is possible to export the whole package as 3d component. Here the # auxiliary dictionary is needed to export monitor objects, datasets and native components. ipk.flatten_3d_components() -ipk.modeler.create_3dcomponent( - component_file=os.path.join(temp_folder, "componentLibrary", "PCBAssembly.a3dcomp"), - component_name="PCBAssembly", - auxiliary_dict=True, - included_cs=["Global", "HeatsinkCS", "PCB_Assembly"], - reference_cs="PCB_Assembly" -) +ipk.modeler.create_3dcomponent(input_file=os.path.join(temp_folder, "componentLibrary", "PCBAssembly.a3dcomp"), + name="PCBAssembly", coordinate_systems=["Global", "HeatsinkCS", "PCB_Assembly"], + reference_coordinate_systems="PCB_Assembly", export_auxiliary=True) ############################################################################### # Release AEDT diff --git a/examples/05-Q3D/Q2D_Example_Stripline.py b/examples/05-Q3D/Q2D_Example_Stripline.py index 9b5abf112a4..767a8f01985 100644 --- a/examples/05-Q3D/Q2D_Example_Stripline.py +++ b/examples/05-Q3D/Q2D_Example_Stripline.py @@ -212,9 +212,8 @@ a.plot(snapshot_path=os.path.join(q.working_directory, "plot.jpg")) # Save plot as jpg # Add a parametric sweep and analyze. -parametric = q.parametrics.add(sweep_var="sig_bot_w", start_point=75, end_point=100, step=5, - variation_type="LinearStep") -parametric.add_variation(sweep_var="sig_gap", start_point="100um", end_point="200um", step=5, +parametric = q.parametrics.add(variable="sig_bot_w", start_point=75, end_point=100, step=5, variation_type="LinearStep") +parametric.add_variation(sweep_variable="sig_gap", start_point="100um", end_point="200um", step=5, variation_type="LinearCount") q.analyze_setup(name=parametric.name) diff --git a/pyaedt/hfss.py b/pyaedt/hfss.py index 40590f4131b..25b114687af 100644 --- a/pyaedt/hfss.py +++ b/pyaedt/hfss.py @@ -4432,9 +4432,7 @@ def _create_sbr_doppler_sweep(self, setup, time_var, tstart, tstop, tsweep, para time_sweep = self.modeler._arg_with_dim(tsweep, "s") time_stop = self.modeler._arg_with_dim(tstop, "s") sweep_range = "LIN {} {} {}".format(time_start, time_stop, time_sweep) - return self.parametrics.add( - time_var, tstart, time_stop, tsweep, "LinearStep", setup, parametricname=parametric_name - ) + return self.parametrics.add(time_var, tstart, time_stop, tsweep, "LinearStep", setup, name=parametric_name) @pyaedt_function_handler(time_var="time_variable", setup_name="setup") def create_sbr_chirp_i_doppler_setup( diff --git a/pyaedt/modeler/modeler3d.py b/pyaedt/modeler/modeler3d.py index 791e8ae0c1a..e2130975f95 100644 --- a/pyaedt/modeler/modeler3d.py +++ b/pyaedt/modeler/modeler3d.py @@ -81,17 +81,26 @@ def primitives(self): warnings.warn(mess, DeprecationWarning) return self - @pyaedt_function_handler() + @pyaedt_function_handler( + component_file="input_file", + component_name="name", + object_list="assignment", + boundaries_list="boundaries", + excitation_list="excitations", + included_cs="coordinate_systems", + reference_cs="reference_coordinate_systems", + auxiliary_dict="export_auxiliary", + ) def create_3dcomponent( self, - component_file, - component_name=None, + input_file, + name=None, variables_to_include=None, - object_list=None, - boundaries_list=None, - excitation_list=None, - included_cs=None, - reference_cs="Global", + assignment=None, + boundaries=None, + excitations=None, + coordinate_systems=None, + reference_coordinate_systems="Global", is_encrypted=False, allow_edit=False, security_message="", @@ -101,7 +110,7 @@ def create_3dcomponent( hide_contents=False, replace_names=False, component_outline="BoundingBox", - auxiliary_dict=False, + export_auxiliary=False, monitor_objects=None, datasets=None, native_components=None, @@ -111,21 +120,21 @@ def create_3dcomponent( Parameters ---------- - component_file : str + input_file : str Full path to the A3DCOMP file. - component_name : str, optional + name : str, optional Name of the component. The default is ``None``. variables_to_include : list, optional List of variables to include. The default is all variables. - object_list : list, optional + assignment : list, optional List of object names to export. The default is all object names. - boundaries_list : list, optional + boundaries : list, optional List of Boundaries names to export. The default is all boundaries. - excitation_list : list, optional + excitations : list, optional List of Excitation names to export. The default is all excitations. - included_cs : list, optional + coordinate_systems : list, optional List of Coordinate Systems to export. The default is the ``reference_cs``. - reference_cs : str, optional + reference_coordinate_systems : str, optional The Coordinate System reference. The default is ``"Global"``. is_encrypted : bool, optional Whether the component has encrypted protection. The default is ``False``. @@ -153,7 +162,7 @@ def create_3dcomponent( component_outline : str, optional Component outline. Value can either be ``BoundingBox`` or ``None``. The default is ``BoundingBox``. - auxiliary_dict : bool or str, optional + export_auxiliary : bool or str, optional Whether to export the auxiliary file containing information about defined datasets and Icepak monitor objects. A destination file can be specified using a string. @@ -182,8 +191,8 @@ def create_3dcomponent( ---------- >>> oEditor.Create3DComponent """ - if not component_name: - component_name = self._app.design_name + if not name: + name = self._app.design_name dt_string = datetime.datetime.now().strftime("%H:%M:%S %p %b %d, %Y") if password_type not in ["UserSuppliedPassword", "InternalPassword"]: return False @@ -198,7 +207,7 @@ def create_3dcomponent( arg = [ "NAME:CreateData", "ComponentName:=", - component_name, + name, "Company:=", "", "Company URL:=", @@ -240,12 +249,12 @@ def create_3dcomponent( "ComponentOutline:=", component_outline, ] - if object_list: - objs = object_list + if assignment: + objs = assignment else: native_objs = [obj.name for _, v in self.user_defined_components.items() for _, obj in v.parts.items()] objs = [obj for obj in self.object_names if obj not in native_objs] - if not native_components and native_objs and not auxiliary_dict: + if not native_components and native_objs and not export_auxiliary: self.logger.warning( "Native component objects cannot be exported. Use native_components argument to" " export an auxiliary dictionary file containing 3D components information" @@ -259,12 +268,12 @@ def create_3dcomponent( arg.append([]) else: arg.append(hide_contents) - if included_cs: - allcs = included_cs + if coordinate_systems: + allcs = coordinate_systems else: allcs = self.oeditor.GetCoordinateSystems() arg.append("IncludedCS:="), arg.append(allcs) - arg.append("ReferenceCS:="), arg.append(reference_cs) + arg.append("ReferenceCS:="), arg.append(reference_coordinate_systems) par_description = [] variables = [] dependent_variables = [] @@ -296,8 +305,8 @@ def create_3dcomponent( arg.append("VendorComponentIdentifier:="), arg.append("") arg.append("PublicKeyFile:="), arg.append("") arg2 = ["NAME:DesignData"] - if boundaries_list is not None: - boundaries = boundaries_list + if boundaries is not None: + boundaries = boundaries else: boundaries = self.get_boundaries_name() arg2.append("Boundaries:="), arg2.append(boundaries) @@ -310,8 +319,8 @@ def create_3dcomponent( if meshregions: arg2.append("MeshRegions:="), arg2.append(meshregions) else: - if excitation_list is not None: - excitations = excitation_list + if excitations is not None: + excitations = excitations else: excitations = self._app.excitations if self._app.design_type == "HFSS": @@ -337,9 +346,9 @@ def create_3dcomponent( else: arg2.append("MeshOperations:="), arg2.append(meshops) arg3 = ["NAME:ImageFile", "ImageFile:=", ""] - if auxiliary_dict: - if isinstance(auxiliary_dict, bool): - auxiliary_dict = component_file + ".json" + if export_auxiliary: + if isinstance(export_auxiliary, bool): + export_auxiliary = input_file + ".json" cachesettings = { prop: getattr(self._app.configurations.options, prop) for prop in vars(self._app.configurations.options) @@ -401,47 +410,53 @@ def create_3dcomponent( for cs in list(out_dict["coordinatesystems"]): if cs not in cs_set: del out_dict["coordinatesystems"][cs] - with open_file(auxiliary_dict, "w") as outfile: + with open_file(export_auxiliary, "w") as outfile: json.dump(out_dict, outfile) - if not os.path.isdir(os.path.dirname(component_file)): - self.logger.warning("Folder '" + os.path.dirname(component_file) + "' doesn't exist.") + if not os.path.isdir(os.path.dirname(input_file)): + self.logger.warning("Folder '" + os.path.dirname(input_file) + "' doesn't exist.") if create_folder: # Folder doesn't exist. - os.mkdir(os.path.dirname(component_file)) - self.logger.warning("Created folder '" + os.path.dirname(component_file) + "'") + os.mkdir(os.path.dirname(input_file)) + self.logger.warning("Created folder '" + os.path.dirname(input_file) + "'") else: - self.logger.warning("Unable to create 3D Component: '" + component_file + "'") + self.logger.warning("Unable to create 3D Component: '" + input_file + "'") return False - self.oeditor.Create3DComponent(arg, arg2, component_file, arg3) + self.oeditor.Create3DComponent(arg, arg2, input_file, arg3) return True - @pyaedt_function_handler() + @pyaedt_function_handler( + component_name="name", + object_list="assignment", + boundaries_list="boundaries", + excitation_list="excitations", + included_cs="coordinate_systems", + ) def replace_3dcomponent( self, - component_name=None, + name=None, variables_to_include=None, - object_list=None, - boundaries_list=None, - excitation_list=None, + assignment=None, + boundaries=None, + excitations=None, included_cs=None, - reference_cs="Global", + coordinate_systems="Global", ): """Replace with 3D component. Parameters ---------- - component_name : str, optional + name : str, optional Name of the component. The default is ``None``. variables_to_include : list, optional List of variables to include. The default is ``None``. - object_list : list, optional + assignment : list, optional List of object names to export. The default is all object names. - boundaries_list : list, optional + boundaries : list, optional List of Boundaries names to export. The default is all boundaries. - excitation_list : list, optional + excitations : list, optional List of Excitation names to export. The default is all excitations. included_cs : list, optional List of Coordinate Systems to export. The default is all coordinate systems. - reference_cs : str, optional + coordinate_systems : str, optional The Coordinate System reference. The default is ``"Global"``. Returns @@ -456,13 +471,13 @@ def replace_3dcomponent( """ if not variables_to_include: variables_to_include = [] - if not component_name: - component_name = generate_unique_name(self._app.design_name) + if not name: + name = generate_unique_name(self._app.design_name) dt_string = datetime.datetime.now().strftime("%H:%M:%S %p %b %d, %Y") arg = [ "NAME:CreateData", "ComponentName:=", - component_name, + name, "Company:=", "", "Company URL:=", @@ -486,8 +501,8 @@ def replace_3dcomponent( "HasLabel:=", False, ] - if object_list: - objs = object_list + if assignment: + objs = assignment else: native_objs = [obj.name for _, v in self.user_defined_components.items() for _, obj in v.parts.items()] objs = [obj for obj in self.object_names if obj not in native_objs] @@ -506,7 +521,7 @@ def replace_3dcomponent( else: allcs = self.oeditor.GetCoordinateSystems() arg.append("IncludedCS:="), arg.append(allcs) - arg.append("ReferenceCS:="), arg.append(reference_cs) + arg.append("ReferenceCS:="), arg.append(coordinate_systems) par_description = [] variables = [] if variables_to_include: @@ -536,8 +551,8 @@ def replace_3dcomponent( arg.append("ParameterDescription:="), arg.append(par_description) arg2 = ["NAME:DesignData"] - if boundaries_list: - boundaries = boundaries_list + if boundaries: + boundaries = boundaries else: boundaries = self.get_boundaries_name() if boundaries: @@ -551,8 +566,8 @@ def replace_3dcomponent( if meshregions: arg2.append("MeshRegions:="), arg2.append(meshregions) else: - if excitation_list: - excitations = excitation_list + if excitations: + excitations = excitations else: excitations = self._app.excitations if self._app.design_type == "HFSS": @@ -1339,33 +1354,33 @@ def import_from_openstreet_map( self[obj].color = color return scene - @pyaedt_function_handler + @pyaedt_function_handler(objects_list="assignment", segments_number="segments", mesh_sheets_number="mesh_sheets") def objects_segmentation( self, - objects_list, + assignment, segmentation_thickness=None, - segments_number=None, + segments=None, apply_mesh_sheets=False, - mesh_sheets_number=2, + mesh_sheets=2, ): """Get segmentation of an object given the segmentation thickness or number of segments. Parameters ---------- - objects_list : list, str + assignment : list, str List of objects to apply the segmentation to. It can either be a list of strings (object names), integers (object IDs), or a list of :class:`pyaedt.modeler.cad.object3d.Object3d` classes. segmentation_thickness : float, optional Segmentation thickness. Model units are automatically assigned. The default is ``None``. - segments_number : int, optional + segments : int, optional Number of segments to segment the object to. The default is ``None``. apply_mesh_sheets : bool, optional Whether to apply mesh sheets to selected objects. Mesh sheets are needed in case the user would like to have additional layers inside the objects for a finer mesh and more accurate results. The default is ``False``. - mesh_sheets_number : int, optional + mesh_sheets : int, optional Number of mesh sheets within one magnet segment. If nothing is provided and ``apply_mesh_sheets=True``, the default value is ``2``. @@ -1383,37 +1398,35 @@ def objects_segmentation( segments that the object has been divided into. ``False`` is returned if the method fails. """ - if not segmentation_thickness and not segments_number: + if not segmentation_thickness and not segments: self.logger.error("Provide at least one option to segment the objects in the list.") return False - elif segmentation_thickness and segments_number: + elif segmentation_thickness and segments: self.logger.error("Only one segmentation option can be selected.") return False - objects_list = self.convert_to_selections(objects_list, True) + assignment = self.convert_to_selections(assignment, True) segment_sheets = {} segment_objects = {} - for obj_name in objects_list: + for obj_name in assignment: obj = self[obj_name] obj_axial_length = GeometryOperators.points_distance(obj.top_face_z.center, obj.bottom_face_z.center) - if segments_number: - segmentation_thickness = obj_axial_length / segments_number + if segments: + segmentation_thickness = obj_axial_length / segments elif segmentation_thickness: - segments_number = round(obj_axial_length / segmentation_thickness) + segments = round(obj_axial_length / segmentation_thickness) face_object = self.create_object_from_face(obj.bottom_face_z) # segment sheets - segment_sheets[obj.name] = face_object.duplicate_along_line( - ["0", "0", segmentation_thickness], segments_number - ) + segment_sheets[obj.name] = face_object.duplicate_along_line(["0", "0", segmentation_thickness], segments) segment_objects[obj.name] = [] for value in segment_sheets[obj.name]: segment_objects[obj.name].append([x for x in self.sheet_objects if x.name == value][0]) if apply_mesh_sheets: - mesh_sheets = {} + sheets = {} mesh_objects = {} # mesh sheets - mesh_sheet_position = segmentation_thickness / (mesh_sheets_number + 1) + mesh_sheet_position = segmentation_thickness / (mesh_sheets + 1) for i in range(len(segment_objects[obj.name]) + 1): if i == 0: face = obj.bottom_face_z @@ -1421,11 +1434,9 @@ def objects_segmentation( face = segment_objects[obj.name][i - 1].faces[0] mesh_face_object = self.create_object_from_face(face) self.move(mesh_face_object, [0, 0, mesh_sheet_position]) - mesh_sheets[obj.name] = mesh_face_object.duplicate_along_line( - [0, 0, mesh_sheet_position], mesh_sheets_number - ) + sheets[obj.name] = mesh_face_object.duplicate_along_line([0, 0, mesh_sheet_position], mesh_sheets) mesh_objects[obj.name] = [mesh_face_object] - for value in mesh_sheets[obj.name]: + for value in sheets[obj.name]: mesh_objects[obj.name].append([x for x in self.sheet_objects if x.name == value][0]) face_object.delete() if apply_mesh_sheets: @@ -1525,16 +1536,16 @@ def change_region_padding(self, padding_data, padding_type, direction=None, regi except (GrpcApiError, SystemExit): return False - @pyaedt_function_handler - def change_region_coordinate_system(self, region_cs="Global", region_name="Region"): + @pyaedt_function_handler(region_cs="assignment", region_name="name") + def change_region_coordinate_system(self, assignment="Global", name="Region"): """ Change region coordinate system. Parameters ---------- - region_cs : str, optional + assignment : str, optional Region coordinate system. Default is ``Global``. - region_name : str optional + name : str optional Region name. Default is ``Region``. Returns @@ -1547,11 +1558,11 @@ def change_region_coordinate_system(self, region_cs="Global", region_name="Regio >>> import pyaedt >>> app = pyaedt.Icepak() >>> app.modeler.create_coordinate_system(origin=[1, 1, 1], name="NewCS") - >>> app.modeler.change_region_coordinate_system(region_cs="NewCS") + >>> app.modeler.change_region_coordinate_system(assignment="NewCS") """ try: - create_region_name = self._app.get_oo_object(self._app.oeditor, region_name).GetChildNames()[0] - create_region = self._app.get_oo_object(self._app.oeditor, region_name + "/" + create_region_name) - return create_region.SetPropValue("Coordinate System", region_cs) + create_region_name = self._app.get_oo_object(self._app.oeditor, name).GetChildNames()[0] + create_region = self._app.get_oo_object(self._app.oeditor, name + "/" + create_region_name) + return create_region.SetPropValue("Coordinate System", assignment) except (GrpcApiError, SystemExit): return False diff --git a/pyaedt/modules/DesignXPloration.py b/pyaedt/modules/DesignXPloration.py index ad144d1fb6b..f3d4a8f62a8 100644 --- a/pyaedt/modules/DesignXPloration.py +++ b/pyaedt/modules/DesignXPloration.py @@ -895,13 +895,15 @@ def delete(self): self._app.parametrics.setups.remove(self) return True - @pyaedt_function_handler() - def add_variation(self, sweep_var, start_point, end_point=None, step=100, unit=None, variation_type="LinearCount"): + @pyaedt_function_handler(sweep_var="sweep_variable", unit="units") + def add_variation( + self, sweep_variable, start_point, end_point=None, step=100, units=None, variation_type="LinearCount" + ): """Add a variation to an existing parametric setup. Parameters ---------- - sweep_var : str + sweep_variable : str Name of the variable. start_point : float or int Variation Start Point. @@ -909,7 +911,7 @@ def add_variation(self, sweep_var, start_point, end_point=None, step=100, unit=N Variation End Point. This parameter is optional if a Single Value is defined. step : float or int, optional Variation Step or Count depending on variation_type. Default is `100`. - unit : str, optional + units : str, optional Variation units. Default is `None`. variation_type : float or int Variation Type. Admitted values are `"SingleValue", `"LinearCount"`, `"LinearStep"`, @@ -925,18 +927,18 @@ def add_variation(self, sweep_var, start_point, end_point=None, step=100, unit=N >>> oModule.EditSetup """ - if sweep_var not in self._app.variable_manager.variables: - self._app.logger.error("Variable {} does not exists.".format(sweep_var)) + if sweep_variable not in self._app.variable_manager.variables: + self._app.logger.error("Variable {} does not exists.".format(sweep_variable)) return False sweep_range = "" - if not unit: - unit = self._app.variable_manager[sweep_var].units - start_point = self._app.value_with_units(start_point, unit) - end_point = self._app.value_with_units(end_point, unit) + if not units: + units = self._app.variable_manager[sweep_variable].units + start_point = self._app.value_with_units(start_point, units) + end_point = self._app.value_with_units(end_point, units) if variation_type == "LinearCount": sweep_range = "LINC {} {} {}".format(start_point, end_point, step) elif variation_type == "LinearStep": - sweep_range = "LIN {} {} {}".format(start_point, end_point, self._app.value_with_units(step, unit)) + sweep_range = "LIN {} {} {}".format(start_point, end_point, self._app.value_with_units(step, units)) elif variation_type == "DecadeCount": sweep_range = "DEC {} {} {}".format(start_point, end_point, step) elif variation_type == "OctaveCount": @@ -947,9 +949,9 @@ def add_variation(self, sweep_var, start_point, end_point=None, step=100, unit=N sweep_range = "{}".format(start_point) if not sweep_range: return False - self._activate_variable(sweep_var) + self._activate_variable(sweep_variable) sweepdefinition = OrderedDict() - sweepdefinition["Variable"] = sweep_var + sweepdefinition["Variable"] = sweep_variable sweepdefinition["Data"] = sweep_range sweepdefinition["OffsetF1"] = False sweepdefinition["Synchronize"] = 0 @@ -1072,13 +1074,13 @@ def add_calculation( calculation, ranges, None, solution, context, subdesign_id, polyline_points, report_type, is_goal=False ) - @pyaedt_function_handler() - def export_to_csv(self, filename): + @pyaedt_function_handler(filename="output_file") + def export_to_csv(self, output_file): """Export the current Parametric Setup to csv. Parameters ---------- - filename : str + output_file : str Full Path to the csv file. Returns @@ -1086,7 +1088,7 @@ def export_to_csv(self, filename): bool `True` if the export is correctly executed. """ - self.omodule.ExportParametricSetupTable(self.name, filename) + self.omodule.ExportParametricSetupTable(self.name, output_file) return True @@ -1131,23 +1133,23 @@ def optimodule(self): """ return self._app.ooptimetrics - @pyaedt_function_handler() + @pyaedt_function_handler(sweep_var="variable", parametricname="name") def add( self, - sweep_var, + variable, start_point, end_point=None, step=100, variation_type="LinearCount", solution=None, - parametricname=None, + name=None, ): """Add a basic sensitivity analysis. You can customize all options after the analysis is added. Parameters ---------- - sweep_var : str + variable : str Name of the variable. start_point : float or int Variation Start Point if a variation is defined or Single Value. @@ -1160,7 +1162,7 @@ def add( solution : str, optional Type of the solution. The default is ``None``, in which case the default solution is used. - parametricname : str, optional + name : str, optional Name of the sensitivity analysis. The default is ``None``, in which case a default name is assigned. @@ -1174,8 +1176,8 @@ def add( >>> oModule.InsertSetup """ - if sweep_var not in self._app.variable_manager.variables: - self._app.logger.error("Variable {} not found.".format(sweep_var)) + if variable not in self._app.variable_manager.variables: + self._app.logger.error("Variable {} not found.".format(variable)) return False if not solution and not self._app.nominal_sweep: self._app.logger.error("At least one setup is needed.") @@ -1183,27 +1185,27 @@ def add( if not solution: solution = self._app.nominal_sweep setupname = solution.split(" ")[0] - if not parametricname: - parametricname = generate_unique_name("Parametric") - setup = SetupParam(self._app, parametricname, optim_type="OptiParametric") + if not name: + name = generate_unique_name("Parametric") + setup = SetupParam(self._app, name, optim_type="OptiParametric") setup.auto_update = False setup.props["Sim. Setups"] = [setupname] setup.props["Sweeps"] = OrderedDict({"SweepDefinition": None}) setup.create() - unit = self._app.variable_manager[sweep_var].units - setup.add_variation(sweep_var, start_point, end_point, step, unit, variation_type) + unit = self._app.variable_manager[variable].units + setup.add_variation(variable, start_point, end_point, step, unit, variation_type) setup.auto_update = True self.setups.append(setup) return setup - @pyaedt_function_handler() - def delete(self, setup_name): + @pyaedt_function_handler(setup_name="name") + def delete(self, name): """Delete a defined Parametric Setup. Parameters ---------- - setup_name : str + name : str Name of parametric setup to delete. Returns @@ -1212,33 +1214,33 @@ def delete(self, setup_name): ``True`` if setup is deleted. ``False`` if it failed. """ for el in self.setups: - if el.name == setup_name: + if el.name == name: el.delete() return True return False - @pyaedt_function_handler() - def add_from_file(self, filename, parametricname=None): + @pyaedt_function_handler(filename="input_file", parametricname="name") + def add_from_file(self, input_file, name=None): """Add a Parametric Setup from a csv file. Parameters ---------- - filename : str + input_file : str Csv file path. - parametricname : str, option - Name of parameric setup. + name : str, option + Name of parametric setup. Returns ------- bool `True` if the import is executed correctly. """ - if not parametricname: - parametricname = generate_unique_name("Parametric") - setup = SetupParam(self._app, parametricname, optim_type="OptiParametric") + if not name: + name = generate_unique_name("Parametric") + setup = SetupParam(self._app, name, optim_type="OptiParametric") setup.auto_update = False setup.props["Sim. Setups"] = [setup_defined.name for setup_defined in self._app.setups] - with open_file(filename, "r") as csvfile: + with open_file(input_file, "r") as csvfile: csvreader = csv.DictReader(csvfile) first_data_line = next(csvreader) setup.props["Sweeps"] = {"SweepDefinition": OrderedDict()} @@ -1257,7 +1259,7 @@ def add_from_file(self, filename, parametricname=None): ) setup.props["Sweeps"]["SweepDefinition"] = sweep_definition - args = ["NAME:" + parametricname] + args = ["NAME:" + name] _dict2arg(setup.props, args) setup.props["Sweep Operations"] = OrderedDict({"add": []}) @@ -1339,13 +1341,13 @@ def optimodule(self): """ return self._app.ooptimetrics - @pyaedt_function_handler() - def delete(self, setup_name): + @pyaedt_function_handler(setup_name="name") + def delete(self, name): """Delete a defined Optimetrics Setup. Parameters ---------- - setup_name : str + name : str Name of optimetrics setup to delete. Returns @@ -1354,23 +1356,23 @@ def delete(self, setup_name): ``True`` if setup is deleted. ``False`` if it failed. """ for el in self.setups: - if el.name == setup_name: + if el.name == name: el.delete() return True return False - @pyaedt_function_handler() + @pyaedt_function_handler(optim_type="optimization_type", parametricname="name") def add( self, calculation=None, ranges=None, variables=None, - optim_type="Optimization", + optimization_type="Optimization", condition="<=", goal_value=1, goal_weight=1, solution=None, - parametricname=None, + name=None, context=None, subdesign_id=None, polyline_points=1001, @@ -1389,7 +1391,7 @@ def add( It includes intrinsics like "Freq", "Time", "Theta", "Distance". variables : list, optional List of variables to include in the optimization. By default all variables are included. - optim_type : strm optional + optimization_type : strm optional Optimization Type. Possible values are `"Optimization"`, `"DXDOE"`,`"DesignExplorer"`,`"Sensitivity"`,`"Statistical"` and `"optiSLang"`. @@ -1402,7 +1404,7 @@ def add( solution : str, optional Type of the solution. The default is ``None``, in which case the default solution is used. - parametricname : str, optional + name : str, optional Name of the analysis. The default is ``None``, in which case a default name is assigned. context : str, optional @@ -1430,11 +1432,11 @@ def add( if not solution: solution = self._app.nominal_sweep setupname = solution.split(" ")[0] - if not parametricname: - parametricname = generate_unique_name(optim_type) - if optim_type != "optiSLang": - optim_type = "Opti" + optim_type - setup = SetupOpti(self._app, parametricname, optim_type=optim_type) + if not name: + name = generate_unique_name(optimization_type) + if optimization_type != "optiSLang": + optimization_type = "Opti" + optimization_type + setup = SetupOpti(self._app, name, optim_type=optimization_type) setup.auto_update = False setup.props["Sim. Setups"] = [setupname] if calculation: @@ -1480,19 +1482,19 @@ def add( except Exception: pass for v in list(dx_variables.keys()): - if optim_type in ["OptiOptimization", "OptiDXDOE", "OptiDesignExplorer", "optiSLang"]: + if optimization_type in ["OptiOptimization", "OptiDXDOE", "OptiDesignExplorer", "optiSLang"]: self._app.activate_variable_optimization(v) - elif optim_type == "OptiSensitivity": + elif optimization_type == "OptiSensitivity": self._app.activate_variable_sensitivity(v) - elif optim_type == "OptiStatistical": + elif optimization_type == "OptiStatistical": self._app.activate_variable_statistical(v) - if optim_type == "OptiDXDOE" and calculation: + if optimization_type == "OptiDXDOE" and calculation: setup.props["CostFunctionGoals"]["Goal"] = sweepdefinition - if optim_type in ["optiSLang", "OptiDesignExplorer"]: + if optimization_type in ["optiSLang", "OptiDesignExplorer"]: setup.props["Sweeps"]["SweepDefinition"] = [] if not dx_variables: - if optim_type == "optiSLang": + if optimization_type == "optiSLang": dx_variables = self._app.variable_manager.design_variables else: dx_variables = self._app.variable_manager.variables diff --git a/pyaedt/modules/solutions.py b/pyaedt/modules/solutions.py index a39de1bc3f7..e6120c702d1 100644 --- a/pyaedt/modules/solutions.py +++ b/pyaedt/modules/solutions.py @@ -689,11 +689,7 @@ def _init_solution_data_mag(self): _solutions_mag[expr] = {} self.units_data[expr] = self.nominal_variation.GetDataUnits(expr) if self.enable_pandas_output: - _solutions_mag[expr] = np.sqrt( - self._solutions_real[expr] - .mul(self._solutions_real[expr]) - .add(self._solutions_imag[expr].mul(self._solutions_imag[expr])) - ) + _solutions_mag[expr] = np.sqrt(self._solutions_real[expr]) else: for i in self._solutions_real[expr]: _solutions_mag[expr][i] = abs(complex(self._solutions_real[expr][i], self._solutions_imag[expr][i])) diff --git a/pyaedt/workflows/project/kernel_converter.py b/pyaedt/workflows/project/kernel_converter.py index 85553458444..9a8c4e82464 100644 --- a/pyaedt/workflows/project/kernel_converter.py +++ b/pyaedt/workflows/project/kernel_converter.py @@ -233,10 +233,10 @@ def convert_3d_component( output_app.modeler.create_3dcomponent( output_path, is_encrypted=True if password else False, - edit_password=password, - hide_contents=False, allow_edit=True if password else False, + edit_password=password, password_type="InternalPassword" if password else "UserSuppliedPassword", + hide_contents=False, ) try: output_desktop.DeleteProject(project_name2)