- 易迪拓培训,专注于微波、射频、天线设计工程师的培养
HFSS15: Named Array Values with All Key Value Pairs
While it is in general not allowed to replace the arrays and nested arrays with python dictionaries, in the case where the named array consists entirely of key value pairs (like the sample above), one can use a dictionary and avoid typing the trailing “:=” symbols after the keys. This further aids readability of the script.
If all key value pairs
Remove the trailing “:=” after each key
Replace the “,” after the key with a “:”
If the named array is the top level argument, ensure that the “NAME:name” is present and is split into “NAME” : “name” as a key value pair
Enclose the converted array in a { } pair to declare the dictionary.
oEditor.CreateCone(
{
"NAME" : "ConeParameters",
"XCenter" : "0mm",
"YCenter" : "0mm",
"ZCenter" : "0mm",
"WhichAxis" : "Z",
"Height" : "2mm",
"BottomRadius": "1.56204993518133mm",
"TopRadius" : "0mm"
},
{
"NAME" : "Attributes",
"Name" : "Cone1",
"Flags" : "",
"Color" : "(132 132 193)",
"Transparency" : 0,
"PartCoordinateSystem": "Global",
"UDMId" : "",
"MaterialValue" : ""vacuum"",
"SolveInside" : True
}
Sample Script 6: CreateCone in IronPython using dictionary syntax