微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 电磁仿真讨论 > Need CST macro that updates the structure when changing the parameter

Need CST macro that updates the structure when changing the parameter

时间:03-30 整理:3721RD 点击:
I have write a macro that makes an universal antenna.

everything works but when I change a parameter in the parameter list I get a error:

Expecting an existing scalar var. (I=0)


Can anyone help me?

ps I'm sorry for my bad englisch I'm from germany:)




Here is the code I use:

' rotation2

Sub Main ()

GoTo Back

Exists:
Component.Delete "component1"
I=0
GoTo Back

Back:


' StoreParameter("t",1 )
' StoreParameter("b", 2)
' StoreParameter("lam", 20)'lambda
' StoreParameter("a", 5)'Winkel a
' StoreParameter("r3",7)'Innenradius Stufe3
' StoreParameter("r2",5)'Innenradius Stufe2
' StoreParameter("r1",3)'Innenradius Stufe1
' StoreParameter("l3",5)'Laenge Stufe3
' StoreParameter("l2",5)'Laenge Stufe2
' StoreParameter("l1",5)'Laenge Stufe1
' StoreParameter("d",2)'Wanddicke
' StoreParameter("l",100)'Laenge des gesammten Rillenhorns


a1=((90-a)*pi/180)


With Rotate
.Reset
.Name "solid1"
.Component "component1"
.Material "Vacuum"
.Mode "Pointlist"
.StartAngle "0.0"
.Angle "360"
.Height "0.0"
.RadiusRatio "1.0"
.NSteps "0"
.SplitClosedEdges "True"
.SegmentedProfile "False"
.SimplifySolid "True"
.UseAdvancedSegmentedRotation "True"
.Origin "0.0", "0", "0.0"
.Rvector "1.0", "0.0", "0.0"
.Zvector "1.0", "0.0", "0.0"




.Point 0,lam/2+r3


Do

'xx=I*b+I*t
.LineTo I*b+I*t,lam/2+r3

xx=(I+1)*b+I*t
.LineTo xx,lam/2+r3

xx=(I+1)*b+I*t
yy=(((I+1)*b+I*t)/Tan(a1))+r3
.LineTo xx,yy

xx=(I+1)*b+(I+1)*t
yy=(((I+1)*b+(I+1)*t)/Tan(a1))+r3
.LineTo xx,yy

I=I+1


Loop Until ((I+1)*b+(I+1)*t-(b/2)-t)/Tan(a1)> lam/4

cx=I*b+I*t
Cy=(((I*b)+(I*t))/Tan(a1))+r3

lange=cx+l1+l2+l3
I=0


Do

xx=I*b+I*t
yy=(lam/4)+((I*b+I*t)/Tan(a1))
.LineTo xx+cx,yy+Cy

xx=(I+1)*b+I*t
yy=(lam/4)+((I*b+I*t)/Tan(a1))
.LineTo xx+cx,yy+Cy

xx=(I+1)*b+I*t
yy=((I+1)*b+I*t)/Tan(a1)
.LineTo xx+cx,yy+Cy

xx=(I+1)*b+(I+1)*t
yy=((I+1)*b+(I+1)*t)/Tan(a1)
.LineTo xx+cx,yy+Cy

I=I+1


Loop Until (I*t)+(I*b)+lange >l


.LineTo cx+I*(b+t),((cx+I*(b+t))/Tan(a1))+ (lam/4)+d+r3
.LineTo 0,((cx+I*(b+t))/Tan(a1))+ (lam/4)+d+r3
.LineTo 0,lam/2+r3

On Error GoTo Exists
.Create
End With

With Rotate
.Reset
.Name "solid2"
.Component "component1"
.Material "Vacuum"
.Mode "Pointlist"
.StartAngle "0.0"
.Angle "360"
.Height "0.0"
.RadiusRatio "1.0"
.NSteps "0"
.SplitClosedEdges "True"
.SegmentedProfile "False"
.SimplifySolid "True"
.UseAdvancedSegmentedRotation "True"
.Origin "0.0", "0", "0.0"
.Rvector "1.0", "0.0", "0.0"
.Zvector "1.0", "0.0", "0.0"

.Point 0,r3
.LineTo -l3,r3
.LineTo -l3,r2
.LineTo -(l2+l3),r2
.LineTo -(l2+l3),r1
.LineTo -(l1+l2+l3),r1
.LineTo -(l1+l2+l3),((cx+I*(b+t))/Tan(a1))+ (lam/4)+d+r3
.LineTo 0,((cx+I*(b+t))/Tan(a1))+ (lam/4)+d+r3
.LineTo 0,r3

.Create

End With

End Sub

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top