Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add export_options to export_field_file() #4383

Closed
nathmay opened this issue Mar 19, 2024 · 1 comment · Fixed by #4390
Closed

Add export_options to export_field_file() #4383

nathmay opened this issue Mar 19, 2024 · 1 comment · Fixed by #4390
Assignees
Labels
enhancement New features or code improvements

Comments

@nathmay
Copy link

nathmay commented Mar 19, 2024

Description of the feature

export_field_file() in pyaedt/modules/PostProcessor.py asks for an optional argument export_with_sample_points, set to True by default. Under the hood, it calls ofieldsreporter.ExportToFile(), and passes export_with_sample_points as the fifth argument.

Recent versions of AEDT have additional options while exporting field, e.g. selecting which coordinate system to use. According to HFSS scripting guide, this can be set by passing a list to the fifth argument, instead of the legacy Boolean option. Example from the HFSS scripting guide (section 20-28, under ExportToFile [Fields Calculator]:

oModule.ExportToFile("C:\\offset_file_model_unit_ref.fld", "C:\\offset_SI.pts",
"4500MHz : LastAdaptive",
  [
    "Freq:=" , "4.5GHz",
    "Phase:=" , "0deg"
  ],
  [
    "NAME:ExportOption",
    "IncludePtInOutput:=" , True,
    "RefCSName:=" , "offset",
    "PtInSI:=" , False,
    "FieldInRefCS:=" , True
  ])

The Scripting Guide also has the following note, which explains why the current pyaedt implementation works:

Regarding the legacy ExportToFile script which only has “IncludePtInOutput” argument (the last Boolean one), AEDT can
still read it and assign other new arguments as default values. Those default values are RefCSName = “global”, PtInSI =
“True”, FieldInRefCS = “False

Current workaround:
Since export_field_file() directly passes export_with_sample_points to ofieldsreporter.ExportToFile() without any modification, user should be able to pass a list instead of a Boolean, and get desired results. eg:

app.post.export_field_file("ComplexMag_E", filename="E_Field.fld", 
                           sample_points_file="data_points.pts", intrinsics="2.45GHz",
                          export_with_sample_points= ['IncludePtInOutput:=', False, 'RefCSName:=', 'CustomCS'])

Suggested enhancement
Going forward, it'll be nice to have additional arguments available to export_field_file() for each export option. According to HFSS scripting guide, the available options are:

Whether to include points in output (Boolean), RefCSName (String), Pts in SI units (Boolean), Field in RefCS (Boolean).

Steps for implementing the feature

No response

Useful links and references

No response

@nathmay nathmay added the enhancement New features or code improvements label Mar 19, 2024
@Samuelopez-ansys Samuelopez-ansys self-assigned this Mar 21, 2024
@Samuelopez-ansys
Copy link
Member

@nathmay Please check the Pull request:
#4390

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features or code improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants