Continue to Site

# CST macro VBA for transform a sizes brick

Status
Not open for further replies.

#### ASAFBAROM

##### Newbie
Hi, I am a new user of CST software and I am interested in building a surface that will consist of an array of 100 cells (copper) so that each cell is small according to its location.
Suppose the cell in the center is 1X1 millimeters and the cells on its sides are 0.98 millimeters and the following are 0.96, 0.94, etc ...
To the best of my knowledge I need to write VBA code.
I would love help writing the code.

Thanks for the helpers

Hi,
I would love help writing the code.
"helping" usually means taht you show what you did so far, what internet sites and documents you read, you tell what you understand so far and what you don´t understand.

You show your code and we "help" you to rectify mistakes.

Klaus

Hi, I am a new user of CST software and I am interested in building a surface that will consist of an array of 100 cells (copper) so that each cell is small according to its location.
Suppose the cell in the center is 1X1 millimeters and the cells on its sides are 0.98 millimeters and the following are 0.96, 0.94, etc ...
Here the VBA code i did for now, that code creat only the first brick and no enter to the for loop.

Code:
' PATCHS
Sub Main ()
With Brick

.Reset
.Name "PATCH"
.Component "component1"
.Material "Copper (pure)"
.Xrange "(-0.25)+(a*b)", "0.25-(a*b)"
.Yrange "(-0.25)+(a*b)", "0.25-(a*b)"
.Zrange "2", "2.035"
.Create
End With

Dim a As Integer
Dim b As Double
b= 0.002

For a=0 To 48

With Transform
.Reset
.Name "component1ATCH_a"
.Vector "2*W", "0", "0"
.UsePickedPoints "False"
.InvertPickedPoints "False"
.MultipleObjects "True"
.GroupObjects "False"
.Repetitions "100"
.MultipleSelection "False"
.Destination ""
.Material ""
.Transform "Shape", "Translate"
End With
Next
End Sub

Thanks for the helpers

Last edited by a moderator:

Status
Not open for further replies.