Skip to content

Commit

Permalink
Improve the way the modeler3d is initialited (#3807)
Browse files Browse the repository at this point in the history
Co-authored-by: maxcapodi78 <Shark78>
  • Loading branch information
maxcapodi78 authored Oct 26, 2023
1 parent fd0636f commit b3dddcc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
24 changes: 14 additions & 10 deletions pyaedt/modeler/cad/Primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def solid_objects(self):
list of :class:`pyaedt.modeler.cad.object3d.Object3d`
3D object.
"""
self._refresh_solids()
# self._refresh_solids()
return [self[name] for name in self.solid_names if self[name]]

@property
Expand All @@ -87,7 +87,7 @@ def sheet_objects(self):
list of :class:`pyaedt.modeler.cad.object3d.Object3d`
3D object.
"""
self._refresh_sheets()
# self._refresh_sheets()
return [self[name] for name in self.sheet_names if self[name]]

@property
Expand All @@ -99,7 +99,7 @@ def line_objects(self):
list of :class:`pyaedt.modeler.cad.object3d.Object3d`
3D object.
"""
self._refresh_lines()
# self._refresh_lines()
return [self[name] for name in self.line_names if self[name]]

@property
Expand All @@ -111,8 +111,8 @@ def point_objects(self):
list of :class:`pyaedt.modeler.cad.object3d.Object3d`
3D object.
"""
self._refresh_points()
return [self.points[name] for name in self._points]
# self._refresh_points()
return [self.points[name] for name in self.point_names]

@property
def unclassified_objects(self):
Expand All @@ -123,8 +123,8 @@ def unclassified_objects(self):
list of :class:`pyaedt.modeler.cad.object3d.Object3d`
3D object.
"""
self._refresh_unclassified()
return [self[name] for name in self._unclassified if name is not None]
# self._refresh_unclassified()
return [self[name] for name in self.unclassified_names if name is not None]

@property
def object_list(self):
Expand Down Expand Up @@ -2859,14 +2859,18 @@ def _refresh_object_types(self):
self._all_object_names = self._solids + self._sheets + self._lines + self._points + self._unclassified

@pyaedt_function_handler()
def _create_object(self, name, pid=0):
def _create_object(self, name, pid=0, use_cached=False):
if use_cached:
line_names = self._lines
else:
line_names = self.line_names
if name in self._points:
o = Point(self, name)
self.points[name] = o
elif name in self.planes.keys():
o = Plane(self, name)
self.planes[name] = o
elif name in self.line_names:
elif name in line_names:
o = Object3d(self, name)
if pid:
new_id = pid
Expand Down Expand Up @@ -2959,7 +2963,7 @@ def _refresh_all_ids_from_aedt_file(self):
pid = operations["Operation"][0]["ParentPartID"]
except:
pass
o = self._create_object(name=attribs["Name"], pid=pid)
o = self._create_object(name=attribs["Name"], pid=pid, use_cached=True)
o._part_coordinate_system = attribs["PartCoordinateSystem"]
if "NonModel" in attribs["Flags"]:
o._model = False
Expand Down
4 changes: 2 additions & 2 deletions pyaedt/modules/Material.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,10 +1102,10 @@ def __init__(self, materials, name, props=None):
else:
self._props = OrderedDict()
if "CoordinateSystemType" in self._props:
self.coordinate_system = self._props["CoordinateSystemType"]
self._coordinate_system = self._props["CoordinateSystemType"]
else:
self._props["CoordinateSystemType"] = "Cartesian"
self.coordinate_system = "Cartesian"
self._coordinate_system = "Cartesian"
if "BulkOrSurfaceType" in self._props:
self.bulkorsurface = self._props["BulkOrSurfaceType"]
else:
Expand Down

0 comments on commit b3dddcc

Please sign in to comment.