CST MW Studio VBA macro advice
时间:04-05
整理:3721RD
点击:
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
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 lossyWith 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" .CreateEnd 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" .CreateEnd With End Function Function set_vacuum 'define vacuumWith Material .Name "Vacuum" .Colour "0.5", "0.8", "1" .Wireframe "False" .Reflection "False" .Allowoutline "True" .Transparentoutline "False" .Transparency "52" .ChangeColourEnd With End Function
