import ScriptEnv proj_name = 'seg_return' design_name = 'HFSSDesign1' ScriptEnv.Initialize("Ansoft.ElectronicsDesktop") oDesktop.RestoreWindow() oProject = oDesktop.SetActiveProject(proj_name) oDesign = oProject.SetActiveDesign(design_name) oEditor = oDesign.SetActiveEditor("3D Modeler") oEditor.CreateBox(#PCB [ "NAME:BoxParameters", "XPosition:=" , "-BW/2", "YPosition:=" , "-BL/2", "ZPosition:=" , 0, "XSize:=" , "BW", "YSize:=" , "BL", "ZSize:=" , "BH" ], [ "NAME:Attributes", "Name:=" , "board", "Flags:=" , "", "Color:=" , "(255 128 0)", "Transparency:=" , 0.6, "PartCoordinateSystem:=", "Global", "UDMId:=" , "", "MaterialValue:=" , "\"FR4_epoxy\"", "SolveInside:=" , True ]) oEditor.CreateRectangle(#gnd [ "NAME:RectangleParameters", "IsCovered:=" , True, "XStart:=" , "-BW/2", "YStart:=" , "-BL/2", "ZStart:=" , 0, "Width:=" , "BW", "Height:=" , "BL", "WhichAxis:=" , "Z" ], [ "NAME:Attributes", "Name:=" , "gnd", "Flags:=" , "", "Color:=" , "(255 0 0)", "Transparency:=" , 0, "PartCoordinateSystem:=", "Global", "UDMId:=" , "", "MaterialValue:=" , "\"vacuum\"", "SolveInside:=" , True ]) oEditor.CreateRectangle(#trace [ "NAME:RectangleParameters", "IsCovered:=" , True, "XStart:=" , "-SW/2", "YStart:=" , "-BL/2", "ZStart:=" , "BH", "Width:=" , "SW", "Height:=" , "BL", "WhichAxis:=" , "Z" ], [ "NAME:Attributes", "Name:=" , "trace", "Flags:=" , "", "Color:=" , "(255 0 0)", "Transparency:=" , 0, "PartCoordinateSystem:=", "Global", "UDMId:=" , "", "MaterialValue:=" , "\"vacuum\"", "SolveInside:=" , True ]) oEditor.CreateRectangle(#gap [ "NAME:RectangleParameters", "IsCovered:=" , True, "XStart:=" , "GstartX", "YStart:=" , "GstartY", "ZStart:=" , 0, "Width:=" , "GL", "Height:=" , "GW", "WhichAxis:=" , "Z" ], [ "NAME:Attributes", "Name:=" , "gap", "Flags:=" , "", "Color:=" , "(255 0 0)", "Transparency:=" , 0, "PartCoordinateSystem:=", "Global", "UDMId:=" , "", "MaterialValue:=" , "\"vacuum\"", "SolveInside:=" , True ]) oEditor.Subtract(#Subtract gap [ "NAME:Selections", "Blank Parts:=" , "gnd", "Tool Parts:=" , "gap" ], [ "NAME:SubtractParameters", "KeepOriginals:=" , False ]) oEditor.CreateRectangle(#lump port [ "NAME:RectangleParameters", "IsCovered:=" , True, "XStart:=" , "-SW/2", "YStart:=" , "-BL/2", "ZStart:=" , 0, "Width:=" , "BH", "Height:=" , "SW", "WhichAxis:=" , "Y" ], [ "NAME:Attributes", "Name:=" , "port", "Flags:=" , "", "Color:=" , "(255 0 0)", "Transparency:=" , 0, "PartCoordinateSystem:=", "Global", "UDMId:=" , "", "MaterialValue:=" , "\"vacuum\"", "SolveInside:=" , True ]) oEditor.CreateRectangle(#term [ "NAME:RectangleParameters", "IsCovered:=" , True, "XStart:=" , "-SW/2", "YStart:=" , "BL/2", "ZStart:=" , 0, "Width:=" , "BH", "Height:=" , "SW", "WhichAxis:=" , "Y" ], [ "NAME:Attributes", "Name:=" , "termination", "Flags:=" , "", "Color:=" , "(255 0 0)", "Transparency:=" , 0, "PartCoordinateSystem:=", "Global", "UDMId:=" , "", "MaterialValue:=" , "\"vacuum\"", "SolveInside:=" , True ]) oEditor.CreateBox(#Air box [ "NAME:BoxParameters", "XPosition:=" , "-WAirBox/2", "YPosition:=" , "-LAirBox/2", "ZPosition:=" , "-HAirBox/2", "XSize:=" , "WAirBox", "YSize:=" , "LAirBox", "ZSize:=" , "HAirBox" ], [ "NAME:Attributes", "Name:=" , "airbox", "Flags:=" , "", "Color:=" , "(255 128 0)", "Transparency:=" , 1, "PartCoordinateSystem:=", "Global", "UDMId:=" , "", "MaterialValue:=" , "\"air\"", "SolveInside:=" , True ]) oModule = oDesign.GetModule("BoundarySetup") oModule.AssignRadiation( [ "NAME:Rad1", "Objects:=" , ["airbox"], "IsFssReference:=" , False, "IsForPML:=" , False ]) oModule.AssignLumpedPort( [ "NAME:1", "Objects:=" , ["port"], "RenormalizeAllTerminals:=", True, "DoDeembed:=" , False, [ "NAME:Modes", [ "NAME:Mode1", "ModeNum:=" , 1, "UseIntLine:=" , True, [ "NAME:IntLine", "Start:=" , ["0.","-100m","0mm"], "End:=" , ["0.","-100mm","1.5748mm"] ], "AlignmentGroup:=" , 0, "CharImp:=" , "Zpi", "RenormImp:=" , "50ohm" ] ], "ShowReporterFilter:=" , False, "ReporterFilter:=" , [True], "Impedance:=" , "50ohm" ]) oModule.AssignLumpedRLC( [ "NAME:LumpRLC1", "Objects:=" , ["termination"], [ "NAME:CurrentLine", "Start:=" , ["0","100mm","0"], "End:=" , ["0","100mm","1.5748mm"] ], "UseResist:=" , True, "Resistance:=" , "50ohm", "UseInduct:=" , False, "UseCap:=" , False ]) oModule.AssignPerfectE( [ "NAME:PerfE_trace", "Objects:=" , ["trace"], "InfGroundPlane:=" , False ]) oModule.AssignPerfectE( [ "NAME:PerfE_gnd", "Objects:=" , ["gnd"], "InfGroundPlane:=" , False ])