Skip to content

Commit

Permalink
FIX: improve nastran method. (#4646)
Browse files Browse the repository at this point in the history
Co-authored-by: maxcapodi78 <Shark78>
Co-authored-by: Samuel Lopez <[email protected]>
  • Loading branch information
maxcapodi78 and Samuelopez-ansys authored May 7, 2024
1 parent 2cb4748 commit 7e19812
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions pyaedt/modeler/modeler3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ def _write_solid_stl(triangle, nas_to_dict):

self.logger.info_timer("File loaded")
objs_before = [i for i in self.object_names]
if nas_to_dict["Triangles"]:
if nas_to_dict["Triangles"] or nas_to_dict["Solids"] or nas_to_dict["Lines"]:
self.logger.reset_timer()
self.logger.info("Creating STL file with detected faces")
f = open(os.path.join(self._app.working_directory, self._app.design_name + "_test.stl"), "w")
Expand All @@ -1069,7 +1069,9 @@ def _write_solid_stl(triangle, nas_to_dict):
_write_solid_stl(triangle, nas_to_dict)
f.write("endsolid\n")
f.close()
self.logger.info("STL file created")
self.logger.info_timer("STL file created")
self.logger.reset_timer()
self.logger.info("Importing STL in 3D Modeler")
self.import_3d_cad(
os.path.join(self._app.working_directory, self._app.design_name + "_test.stl"),
create_lightweigth_part=import_as_light_weight,
Expand All @@ -1080,7 +1082,7 @@ def _write_solid_stl(triangle, nas_to_dict):
for el in nas_to_dict["Triangles"].keys():
obj_names = [i for i in self.object_names if i.startswith("Sheet_{}".format(el))]
self.create_group(obj_names, group_name=str(el))
self.logger.info_timer("Faces imported")
self.logger.info_timer("Model imported")

if import_lines:
for line_name, lines in nas_to_dict["Lines"].items():
Expand Down
2 changes: 1 addition & 1 deletion pyaedt/workflows/project/import_nastran.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def browseFiles():
version = os.environ["PYAEDT_SCRIPT_VERSION"]
else:
port = 0
version = "2024.2"
version = "2024.1"
if os.path.exists(nas_input):
with Desktop(new_desktop_session=False, close_on_exit=False, specified_version=version, port=port) as d:
proj = d.active_project()
Expand Down

0 comments on commit 7e19812

Please sign in to comment.