CST - Can I run the optimizer on a structure created by VBA code?

 

Hi,
I created my antenna using VBA code, as this structure cannot be easily generated manually. However, I need to optimize 10 variables in this structure.

I created the structure programmatically and assigned parameterized variables to each object. For example:

With Brick
    .Reset
    .Name = "Nam"
    .Component = "component2"
    .Material = "PEC"
    .Xrange "-HG1/2", "HG1/2"
    .Yrange "-10", "10"
    .Zrange "-10", "10"
    .Create
End With

I also saved the macro to the CST Studio Suite  history list using Make a VBA macro.

Problems During Optimization:

  1. Structure Deletion:
    When I start the optimizer, it sometimes removes the entire structure despite the macro being in the history list.

Where the N is a byte and The param Function is a simple function:

I checked the 'Edit History' option and noticed that none of my code loaded in the history window. However, it was created with this line in History window!!!!

Assuming that I needed to add my macro code again, I pasted all of my macro code into the 'Edit History' window once more.

However, when I updated my history, I encountered this error:

However, as you can see, the 'End Sub' statement for my main subroutine does exist. I changed the Param(N) To Call Param(N) or Call Param N but none of them works fine. In addition, I put the MsgBox Str(N) before Param N, But in History window, when I click on the Update button, nothing is shown. 

 

2.Parameter Recognition Issues:

Even when the structure remains, optimizing variables HG1–HG10 triggers a warning: "None of the shape parameters are related to HG variables."

The default parameter values are correctly set during object creation, but no parameter details appear in the object properties.

 

Am I correct to assume that optimizing structures -created via VBA - is fundamentally incompatible with CST’s optimizer.

CST Studio Suite