diff --git a/_unittest/test_08_Primitives3D.py b/_unittest/test_08_Primitives3D.py index c03a624e751..4aa553bf993 100644 --- a/_unittest/test_08_Primitives3D.py +++ b/_unittest/test_08_Primitives3D.py @@ -1185,6 +1185,13 @@ def test_64_create_3d_component_encrypted(self): is_encrypted=True, password="password_test", ) + assert self.aedtapp.modeler.create_3dcomponent( + self.component3d_file, + included_cs="Global", + is_encrypted=True, + password="password_test", + hide_contents=["Solid"], + ) assert not self.aedtapp.modeler.create_3dcomponent( self.component3d_file, included_cs="Global", diff --git a/pyaedt/modeler/modeler3d.py b/pyaedt/modeler/modeler3d.py index 2b6a05bccce..7ebb7fccb7a 100644 --- a/pyaedt/modeler/modeler3d.py +++ b/pyaedt/modeler/modeler3d.py @@ -120,8 +120,9 @@ def create_3dcomponent( password_type : str, optional Password type. Options are ``UserSuppliedPassword`` and ``InternalPassword``. The default is ``UserSuppliedPassword``. - hide_contents : bool, optional - Whether to hide contents. The default is ``False``. + hide_contents : bool or list, optional + List of object names to hide when the component is encrypted. + If set to an empty list or ``False``, all objects are visible. replace_names : bool, optional Whether to replace objects and material names. The default is ``False``. @@ -161,6 +162,7 @@ def create_3dcomponent( return False if component_outline not in ["BoundingBox", "None"]: return False + hide_contents_flag = is_encrypted and isinstance(hide_contents, list) arg = [ "NAME:CreateData", "ComponentName:=", @@ -200,7 +202,7 @@ def create_3dcomponent( "PasswordType:=", password_type, "HideContents:=", - hide_contents, + hide_contents_flag, "ReplaceNames:=", replace_names, "ComponentOutline:=", @@ -220,7 +222,11 @@ def create_3dcomponent( if "CreateRegion:1" in self.oeditor.GetChildObject(el).GetChildNames(): objs.remove(el) arg.append("IncludedParts:="), arg.append(objs) - arg.append("HiddenParts:="), arg.append([]) + arg.append("HiddenParts:=") + if not hide_contents_flag: + arg.append([]) + else: + arg.append(hide_contents) if included_cs: allcs = included_cs else: