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 Microwave Studio Macro - "Save" vba command problem

Status
Not open for further replies.

CST_beginner

Newbie level 3
Joined
Apr 20, 2011
Messages
3
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,308
I'm having trouble saving a model programmatically that was built using a strucure macro. For example, I'll build the geometry in the macro, define the ports and materials in the macro, then issue the "save" or "saveas" commands in the macro and a file appears when I run it but when I open the file, it only has the geometry and a few other parts. The ports, field monitors and other components are missing. When I save the model that was built with the macro using the button in the GUI, it saves fine. When I save it using the command at the end of the macro, it doesn't save right.

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.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top