diff --git a/pyaedt/desktop.py b/pyaedt/desktop.py index b33e7417acd..66f8941e1ef 100644 --- a/pyaedt/desktop.py +++ b/pyaedt/desktop.py @@ -73,13 +73,9 @@ def launch_desktop_on_port(): my_env[env] = val if is_linux: # pragma: no cover command.append("&") - with subprocess.Popen(command, env=my_env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) as p: - p.wait() + subprocess.Popen(command, env=my_env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) else: - with subprocess.Popen( - " ".join(command), env=my_env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL - ) as p: - p.wait() + subprocess.Popen(" ".join(command), env=my_env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) _aedt_process_thread = threading.Thread(target=launch_desktop_on_port) _aedt_process_thread.daemon = True diff --git a/pyaedt/generic/settings.py b/pyaedt/generic/settings.py index 4cf34adcb04..838a3e35a25 100644 --- a/pyaedt/generic/settings.py +++ b/pyaedt/generic/settings.py @@ -62,7 +62,7 @@ def __init__(self): } if is_linux: self._aedt_environment_variables["ANS_NODEPCHECK"] = "1" - self._desktop_launch_timeout = 90 + self._desktop_launch_timeout = 120 self._number_of_grpc_api_retries = 6 self._retry_n_times_time_interval = 0.1 self._wait_for_license = False diff --git a/pyaedt/modeler/geometry_operators.py b/pyaedt/modeler/geometry_operators.py index 0d12c996515..51d68d124ca 100644 --- a/pyaedt/modeler/geometry_operators.py +++ b/pyaedt/modeler/geometry_operators.py @@ -464,6 +464,8 @@ def normalize_vector(v): """ # normalize a vector to its norm norm = GeometryOperators.v_norm(v) + if norm == 0.0: + return v vn = [i / norm for i in v] return vn diff --git a/pyaedt/modeler/modeler3d.py b/pyaedt/modeler/modeler3d.py index ce32cf991b1..96de3e5da06 100644 --- a/pyaedt/modeler/modeler3d.py +++ b/pyaedt/modeler/modeler3d.py @@ -888,7 +888,8 @@ def import_nastran(self, file_path, import_lines=True, lines_thickness=0, import with open(file_path, "r") as f: lines = f.read().splitlines() id = 0 - for line in lines: + for lk in range(len(lines)): + line = lines[lk] line_type = line[:8].strip() if line.startswith("$") or line.startswith("*"): continue @@ -939,7 +940,8 @@ def import_nastran(self, file_path, import_lines=True, lines_thickness=0, import n3 = line[72:88].strip() if not n3 or n3 == "*": - n3 = lines[lines.index(line) + 1][8:24].strip() + lk += 1 + n3 = lines[lk][8:24].strip() if "-" in n3[1:]: n3 = n3[0] + n3[1:].replace("-", "e-") if line_type == "GRID*": @@ -978,8 +980,9 @@ def import_nastran(self, file_path, import_lines=True, lines_thickness=0, import if line_type == "CHEXA": n5 = int(line[56:64]) n6 = int(line[64:72]) - n7 = int(lines[lines.index(line) + 1][8:16].strip()) - n8 = int(lines[lines.index(line) + 1][16:24].strip()) + lk += 1 + n7 = int(lines[lk][8:16].strip()) + n8 = int(lines[lk][16:24].strip()) obj_list.extend([n5, n6, n7, n8]) if obj_id in nas_to_dict["Solids"]: @@ -1021,6 +1024,7 @@ def import_nastran(self, file_path, import_lines=True, lines_thickness=0, import n = [1, 0, 0] else: n = GeometryOperators.v_cross(cv1, cv2) + normal = GeometryOperators.normalize_vector(n) if normal: f.write(" facet normal {} {} {}\n".format(normal[0], normal[1], normal[2])) diff --git a/pyaedt/modules/DesignXPloration.py b/pyaedt/modules/DesignXPloration.py index ad92519a253..3dc5ca7df02 100644 --- a/pyaedt/modules/DesignXPloration.py +++ b/pyaedt/modules/DesignXPloration.py @@ -921,7 +921,7 @@ def add_variation(self, sweep_var, start_point, end_point=None, step=100, unit=N elif variation_type == "LogScale": sweep_range = "DEC {} {} {}".format(start_point, end_point, self._app.value_with_units(step, unit)) elif variation_type == "SingleValue": - sweep_range = "{}".format(self._app.value_with_units(start_point, unit)) + sweep_range = "{}".format(start_point) if not sweep_range: return False self._activate_variable(sweep_var)