Skip to content

Commit

Permalink
Fix coordinate systems get props (#3306)
Browse files Browse the repository at this point in the history
* props updated was missed

* props updated was missed

* update duplicate cs + tests

* Improved method generate_fluent_mesh

---------

Co-authored-by: maxcapodi78 <Shark78>
Co-authored-by: Giulia Malinverno <[email protected]>
  • Loading branch information
maxcapodi78 and gmalinve authored Jul 25, 2023
1 parent d072deb commit 4267f4e
Show file tree
Hide file tree
Showing 3 changed files with 284 additions and 75 deletions.
18 changes: 18 additions & 0 deletions _unittest/test_02_3D_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,24 @@ def test_57_duplicate_coordinate_system_to_global(self):
assert all(abs(o[i] - s) < tol for i, s in enumerate([1.82842712474619, 2.20832611206852, 9.0]))
assert all(abs(q[i] - s) < tol for i, s in enumerate([-0.0, -0.09853761796664, 0.99513332666807, 0.0]))
assert self.aedtapp.modeler.reference_cs_to_global(cs4)
box = self.aedtapp.modeler.create_box([0, 0, 0], [2, 2, 2])
face = box.faces[0]
fcs = self.aedtapp.modeler.create_face_coordinate_system(face, face.edges[0], face.edges[1])
new_fcs = self.aedtapp.modeler.duplicate_coordinate_system_to_global(fcs)
assert new_fcs
assert new_fcs.props == fcs.props
fcs = self.aedtapp.modeler.create_face_coordinate_system(face, face, face.edges[1])
new_fcs = self.aedtapp.modeler.duplicate_coordinate_system_to_global(fcs)
assert new_fcs
assert new_fcs.props == fcs.props
fcs = self.aedtapp.modeler.create_face_coordinate_system(face, face, face.edges[1].vertices[0])
new_fcs = self.aedtapp.modeler.duplicate_coordinate_system_to_global(fcs)
assert new_fcs
assert new_fcs.props == fcs.props
fcs = self.aedtapp.modeler.create_face_coordinate_system(face, face.edges[1].vertices[0], face.edges[1])
new_fcs = self.aedtapp.modeler.duplicate_coordinate_system_to_global(fcs)
assert new_fcs
assert new_fcs.props == fcs.props

def test_58_invert_cs(self):
self.aedtapp.modeler.create_coordinate_system(
Expand Down
82 changes: 72 additions & 10 deletions _unittest/test_98_Icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,13 +822,84 @@ def test_50_advanced3dcomp_export(self):
fan_obj_3d.delete()

def test_51_advanced3dcomp_import(self):
self.aedtapp.insert_design("test_3d_comp")
surf1 = self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.XY, [0, 0, 0], [10, 20], name="surf1")
box1 = self.aedtapp.modeler.create_box([20, 20, 2], [10, 10, 3], "box1", "copper")
fan = self.aedtapp.create_fan("Fan", cross_section="YZ", radius="1mm", hub_radius="0mm")
cs0 = self.aedtapp.modeler.create_coordinate_system(name="CS0")
cs0.props["OriginX"] = 10
cs0.props["OriginY"] = 10
cs0.props["OriginZ"] = 10
cs1 = self.aedtapp.modeler.create_coordinate_system(name="CS1", reference_cs="CS0")
cs1.props["OriginX"] = 10
cs1.props["OriginY"] = 10
cs1.props["OriginZ"] = 10
fan2_prop = dict(fan.props).copy()
fan2_prop["TargetCS"] = "CS1"
fan2 = NativeComponentObject(self.aedtapp, "Fan", "Fan2", fan2_prop)
fan2.create()
pcb = self.aedtapp.create_ipk_3dcomponent_pcb(
"Board", link_data, solution_freq, resolution, custom_x_resolution=400, custom_y_resolution=500
)
self.aedtapp.monitor.assign_face_monitor(box1.faces[0].id, "Temperature", "FaceMonitor")
self.aedtapp.monitor.assign_point_monitor_in_object(box1.name, "Temperature", "BoxMonitor")
self.aedtapp.monitor.assign_surface_monitor(surf1.name, "Temperature", "SurfaceMonitor")
self.aedtapp.create_dataset(
"test_dataset",
[1, 2, 3, 4],
[1, 2, 3, 4],
zlist=None,
vlist=None,
is_project_dataset=False,
xunit="cel",
yunit="W",
zunit="",
vunit="",
)
file_path = self.local_scratch.path
file_name = "Advanced3DComp_T51.a3dcomp"
fan_obj = self.aedtapp.create_fan(is_2d=True)
self.aedtapp.monitor.assign_surface_monitor(
list(self.aedtapp.modeler.user_defined_components[fan_obj.name].parts.values())[0].name
)
self.aedtapp.monitor.assign_face_monitor(
list(self.aedtapp.modeler.user_defined_components[fan_obj.name].parts.values())[0].faces[0].id
)
fan_obj_3d = self.aedtapp.create_fan(is_2d=False)
self.aedtapp.monitor.assign_point_monitor_in_object(
list(self.aedtapp.modeler.user_defined_components[fan_obj_3d.name].parts.values())[0].name
)
self.aedtapp.create_dataset(
"test_ignore",
[1, 2, 3, 4],
[1, 2, 3, 4],
zlist=None,
vlist=None,
is_project_dataset=False,
xunit="cel",
yunit="W",
zunit="",
vunit="",
)
mon_list = list(self.aedtapp.monitor.all_monitors.keys())
self.aedtapp.monitor.assign_point_monitor([0, 0, 0])
cs_list = [cs.name for cs in self.aedtapp.modeler.coordinate_systems if cs.name != "CS0"]
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",
monitor_objects=mon_list,
datasets=["test_dataset"],
)
self.aedtapp.insert_design("test_51_1")
cs2 = self.aedtapp.modeler.create_coordinate_system(name="CS2")
cs2.props["OriginX"] = 20
cs2.props["OriginY"] = 20
cs2.props["OriginZ"] = 20
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
)
Expand All @@ -850,15 +921,6 @@ def test_51_advanced3dcomp_import(self):
self.aedtapp.modeler.insert_3d_component(
comp_file=os.path.join(file_path, file_name), targetCS="Global", auxiliary_dict=False, name="test"
)
file_name = "Advanced3DComp1.a3dcomp"
self.aedtapp.insert_design("test_51_3")
cs2 = self.aedtapp.modeler.create_coordinate_system(name="CS2")
cs2.props["OriginX"] = 20
cs2.props["OriginY"] = 20
cs2.props["OriginZ"] = 20
self.aedtapp.modeler.insert_3d_component(
comp_file=os.path.join(file_path, file_name), targetCS="CS2", auxiliary_dict=True, name="test"
)

def test_52_flatten_3d_components(self):
self.aedtapp.insert_design("test_52")
Expand Down
Loading

0 comments on commit 4267f4e

Please sign in to comment.