Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

CST Studio Suite: VBA ASCIIExport

jcs98xD

Newbie level 4
Newbie level 4
Joined
Jan 17, 2024
Messages
7
Helped
0
Reputation
0
Reaction score
1
Trophy points
3
Activity points
74
Hi,

I'm having a problem with a vba macro that I'm creating in CST Studio Suite Version 2023.05.

I'm trying to export a 2D/3D Result with the ASCIIExport Object with the next code:

      SelectTreeItem("2D/3D Results\E-Field\e-field (f=" & freq*1e-9 & "GHz) [" & name_field_source_a & "]")

      With ASCIIExport
            .Reset
            .FileName(outgoing_modal_expansion_folder & "\H_expansion_" & name_field_source_a & "E.txt")
            .SetPointFile(incoming_modal_expansion_folder & "\" & fname_spher_grid)
            .Execute
      End With

I'm sure that the paths are good.
The file is being created but ignores the pointfile provided. Even trying another options like:

With ASCIIExport
.Reset
.FileName(outgoing_modal_expansion_folder & "\H_expansion_" & name_field_source_a & "E.txt")
.Mode ("FixedNumber")
.StepX (12)
.StepY (12)
.StepZ (8)
.Execute
End With

It's also ignoring the steps. It seems like it's always taking the default options.

Am I doing something wrong?

Thanks in advance.
 
Hi,
Could you please send your project and VBA macro files to test and see the same result?
 
Hi,
Could you please send your project and VBA macro files to test and see the same result?
I attached a simplified project with a local macro called "export field" that does the export.
 

Attachments

  • demo.zip
    430.6 KB · Views: 165
Hi again,

I checked your code and your template project. it is because of your solver type and the simulation format. the code provided by you works fine if you change the solver or problem and you will see it will work.
 
Hi again,

I checked your code and your template project. it is because of your solver type and the simulation format. the code provided by you works fine if you change the solver or problem and you will see it will work.
Hi,

What should I change in the simulation format?
I need to use the integral equation solver (it's faster).
When I do the post processing by hand it's work perfectly with my configuration.
 
Could you let me know what you set in the post-processing section? and what are your settings?
 
Could you let me know what you set in the post-processing section? and what are your settings?
The settings are in the project that I sent it.

Post-processing section:

Captura de pantalla 2024-01-22 233708.png
 
Hi,
Regarding the CST documentation, the data exported as a whole. So for this kind of solver you can not filter them with ASCIIExport. If you need to have something special you should work with I/O file functions.

When I do the post processing by hand it's work perfectly with my configuration.

Aren't the results the same? or do you have any other configurations?

5.PNG
 
Hi,

For me the files are different.

I'm not sure what we mean when we talk about configuration.


1706004293645.png
 
Please go to Post-Processing->Manage Results->Delete results.

Do the simulation again and run the script and check the result.

SelectTreeItem("2D/3D Results\E-Field\e-field (f=30)[pw]")

With ASCIIExport
.Reset
.FileName("d:\H_expansion_E10.txt")
.Mode ("Fixednumber")
.Execute
End With
 
Please go to Post-Processing->Manage Results->Delete results.

Do the simulation again and run the script and check the result.

The result is the field evaluated in randoms [x,y,z] if you execute the macro.
I don't understand the matter.

I'm trying to execute the macro with the .SetPointFile() and get the same result that executing the post processing by hand.
But right now even writting the .SetPointFile option I get the same result as if i don't write it.
 
The result is the field evaluated in randoms [x,y,z] if you execute the macro.
I don't understand the matter.

I'm trying to execute the macro with the .SetPointFile() and get the same result that executing the post processing by hand.
But right now even writting the .SetPointFile option I get the same result as if i don't write it.
Hello there, did you manage to solve your problem? I'm facing the same problem as you! I'm giving the point list however CST exports the fields on random points
 
--- Updated ---

Hello there, did you manage to solve your problem? I'm facing the same problem as you! I'm giving the point list however CST exports the fields on random points
Hi,

The integral solver seems to not be compatible with the ASCIIExport options that I used. However, I found another option that solves the problem. I'm leaving you an example of how to do it.


Dim xlist(2) As Double, ylist(2) As Double, zlist(2) As Double
xlist(0) = 1
xlist(1) = 2
ylist(0) = 1
ylist(1) = 3
zlist(0) = 2
zlist(1) = 3
SelectTreeItem("2D/3D Results\E-Field\ e-field (f=30) [pw]")
With ASCIIExport
.Reset
.Mode("FixedWidth")
.FileName(GetProjectPath("Project") & "\export_field.txt")
.SetPoints(xlist(), ylist(), zlist())
.Execute
End With


I hope it is useful for you.

Best regards,

Jorge.
 

LaTeX Commands Quick-Menu:

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top