CST Microwave Studio Macro - "Save" vba command problem
Has anyone figured out a workaround? I'm trying to run CST in batch mode and build, run, and save the model and export results all using a macro.
Thank you in advance.
I think it is what you have in your history that matters. So if you save whatever that is in the history tree to your vba file you should get everything when you run the macro .
Element7k,
Thanks for responding.
Yeah, saving the commands in the history list is how I build the macro. When I run the macro, I also add a save command to the end of it but when it saves the model, it doesn't include everything. When I open the saved model, it's missing ports, field monitors, and other things.
When I press save in the GUI after the macro runs, then it saves fine but when I have the macro do the saving, the file doesn't save properly. I think when the macro finishes it returns control to the GUI and it refreshes it somehow so it saves right. The problem is that in my application, I'm trying to bypass all the GUI commands and just run a macro, save the model, and close the program without any user interaction.
Thanks again.
perhaps you can use this before save/saveAs command to update the history:
AddToHistory ( string header, string contents ) bool
The explanation of how to use the above is from the CST Website:
Adds a new entry to the history list entitled header. The contents of the entry is stored in contents. This contents is executed through the VBA interpreter if this method is called. Therefore it must contain valid VBA commands for CST MICROWAVE STUDIO. If the new entry could be created and the contents could be executed AddToHistory returns True, otherwise False.
e.g.
Dim DiscretePort As Object
e.g. AddToHistory ("Define Discrete Port ", DiscretePort)
Thanks for the feedback.
I tried updating the history list but it still wouldn't save correctly. I reverted to building the model in the GUI, saving it (using the gui), and then using the macro to open the file and modify the parameters. This worked really well and saved simulation time because I didn't have to rebuild the model every time I wanted to simulate a different geometry.
- Syntax for rectenna efficiency using Qucsstudio
- Simulation of nanoantenna in CST Studio
- Looking surface current at which port out of many in cst microwave studio
- CST Studio Body size outside of dynamic range of 3D modeler
- [CST Microwave Studio] Liguid material simulations
- [CST Microwave Studio] Modified capacitor structure