Skip to content

Commit

Permalink
FIX: update native component properties from user defined component (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzovecchietti authored Feb 13, 2025
1 parent a138221 commit 34fc3c6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/ansys/aedt/core/modeler/cad/components_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ def __init__(self, primitives, name=None, props=None, component_type=None):
},
)
if props:
self._update_props(self._props["NativeComponentDefinitionProvider"], props)
self._update_props(
self._props["NativeComponentDefinitionProvider"],
props.get("NativeComponentDefinitionProvider", props),
)
self.native_properties = self._props["NativeComponentDefinitionProvider"]
self.auto_update = True

Expand Down Expand Up @@ -759,7 +762,7 @@ def _logger(self):
def _get_args(self, props=None):
if props is None:
props = self.props
arg = ["NAME:" + self.name]
arg = ["NAME:EditNativeComponentDefinitionData"]
_dict2arg(props, arg)
return arg

Expand Down
10 changes: 9 additions & 1 deletion tests/system/general/test_98_Icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def test033__import_idf(self, ipk):
high_surface_thick="0.1in",
)

def test034__create_fan(self, ipk):
def test034__create_fan(self, ipk, local_scratch):
fan = ipk.create_fan("Fan1", cross_section="YZ", radius="15mm", hub_radius="5mm", origin=[5, 21, 1])
assert fan
assert fan.name in ipk.modeler.oeditor.Get3DComponentInstanceNames(fan.definition_name)[0]
Expand All @@ -674,6 +674,14 @@ def test034__create_fan(self, ipk):
assert fan.name in ipk.native_components
assert not "Fan1" in ipk.native_components
assert not "Fan1" in ipk.modeler.user_defined_components
temp_prj = os.path.join(local_scratch.path, "fan_test.aedt")
ipk.save_project(temp_prj)
ipk = Icepak(temp_prj)
ipk.modeler.user_defined_components["Fan2"].native_properties["Swirl"] = "10"
ipk.modeler.user_defined_components["Fan2"].update_native()
ipk.save_project(temp_prj)
ipk = Icepak(temp_prj)
assert ipk.native_components["Fan1"].props["NativeComponentDefinitionProvider"]["Swirl"] == "10"

def test035__create_heat_sink(self, ipk):
assert ipk.create_parametric_fin_heat_sink(
Expand Down

0 comments on commit 34fc3c6

Please sign in to comment.