26
26
27
27
import ast
28
28
import math
29
- import os
30
29
from pathlib import Path
31
30
import tempfile
32
31
from typing import Union
@@ -2681,7 +2680,7 @@ def create_sbr_linked_antenna(
2681
2680
if assignment .project_name == self .project_name :
2682
2681
project_name = "This Project*"
2683
2682
else :
2684
- project_name = os . path . join (assignment .project_path , assignment .project_name + ".aedt" )
2683
+ project_name = Path (assignment .project_path ) / ( assignment .project_name + ".aedt" )
2685
2684
design_name = assignment .design_name
2686
2685
if not setup :
2687
2686
setup = assignment .nominal_adaptive
@@ -2696,7 +2695,7 @@ def create_sbr_linked_antenna(
2696
2695
"Unit" : self .modeler .model_units ,
2697
2696
"Version" : 0 ,
2698
2697
"Is Parametric Array" : False ,
2699
- "Project" : project_name ,
2698
+ "Project" : str ( project_name ) ,
2700
2699
"Product" : "HFSS" ,
2701
2700
"Design" : design_name ,
2702
2701
"Soln" : setup ,
@@ -2812,7 +2811,7 @@ def create_sbr_custom_array_file(
2812
2811
>>> hfss.release_desktop()
2813
2812
"""
2814
2813
if output_file is None :
2815
- output_file = os . path . join (self .working_directory , "custom_array.sarr" )
2814
+ output_file = Path (self .working_directory ) / "custom_array.sarr"
2816
2815
2817
2816
if frequencies is None :
2818
2817
frequencies = [1.0 ]
@@ -4829,7 +4828,7 @@ def validate_full_design(self, design=None, output_dir=None, ports=None):
4829
4828
if not output_dir :
4830
4829
output_dir = self .working_directory
4831
4830
pname = self .project_name
4832
- validation_log_file = os . path . join (output_dir , pname + "_" + design + "_validation.log" )
4831
+ validation_log_file = Path (output_dir ) / ( pname + "_" + design + "_validation.log" )
4833
4832
4834
4833
# Desktop Messages
4835
4834
msg = "Desktop messages:"
@@ -4841,7 +4840,7 @@ def validate_full_design(self, design=None, output_dir=None, ports=None):
4841
4840
4842
4841
# Run design validation and write out the lines to the log.
4843
4842
temp_dir = tempfile .gettempdir ()
4844
- temp_val_file = os . path . join (temp_dir , "val_temp.log" )
4843
+ temp_val_file = Path (temp_dir ) / "val_temp.log"
4845
4844
simple_val_return = self .validate_simple (temp_val_file )
4846
4845
if simple_val_return == 1 :
4847
4846
msg = "Design validation check PASSED."
@@ -4851,11 +4850,11 @@ def validate_full_design(self, design=None, output_dir=None, ports=None):
4851
4850
val_list .append (msg )
4852
4851
msg = "Design validation messages:"
4853
4852
val_list .append (msg )
4854
- if os . path . isfile ( temp_val_file ) or settings .remote_rpc_session :
4853
+ if temp_val_file . is_file ( ) or settings .remote_rpc_session :
4855
4854
with open_file (temp_val_file , "r" ) as df :
4856
4855
temp = df .read ().splitlines ()
4857
4856
val_list .extend (temp )
4858
- os . remove ( temp_val_file )
4857
+ temp_val_file . unlink ( )
4859
4858
else :
4860
4859
msg = "** No design validation file is found. **"
4861
4860
self .logger .info (msg )
@@ -6626,7 +6625,7 @@ def parse_hdm_file(self, file_name):
6626
6625
6627
6626
Parameters
6628
6627
----------
6629
- file_name : str
6628
+ file_name : str or :class:`pathlib.Path`
6630
6629
Name of the file to parse.
6631
6630
6632
6631
Returns
@@ -6636,8 +6635,8 @@ def parse_hdm_file(self, file_name):
6636
6635
6637
6636
from ansys .aedt .core .visualization .advanced .sbrplus .hdm_parser import Parser
6638
6637
6639
- if os . path . exists (file_name ):
6640
- return Parser (file_name ).parse_message ()
6638
+ if Path ( file_name ). exists ():
6639
+ return Parser (str ( file_name ) ).parse_message ()
6641
6640
return False
6642
6641
6643
6642
@pyaedt_function_handler (filename = "file_name" )
@@ -7484,7 +7483,7 @@ def export_element_pattern(
7484
7483
variation = self .available_variations .variation_string (variations )
7485
7484
command = [
7486
7485
"ExportFileName:=" ,
7487
- os . path . join ( output_dir , element_name + ".ffd" ),
7486
+ str ( Path ( output_dir ) / ( element_name + ".ffd" ) ),
7488
7487
"SetupName:=" ,
7489
7488
sphere ,
7490
7489
]
0 commit comments