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 MW Studio VBA macro advice

Status
Not open for further replies.

sylmarils

Newbie level 5
Joined
Sep 15, 2014
Messages
9
Helped
1
Reputation
2
Reaction score
1
Trophy points
3
Activity points
59
Hi Lads,

I created a macor to generate an antenna with a port and all but it doesnt update automatically when i chage the parameters. Some parts repeat themselves and i replace them with functions. Unfortunately the macro runs once but when i update it doesnt recognise the functions anymore and gives and error like nothing is declared. For some reason the functions do not get passed properly into CST.Here is a simple expample. Tried public declaration but no effect. Unfortunately i need to fix this as is because for any mods in the structure countelss number of lines require modifications-really hard to do it and confusing-the more complicated drawing funtions are some 2 pages long with numerous parameters

Really appreciate your help
Thanks Syl

Code:
sub main()
 set_fr4
 set_copper
 set_vacuum
 end sub

Public Function set_fr4
	'define substrate FR-4 lossy
	With Material
		     .Reset
		     .Name "FR-4 (lossy)"
		     .Folder ""
		.FrqType "all"
		.Type "Normal"
		.SetMaterialUnit "GHz", "mm"
		.Epsilon "4.3"
		.Mue "1.0"
		.Kappa "0.0"
		.TanD "0.025"
		.TanDFreq "10.0"
		.TanDGiven "True"
		.TanDModel "ConstTanD"
		.KappaM "0.0"
		.TanDM "0.0"
		.TanDMFreq "0.0"
		.TanDMGiven "False"
		.TanDMModel "ConstKappa"
		.DispModelEps "None"
		.DispModelMue "None"
		.DispersiveFittingSchemeEps "General 1st"
		.DispersiveFittingSchemeMue "General 1st"
		.UseGeneralDispersionEps "False"
		.UseGeneralDispersionMue "False"
		.Rho "0.0"
		.ThermalType "Normal"
		.ThermalConductivity "0.3"
		.SetActiveMaterial "all"
		.Colour "0.94", "0.82", "0.76"
		.Wireframe "False"
		.Transparency "0"
		.Create
	End With
End Function
Function set_copper

'define material: Copper (annealed)
With Material
		     .Reset
		     .Name "Copper (annealed)"
		     .Folder ""
		.FrqType "static"
		.Type "Normal"
		.SetMaterialUnit "Hz", "mm"
		.Epsilon "1"
		.Mue "1.0"
		.Kappa "5.8e+007"
		.TanD "0.0"
		.TanDFreq "0.0"
		.TanDGiven "False"
		.TanDModel "ConstTanD"
		.KappaM "0"
		.TanDM "0.0"
		.TanDMFreq "0.0"
		.TanDMGiven "False"
		.TanDMModel "ConstTanD"
		.DispModelEps "None"
		.DispModelMue "None"
		.DispersiveFittingSchemeEps "1st Order"
		.DispersiveFittingSchemeMue "1st Order"
		.UseGeneralDispersionEps "False"
		.UseGeneralDispersionMue "False"
		.FrqType "all"
		.Type "Lossy metal"
		.SetMaterialUnit "GHz", "mm"
		.Mue "1.0"
		.Kappa "5.8e+007"
		.Rho "8930.0"
		.ThermalType "Normal"
		.ThermalConductivity "401.0"
		.HeatCapacity "0.39"
		.MetabolicRate "0"
		.BloodFlow "0"
		.VoxelConvection "0"
		.MechanicsType "Isotropic"
		.YoungsModulus "120"
		.PoissonsRatio "0.33"
		.ThermalExpansionRate "17"
		.Colour "1", "1", "0"
		.Wireframe "False"
		.Reflection "False"
		.Allowoutline "True"
		.Transparentoutline "False"
		.Transparency "0"
		.Create
	End With
End Function
Function set_vacuum
'define vacuum
	With Material
		.Name "Vacuum"
		.Colour "0.5", "0.8", "1"
		.Wireframe "False"
		.Reflection "False"
		.Allowoutline "True"
		.Transparentoutline "False"
		.Transparency "52"
		.ChangeColour
	End With
End Function
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top