Skip to content

Commit

Permalink
Call API only when Polyline (#4370)
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuelopez-ansys authored Mar 18, 2024
1 parent 982c8e5 commit f5f21d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions pyaedt/modeler/cad/Primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,12 @@ def _refresh_all_ids_from_aedt_file(self):
pid = operations["Operation"][0]["ParentPartID"]
except:
pass
o = self._create_object(name=attribs["Name"], pid=pid, use_cached=True)

is_polyline = False
if operations and "PolylineParameters" in operations.get("Operation", {}):
is_polyline = True

o = self._create_object(name=attribs["Name"], pid=pid, use_cached=True, is_polyline=is_polyline)
o._part_coordinate_system = attribs["PartCoordinateSystem"]
if "NonModel" in attribs["Flags"]:
o._model = False
Expand Down Expand Up @@ -7943,7 +7948,7 @@ 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, use_cached=False, **kwargs):
def _create_object(self, name, pid=0, use_cached=False, is_polyline=False, **kwargs):
if use_cached:
line_names = self._lines
else:
Expand All @@ -7965,8 +7970,7 @@ def _create_object(self, name, pid=0, use_cached=False, **kwargs):
self._object_names_to_ids[o.name] = new_id
else:
o = Object3d(self, name)
commands = self._get_commands(name)
if commands and commands[0].startswith("CreatePolyline"):
if is_polyline:
o = self.get_existing_polyline(o)
if pid:
new_id = pid
Expand Down
2 changes: 1 addition & 1 deletion pyaedt/modeler/cad/polylines.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def __init__(

new_object_name = self._oeditor.CreatePolyline(varg1, varg2)
Object3d.__init__(self, primitives, name=new_object_name)
self._primitives._create_object(self.name)
self._primitives._create_object(self.name, is_polyline=True)

@property
def start_point(self):
Expand Down

0 comments on commit f5f21d1

Please sign in to comment.