Looking for construction macros for CST
I am looking for more examples of macros for CST.
Mainly construction macros.
I wrote a macro for the construction of a dielectric rod, which I could share.
I was not able to figure out how to perform the LOFT COMMAND in a macro; same about select face etc.
The documentation provided by CST seems to be VERY poor.
At least they could have added one example per item in their VBA Macro Language "Help"
Kato01
Which of the CST products are you using?
Sorry, I'm talking about Microwave Studio
Hi kato01,
you're right about the lack of examples however I have a trick to propose.
Suppose for example that you want to use the LOFT method.You could create a dummy project where you could do a LOFT as usual,I mean Objects->Loft.Then,you could open the History and by choosing to Edit the Loft command (which will be obvious in the history list) you could figure out how this command (or method) is used.The same applies to any other method.Anyway,the syntax of the LOFT method is:
With Loft
.Reset
.Name <a string that contains the name of the solid to be created>
.Layer <a string that contains the name of the layer of that solid>
.Tangency <here goes the tagency,however please see Note1>
.CreateNew
End With
Note1:In version 4,you are allowed to give an numerical value as a string i.e. in the Tagency field you could enter either "0" or just 0.But in version 4.2 you can't use strings where numerical values are expected.I've no idea about other older versions,however bear this in mind cause it may cause bugs.
Note2:If you don't have the name of the solid etc stored in a string variable but you want to write it directly you must use double quotes.
(another bug source)
Note3:The LOFT method assumes that two faces have already been picked.So,the PICK method (or one of the many PICKs) you need is :
Pick.PickFaceFromId <the name of the layer>:<the name of the solid belonging to that layer> , ID
The ":" and "," above are required.
ID is a number describing the orientation of the selected face.Assume you have a cube.If you look at it towards -z then you see the face with ID=1.
+z ID=2
+y ID=3
+x ID=4
-y ID=5
-x ID=6
I don't know about a cylinder but you could create one and select all its faces in turn and see their ID by checking the history list.
By the way,I believe that *.mod examples are also very useful.There are some on the "CERN and C/S/T page" (link already posted).I've combed the web and found ... just those.Why?Is it illegal for one to publish them?Or just uncommon?
Anyway,I hope I helped you kato01.
Cheers
Hi all,
i think the macros are visual basic so nobody publishes them and most macros are written to cater to individual use so it might not be helpful to everyone. Most of the time they are very short about 1-20 lines. VB is easy to learn and your "trick" can be very helpful to hose who do not know the VB language. I think the examples in the advance manual is sufficent to get a beginner started on some simple projects.
I was just wondering how many people who uses MWS actually knows VB as well?
Cheers,
Element7k
Does there any example of macro of user defined goal optimization?such as coupler's phase error optimization?
I also think this is the easiest way to do macros in CST. I did some time ago a macro to draw the complete edge coupled filter once you supply dimensions in Edit/Parameters menu dialog box. It was completely relaying on examining History and writting a macro based on the content of commands inside it.
Concerning accessing more sophisticated features like optimization goals however History box might not supply valuable information at all, so I think this approach is not the right one. I am not sure for past releases, but for 5.1 version they included VBA macro help in Help menu, even postprocessing features are explained in details.
Probably manu of the custommers had complained in the past...
flyhigh