2010101493952386668.pdf

download 2010101493952386668.pdf

of 308

Transcript of 2010101493952386668.pdf

  • 8/10/2019 2010101493952386668.pdf

    1/308

    Introduction to Scriptingin HFSS

    December 2007

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    2/308

  • 8/10/2019 2010101493952386668.pdf

    3/308

    Introduction to Scripting in HFSS

    ii i

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    4/308

    Introduction to Scripting in HFSS

    iv

    Getting HelpAnsoft Technical SupportTo contact Ansoft technical support staff in your geographical area,please log on to the Ansoft corporate website, http://www.ansoft.com ,click the Contact button, and then click Support . Your Ansoft sales engi-neer may also be contacted in order to obtain this information.E-mail can work well for technical support. All Ansoft software files areASCII text and can be sent conveniently by e-mail. When reporting diffi-culties, it is extremely helpful to include very specific information aboutwhat steps were taken or what stages the simulation reached. Thisallows more rapid and effective debugging.

    Context Sensitive HelpTo access online help from the HFSS user interface, do one of the follow-ing: To open a help topic about an HFSS menu command, press Shift +F1 ,

    and then click the command or toolbar icon. To open a help topic about an HFSS dialog box, open the dialog box,

    and then press F1 .

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.ansoft.com/http://www.cadfamily.com/http://www.ansoft.com/
  • 8/10/2019 2010101493952386668.pdf

    5/308

  • 8/10/2019 2010101493952386668.pdf

    6/308

    Introduction to Scripting in HFSS

    Contents-2

    Recording a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6Stopping Script Recording . . . . . . . . . . . . . . . . . . . . . . . . . 2-6

    Running a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6Pausing and Resuming a Script . . . . . . . . . . . . . . . . . . . . 2-7Stopping a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7Modifying a Script for Easier Playback . . . . . . . . . . . . . . . 2-7HFSS Scripting Conventions . . . . . . . . . . . . . . . . . . . . . . . 2-8

    Syntax Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8Script Command Conventions . . . . . . . . . . . . . . . . . . . . . 2-8Named Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9Setting Numerical Values . . . . . . . . . . . . . . . . . . . . . . . . . 2-10

    Executing a Script from Within a Script . . . . . . . . . . . . . . . 2-11Editing Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12

    3. Ansoft Application Object Script CommandsGetAppDesktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2SetDesiredRamMBLimit . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

    SetMaximumRamMBLimit . . . . . . . . . . . . . . . . . . . . . . . . 3-2

    SetNumberOfProcessors . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

    GetDesiredRamMBLimit . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

    GetMaximumRamMBLimit . . . . . . . . . . . . . . . . . . . . . . . . 3-3

    GetNumberOfProcessors . . . . . . . . . . . . . . . . . . . . . . . . . 3-3

    4. Desktop Object Script CommandsCloseAllWindows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2

    CloseProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2

    CloseProjectNoForce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2

    Count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2

    EnableAutoSave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3

    GetActiveProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3

    GetAutoSaveEnabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4

    GetDesigns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4

    GetDistributedAnalysisMachines . . . . . . . . . . . . . . . . . . . 4-4

    GetName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    7/308

    Introduction to Scripting in HFSS

    Contents-3

    GetLibraryDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5

    GetProjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5

    GetProjectDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5GetProjectList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5

    GetTempDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

    GetVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

    NewProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

    OpenMultipleProjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

    OpenProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7

    PauseScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7

    Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7

    QuitApplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7

    RestoreWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8

    RunProgram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8

    RunScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9

    SetActiveProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9

    SetActiveProjectByPath . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10

    SetLibraryDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10

    SetProjectDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10

    SetTempDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10

    Sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11

    5. Project Object Script CommandsClose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2

    CopyDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2

    CutDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2

    DeleteDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2

    GetActiveDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3GetDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3

    GetName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3

    GetPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3

    GetTopDesignList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4

    InsertDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4

    Paste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    8/308

    Introduction to Scripting in HFSS

    Contents-4

    Redo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5

    Save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5

    SaveAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5

    SetActiveDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5

    SimulateAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6

    Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6

    6. Material Script Commands AddMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2

    EditMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3ExportMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3

    RemoveMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4

    7. Property Script CommandsChangeProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3

    Additional Property Scripting Commands . . . . . . . . . . . . . 7-9GetProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9

    GetPropertyValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9

    GetVariables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10

    GetVariableValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10

    SetPropertyValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10

    SetVariableValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11

    Additional Property Scripting Example . . . . . . . . . . . . . . . 7-11Example Use of Record Script and Edit Properties . . . . . 7-12

    8. Dataset Script Commands AddDataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2

    DeleteDataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2

    EditDataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-29. Design Object Script Commands

    ApplyMeshOps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2

    AnalyzeDistributed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2

    AssignDCThickness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2

    ConstructVariationString . . . . . . . . . . . . . . . . . . . . . . . . . 9-3

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    9/308

    Introduction to Scripting in HFSS

    Contents-5

    DeleteLinkedDataVariation . . . . . . . . . . . . . . . . . . . . . . . 9-3

    ExportConvergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3

    ExportMeshStats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4

    ExportProfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5

    GetModule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5

    GetName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6

    GetNominalVariation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6

    GetSolutionType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6

    GetVariationVariableValue . . . . . . . . . . . . . . . . . . . . . . . . 9-6

    Redo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7

    RenameDesignInstance . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7

    SARSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7

    SetActiveEditor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8

    SetSolutionType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8

    Solve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8

    Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9

    10. 3D Modeler Editor Script CommandsDraw Menu Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2

    CreateBondwire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2

    CreateBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3

    CreateCircle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4CreateCone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5

    CreateCutplane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5

    CreateCylinder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-6

    CreateEllipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-6

    CreateHelix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7

    CreatePoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7

    CreatePolyline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8

    CreateRectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-9

    CreateRegion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-9

    CreateRegularPolyhedron . . . . . . . . . . . . . . . . . . . . . . . 10-10

    CreateRegularPolygon . . . . . . . . . . . . . . . . . . . . . . . . . . 10-11

    CreateSphere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-12

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    10/308

    Introduction to Scripting in HFSS

    Contents-6

    CreateSpiral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-12

    CreateTorus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13

    EditPolyline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13

    InsertPolylineSegment . . . . . . . . . . . . . . . . . . . . . . . . . . 10-14

    SweepAlongPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-15

    SweepAlongVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-16

    SweepAroundAxis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-16

    Edit Menu Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17Copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17

    DeletePolylinePoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17

    DuplicateAlongLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-18

    DuplicateAroundAxis . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-18

    DuplicateMirror . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19

    Mirror . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19

    Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20

    OffsetFaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20

    Paste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20

    Rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20

    Scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-21

    3D Modeler Menu Commands . . . . . . . . . . . . . . . . . . . . 10-21 AssignMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-21

    Chamfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22

    Connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22

    CoverLines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22

    CoverSurfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22

    CreateEntityList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23

    CreateFaceCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-23

    CreateObjectFromEdges . . . . . . . . . . . . . . . . . . . . . . . . 10-25CreateObjectFromFaces . . . . . . . . . . . . . . . . . . . . . . . . 10-26

    CreateRelativeCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-26

    DeleteLastOperation . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-27

    DetachFaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-27

    EditEntityList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-28

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    11/308

    Introduction to Scripting in HFSS

    Contents-7

    EditFaceCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-28

    EditRelativeCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-28

    Export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-29

    Fillet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-29

    GenerateHistory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-30

    Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-30

    Intersect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-30

    MoveFaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-31

    PurgeHistory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-32

    Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-32

    SeparateBody . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-33

    SetModelUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-33

    SetWCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-33

    ShowWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-34

    Split . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-34

    Subtract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-34

    UncoverFaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-35

    Unite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-36

    Other oEditor Commands . . . . . . . . . . . . . . . . . . . . . . . . 10-36Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-36

    GetModelBoundingBox . . . . . . . . . . . . . . . . . . . . . . . . . 10-36

    GetEdgeByPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-37

    GetFaceCenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-37

    GetFaceByPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-37

    GetUserPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-38

    GetObjectName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-38

    GetMatchedObjectName . . . . . . . . . . . . . . . . . . . . . . . . 10-38

    GetNumObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-39PageSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-39

    RenamePart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-39

    11. Output Variable Script CommandsCreateOutputVariable . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2

    DeleteOutputVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    12/308

    Introduction to Scripting in HFSS

    Contents-8

    DoesOutputVariableExist . . . . . . . . . . . . . . . . . . . . . . . . 11-3

    EditOutputVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3

    GetOutputVariables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-4

    GetOutputVariableValue . . . . . . . . . . . . . . . . . . . . . . . . 11-4

    12. Reporter Editor Script Commands AddCartesianXMarker . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2

    AddDeltaMarker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2

    AddMarker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3

    AddNote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3 AddTraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4

    ClearAllMarkers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6

    CopyTracesData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6

    CopyReportData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7

    CopyReportDefinitions . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7

    CopyTraceDefinitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7CreateReport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-8

    CreateReportFromTemplate . . . . . . . . . . . . . . . . . . . . . 12-11

    DeleteAllReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11

    DeleteReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12

    DeleteTraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12

    ExportToFile [Reporter] . . . . . . . . . . . . . . . . . . . . . . . . . 12-13GetAllReportNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-13

    GetDisplayType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-13

    ImportIntoReport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-14

    PasteReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-15

    PasteTraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-15

    RenameReport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-15

    RenameTrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16

    UpdateTraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16

    UpdateTracesContextandSweeps . . . . . . . . . . . . . . . . . 12-18

    13. Boundary and Excitation Module Script Com

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    13/308

    Introduction to Scripting in HFSS

    Contents-9

    mandsGeneral Commands Recognized by the

    Boundary/Excitations Module . . . . . . . . . . . . . . . . . . . . . 13-2 AutoIdentifyPorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2

    AutoIdentifyTerminals . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3

    ChangeImpedanceMult . . . . . . . . . . . . . . . . . . . . . . . . . 13-3

    DeleteAllBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3

    DeleteAllExcitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4

    DeleteBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4GetBoundaryAssignment . . . . . . . . . . . . . . . . . . . . . . . . 13-4

    GetBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4

    GetBoundariesOfType . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5

    GetExcitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5

    GetExcitationsOfType . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5

    GetNumBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5

    GetNumBoundariesOfType . . . . . . . . . . . . . . . . . . . . . . 13-6

    GetNumExcitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-6

    GetNumExcitationsOfType . . . . . . . . . . . . . . . . . . . . . . . 13-6

    GetPortExcitationCounts . . . . . . . . . . . . . . . . . . . . . . . . 13-6

    ReassignBoundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-7

    RenameBoundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-7

    ReprioritizeBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . 13-7

    Script Commands for Creating and ModifyingBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-9

    AssignCurent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-9

    AssignFiniteCond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-9

    AssignImpedance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-10

    AssignIncidentWave . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-11

    AssignLayeredImp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-12

    AssignLumpedPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-13

    AssignLumpedRLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-14

    AssignMagneticBias . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-15

    AssignMaster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-16

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    14/308

    Introduction to Scripting in HFSS

    Contents-10

    AssignPerfectE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-17

    AssignPerfectH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-17

    AssignRadiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-17

    AssignSlave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-18

    AssignSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-19

    AssignTerminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-19

    AssignVoltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-20

    AssignWavePort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-21

    EditCurrent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-23

    EditDiffPairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-23

    EditFiniteCond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-24

    EditImpedance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-24

    EditIncidentWave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-24

    EditLayeredImpedance . . . . . . . . . . . . . . . . . . . . . . . . . 13-25

    EditMaster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-25

    EditPerfectE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-25

    EditPerfectH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-25

    EditLumpedPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-25

    EditLumpedRLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-26

    EditMagneticBias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-26

    EditRadiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-26

    EditSlave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-26

    EditSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-26

    EditTerminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-26

    EditVoltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-27

    EditWavePort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-27

    SetTerminalReferenceImpedances . . . . . . . . . . . . . . . . 13-27

    Script Commands for Creating and Modifying PMLs . . . 13-29CreatePML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-29

    ModifyPMLGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-30

    PMLGroupCreated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-31

    PMLGroupModified . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-31

    RecalculatePMLMaterials . . . . . . . . . . . . . . . . . . . . . . . 13-32

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    15/308

    Introduction to Scripting in HFSS

    Contents-11

    14. Mesh Operations Module Script CommandsGeneral Commands Recognized by the Mesh Operations

    Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2DeleteOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2

    GetOperationNames . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2

    RenameOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2

    Script Commands for Creating and Modifying MeshOperations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-4

    AssignLengthOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-4 AssignModelResolutionOp . . . . . . . . . . . . . . . . . . . . . . . 14-5

    AssignSkinDepthOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-5

    AssignTrueSurfOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-6

    EditLengthOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-7

    EditModelResolutionOp . . . . . . . . . . . . . . . . . . . . . . . . . 14-7

    EditSkinDepthOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-8

    EditTrueSurfOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-8

    15. Analysis Module Script CommandsDeleteDrivenSweep . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2

    DeleteSetups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2

    EditFrequencySweep . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2

    EditSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-3GetSetups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-3

    GetSweeps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-4

    InsertFrequencySweep . . . . . . . . . . . . . . . . . . . . . . . . . 15-4

    InsertSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7

    RenameDrivenSweep . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10

    RenameSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10RevertAllToInitial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-11

    RevertSetupToInitial . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-11

    SolveSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-11

    16. Optimetrics Module Script CommandsGeneral Commands Recognized by the Optimetrics

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    16/308

    Introduction to Scripting in HFSS

    Contents-12

    Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-5DeleteSetups [Optimetrics] . . . . . . . . . . . . . . . . . . . . . . 16-5

    DistributedAnalyzeSetup . . . . . . . . . . . . . . . . . . . . . . . . 16-5

    GetSetupNames [Optimetrics] . . . . . . . . . . . . . . . . . . . . 16-5

    GetSetupNamesByType [Optimetrics] . . . . . . . . . . . . . . 16-5

    RenameSetup [Optimetrics] . . . . . . . . . . . . . . . . . . . . . . 16-6

    SolveSetup [Optimetrics] . . . . . . . . . . . . . . . . . . . . . . . . 16-6

    Parametric Script Commands . . . . . . . . . . . . . . . . . . . . . 16-7EditSetup [Parametric] . . . . . . . . . . . . . . . . . . . . . . . . . . 16-7

    InsertSetup [Parametric] . . . . . . . . . . . . . . . . . . . . . . . . 16-7

    Optimization Script Commands . . . . . . . . . . . . . . . . . . . . 16-10EditSetup [Optimization] . . . . . . . . . . . . . . . . . . . . . . . . . 16-10

    InsertSetup [Optimization] . . . . . . . . . . . . . . . . . . . . . . . 16-10

    Sensitivity Script Commands . . . . . . . . . . . . . . . . . . . . . 16-14EditSetup [Sensitivity] . . . . . . . . . . . . . . . . . . . . . . . . . . 16-14

    InsertSetup [Sensitivity] . . . . . . . . . . . . . . . . . . . . . . . . . 16-14

    Statistical Script Commands . . . . . . . . . . . . . . . . . . . . . . 16-16EditSetup [Statistical] . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-16

    InsertSetup [Statistical] . . . . . . . . . . . . . . . . . . . . . . . . . 16-16

    17. Solutions Module Script Commands

    DeleteAllReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2DeleteImportData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2

    EditSources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2

    DeleteSolutionVariation . . . . . . . . . . . . . . . . . . . . . . . . . 17-4

    DeleteVariation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-5

    ExportForSpice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-5

    ExportEigenmodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7

    ExportForHSpice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7

    ExportNetworkData . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-9

    ExportNMFData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-10

    GetAdaptiveFreq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-11

    GetISolutionVersionID . . . . . . . . . . . . . . . . . . . . . . . . . . 17-11

    GetSolveRangeInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-11

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    17/308

    Introduction to Scripting in HFSS

    Contents-13

    GetValidISolutionList . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-11

    HasFields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-12

    HasMatrixData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-12

    HasMesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-13

    ImportSolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-13

    ImportTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-14

    IsFieldAvailableAt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-15

    ListMatchingVariations . . . . . . . . . . . . . . . . . . . . . . . . . . 17-16

    ListValuesOfVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-16

    ListVariations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-16

    18. Field Overlays Module Script CommandsCreateFieldPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-2

    DeleteFieldPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6

    GetFieldPlotNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6

    ModifyFieldPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-7RenameFieldPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-8

    RenamePlotFolder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-8

    SetFieldPlotSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-8

    SetPlotFolderSettings . . . . . . . . . . . . . . . . . . . . . . . . . . 18-9

    19. Fields Calculator Script Commands AddNamedExpression . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2 AddNamedExpr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2

    CalcOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2

    CalculatorRead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-3

    CalcStack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-3

    CalculatorWrite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-3

    ChangeGeomSettings . . . . . . . . . . . . . . . . . . . . . . . . . . 19-4ClcEval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-4

    ClcMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-5

    ClearAllNamedExpr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-5

    CopyNamedExprToStack . . . . . . . . . . . . . . . . . . . . . . . . 19-5

    DeleteNamedExpr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-5

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    18/308

    Introduction to Scripting in HFSS

    Contents-14

    EnterComplex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-6

    EnterComplexVector . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-6

    EnterLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-7

    EnterPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-7

    EnterQty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-7

    EnterScalar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-7

    EnterScalarFunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8

    EnterSurf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8

    EnterVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8

    EnterVectorFunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-9

    EnterVol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-9

    ExportOnGrid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-9

    ExportToFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-10

    GetTopEntryValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-10

    LoadNamedExpressions . . . . . . . . . . . . . . . . . . . . . . . . 19-11

    SaveNamedExpressions . . . . . . . . . . . . . . . . . . . . . . . . 19-12

    20. Radiation Module Script CommandsGeneral Commands Recognized by the RadiationModule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2

    DeleteFarFieldSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2

    DeleteNearFieldSetup . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2

    GetSetupNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2

    RenameSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-3

    Script Commands for Creating and Modifying RadiationSetups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-4

    EditFarFieldSphereSetup . . . . . . . . . . . . . . . . . . . . . . . . 20-4

    EditNearFieldLineSetup . . . . . . . . . . . . . . . . . . . . . . . . . 20-4

    EditNearFieldSphereSetup . . . . . . . . . . . . . . . . . . . . . . 20-4

    InsertFarFieldSphereSetup . . . . . . . . . . . . . . . . . . . . . . 20-5

    InsertNearFieldLineSetup . . . . . . . . . . . . . . . . . . . . . . . 20-6

    InsertNearFieldSphereSetup . . . . . . . . . . . . . . . . . . . . . 20-7

    Script Commands for Modifying Antenna Array Setups . 20-8EditAntennaArraySetup . . . . . . . . . . . . . . . . . . . . . . . . . 20-8

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    19/308

    Introduction to Scripting in HFSS

    Contents-15

    Script Commands for Exporting Antenna Parameters and MaxField Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-12

    ExportRadiationParametersToFile . . . . . . . . . . . . . . . . . 20-12

    21. Example ScriptsVariable Helix Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-2HFSS Data Export Script . . . . . . . . . . . . . . . . . . . . . . . . . 21-6

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    20/308

  • 8/10/2019 2010101493952386668.pdf

    21/308

    Introduction to VBScript 1-1

    1 Introduction to VBScript

    HFSS uses the Microsoft Visual Basic Scripting Edition (VBScript) scriptinglanguage to record macros. VBScript is based on the Microsoft Visual Basicprogramming language.

    Using scripts is a fast, effective way to accomplish tasks you want to repeat.When you execute a script, the commands in the script are performed.You can write a script using any text editor or you can record a script fromwithin the HFSS interface. After recording the script from within HFSS, youcan then modify it if necessary using a text editor.Although HFSS records scripts in VBScript format, it can also execute scriptsin JavaScript TM format. If you are running a script from a command prompt,

    the script can be written in any language that provides the Microsoft COMmethods. The HFSS scripting documentation refers to VBScript format only.This chapter provides an overview of key VBScript components. For moredetails about VBScript, please see the Recommended VBScript References section at the end of this chapter.

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    22/308

    Introduction to Scripting in HFSS

    1-2 Introduction to VBScript

    A Sample HFSS ScriptFollowing is an example of an HFSS script. It includes comment lines, which are preceded byeither an apostrophe ( ) or the word REM, that offer explanations for each preceding line orlines. VBScript keywords appear in bold font.

    ---------------------------------------------- Scr i pt Recor ded by Ansof t HFSS Ver si on 10. 0 11: 03 AM May 3, 2005 ----------------------------------------------

    Dim oDesi gnDim oEdi t orDim oModul eREMDim is used to declare variables. Dim means dimension. In VBScript you can use Dim ,REM Public , or Private to declare variables. As VBScript has no built-in data types (likeREM integer, string, etc.), all variables are treated as variants, which can store any type of REM information. In this example, the three variables will be used as objects. WhenREM recording scripts in HFSS, variants that will be used as objects always begin with o .

    Set oAnsof t App = Cr eat eObj ect ( " Ansof t Hf ss. Hf ssScr i pt I nt er f ace" ) You can use Set to assign an object reference to a variable. A copy of the object is not created for that variable. Here Cr eat eObj ect is a function that takes a string as input

    and returns an object. The object is assigned to the variable oAnsof t App .

    Set oDeskt op = oAnsof t App. Get AppDeskt op( ) Get AppDeskt op is a function of oAnsof t App . This function does not take an input and it returns an object. The object is assigned to the variable oDeskt op .

    oDeskt op. NewPr oj ect In VBScript, a Sub procedure is a procedure that is called by name, can receive arguments, and can perform a specific task with a group of statements. Here the Sub procedure NewPr oj ect of the object oDeskt op is called. This Sub does not take an input.

    Set oProj ect = oDeskt op. Get Act i vePr oj ectoPr oj ect . I nser t Desi gn "Hf ss" , "HFSSDesi gn1", "Dr i venModal " , ""

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    23/308

    Introduction to Scripting in HFSS

    Introduction to VBScript 1-3

    In a Sub or Function procedure call, you can group the input parameters inside parentheses or without parentheses. Here the four strings are the input parameters of the Sub procedure I nser t Desi gn of the object oPr oj ect .

    Set oDesi gn = oPr oj ect . Set Act i veDesi gn( " HFSSDesi gn1" )Set oEdi t or = oDesi gn. Set Act i veEdi t or ( " 3D Model er " )oEdi t or . Cr eat eBox Array ( " NAME: BoxPar amet er s" , " XPosi t i on: =" , _

    " 0mm " , "YPos i t i on: =" , " 0mm " , "ZPos i t i on: =" , " 0mm " , _ "XSi ze: =", " 1.6mm " , "YSi ze: =" , " 1.2mm ", "ZSi ze: =", _

    " 0.8mm " ) , Array ( " NAME: At t r i but es", " Name: =" , " Box1 " , "F l ags : =" , _ "" , "Col or : =" , " ( 132 132 193 ) " , "Tr anspar ency: =" , _ 0.400000005960464 , "Par t Coor di nat eSyst em: =" , _ " Global " , " Mat er i al Name: =" , " vacuum ", "Sol veI ns i de: =", true )

    oEdi t or . Cr eat eBox is a Sub procedure that takes two array variables as input. The first array is for the boxs geometric parameters and the second array is for the boxs attributes. You can modify the italicized entries to create a different box. In VBScript, Array is a function that returns a variant containing an array. The underscore character ( _ ) here indicates that the statement continues to the next line. The underscore character must be placed outside of string constants, or else VBScript will recognize the character as part of the string constant rather than an indication that the string continues on the next line. Following is an example of proper use of the underscore character:

    Msgbox( " Pl ease i ncl ude uni t s when cr eat i ng var i abl es " & _ " t hat r equi r e di mensi ons. " Following is an example of improper use of the underscore character: Msgbox( " Pl ease i ncl ude uni t s when cr eat i ng var i abl es _ t hat r equi r e di mensi ons. "

    For additional HFSS script examples, see Chapter 20, Example Scripts .

    VBScript VariablesA VBScript variable is a placeholder representing information that may change during the timeyour script is running. Use a variable name in a script to view or modify its value.

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    24/308

    Introduction to Scripting in HFSS

    1-4 Introduction to VBScript

    Declaring VariablesTo declare variables explicitly in a script, use the Di m, Publ i c , or Pr i vat e statements. Forexample:

    Di m box_xsi ze

    After declaring a variable, you can assign information to it. For example:

    box_xs i ze = " 3mm"

    Array VariablesCreate an array variable when you want to assign more than one related value to a single vari-able. An array variable contains a series of values. For example:

    Di m Pr i mi t i ves( 2)

    All arrays in VBScript are zero-based, so the array above actually contains 3 elements. You assigndata to each of the arrays elements using an index into the array. Data can be assigned to the

    elements of an array as follows:Pri mi t i ves( 0) = " Box1"Pr i mi t i ves( 1) = " Cone1"Pr i mi t i ves( 2) = " Cyl i nder 1"

    Similarly, the data can be retrieved from any element using an index into a particular array ele-ment. For example:

    one_pr i m = Pr i mi t i ves( 1)

    You can also use the Array function to assign an array of elements to a variable. For example:

    Di m Pr i mi t i vesPr i mi t i ves = Ar r ay ( " Box1", "cone1", " Cyl i nder 1")

    VBScript OperatorsVBScript provides operators, which are grouped into these categories: arithmetic operators,comparison operators, and logical operators.Please see the online VBScript Users Guide for more details.

    Note When using the Array function, do not use parentheses on the variable when it is

    declared. For example, use Di m myar r ay , not Di m myar r ay( ) .

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    25/308

    Introduction to Scripting in HFSS

    Introduction to VBScript 1-5

    Operator PrecedenceWhen several operations occur in an expression, each part is evaluated and resolved in a pre-determined order, called operator precedence. You can use parentheses to override the order ofprecedence and force some parts of an expression to be evaluated before others. Operationswithin parentheses are always performed before those outside the parentheses. Within paren-theses, however, standard operator precedence is maintained.When expressions contain operators from more than one category, arithmetic operators areevaluated first, comparison operators are evaluated next, and logical operators are evaulatedlast. Comparison operators all have equal precedence, that is, they are evaluated in the left-to-right order in which they appear. Arithmetic and logical operators are evaluated in the following

    order of precedence.

    Arithmetic OperatorsFollowing is a list of VBScripts arithmetic operators.

    Comparison OperatorsFollowing is a list of VBScripts comparison operators.

    Symbol Description

    ^ Exponentiation

    - Unary negation

    * Multiplication

    / Division

    \ Integer division

    Mod Modulus arithmetic

    +Addition

    - Subtraction

    & String concatenation

    Symbol Description

    = Equality

    Inequality

    < Less than

    > Greater than

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    26/308

    Introduction to Scripting in HFSS

    1-6 Introduction to VBScript

    Logical OperatorsFollowing is a list of VBScripts logical operators:

    Controlling Program ExecutionYou can use conditional statements to control the flow of a script. There are two types of condi-tional statements in VBScript: I f . . . Then. . . El se Sel ect Case

    Using If...Then...ElseFollowing is an example that demonstrates the I f . . . Then. . . El se conditional statement:

    I f obj = " Box1" Then

    El seI f obj = "Cyl i nder 1" Then

    El s e

    End I f

    Using Select CaseFollowing is an example that demonstrates the Sel ect Case conditional statement:

    = Greater than or equal to

    I s Object equivalence

    Symbol Description

    Not Logical negation

    And Logical conjunction

    Or Logical disjunction

    Xor Logical exclusion

    Eqv Logical equivalence

    I mp Logical implication

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    I d i S i i i HFSS

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    27/308

    Introduction to Scripting in HFSS

    Introduction to VBScript 1-7

    Sel ect Case pr i mi t i ve_nameCase "Box1"

    Case " Cyl i nder1"

    Case El se

    End Sel ect

    Using a For...Next LoopThe For . . . Next type of loop allows you to run a group of statements repeatedly. It uses acounter to run statements a specified number of times. Following is an example that demon-strates the For . . . Next loop:

    For var i abl e = st ar t To end

    NextYou can exit early from a For . . . Next l oop with the Exi t For statement.

    Converting Between Data TypesTo convert data from one subtype to another, use the following VBScript functions:

    Interacting with a ScriptVBScript provides two functions that enable you to interact with a script while it is running:the I nput Box function and the MsgBox function.

    CStr Syntax: CSt r ( var i abl ename) .Converts var i abl ename to a string. For example, it can be used toconvert the number 2.5 to the string "2. 5" .

    CBool Syntax: CBool (var i abl ename ).Converts var i abl ename to a boolean. If var i abl ename is 0 or " 0" ,CBool returns Fal se . Otherwise it returns Tr ue .

    CDbl Syntax: CDbl ( var i abl ename ).Converts var i abl ename to a double precision number. For example,it can be used to convert the string "2. 5" to the number 2.5.

    CInt Syntax: CI nt ( var i abl ename ).Converts var i abl ename to an integer.

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    28/308

    Introduction to Scripting in HFSS

    1-8 Introduction to VBScript

    The I nput Box function displays a dialog box with an input field. The value that is typed intothe input field is returned. For example:

    Di m user s_st r i ng

    user s_st r i ng = I nput Box ( "t ext pr ompt " , "t i t l e of t he pop- up di al og _ box", "def aul t t ext f or t he i nput box")

    The last two arguments to the function are optional.

    The MsgBox function shows a message and returns a number based on the button the userpresses. For example:

    MsgBox ( " message t ext " )

    Recommended VBScript ReferencesMicrosoft Corporation. VBScript Users Guide.Available http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vbstutor.asp.

    Childs, M., Lomax, P., and Petrusha, R . VBScript in a Nutshell: A Desktop Quick Reference .May 2002. OReilly & Associates. ISBN: 1-56592-720-6.

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    29/308

    Introduction to Scripting in HFSS

  • 8/10/2019 2010101493952386668.pdf

    30/308

    p g

    1-10 Introduction to VBScript

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    31/308

    HFSS and VBScri pt 2-1

    2 HFSS and VBScript

    This chapter provides an overview of HFSS scripting using VBScript. Informa-tion is included on the following topics: HFSS script variables.

    Recording, running, pausing, resuming, and stopping a script. Modifying a script for easier playback. HFSS scripting conventions, including script command syntax used in this

    guide, named arguments, and setting numerical values. Executing a script from within a script. Modifying properties.

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    32/308

    Introduction to Scripting in HFSS

  • 8/10/2019 2010101493952386668.pdf

    33/308

    HFSS and VBScri pt 2-3

    oAnsoftAppThe oAnsof t App object provides a handle for VBScript to access the Ansof t Hf ss product.One example of accessing this object is:

    Set oAnsof t App = Cr eat eObj ect ( " Ansof t Hf ss. Hf ssScr i pt I nt er f ace" )

    oDesktopThe oDeskt op object is used to perform desktop-level operations, including project manage-ment.

    One example of accessing this object is:

    Set oDeskt op = oAnsof t App. Get AppDeskt op( )

    See Chapter 3, Desktop Object Script Commands , for details about script commands recognizedby the oDeskt op object.

    oProjectThe oPr oj ect object corresponds to one project open in the product. It is used to manipulatethe project and its data. Its data includes variables, material definitions and one or moredesigns. One example of accessing this object is:

    Set oPr oj ect = oDeskt op. Get Act i veProj ect ( )

    See the following chapters for details about the script commands recognized by the oPr oj ect object:

    Chapter 4, Project Object Script Commands

    Chapter 5, Material Script Commands Chapter 6, Property Script Commands Chapter 7, Dataset Script Commands

    oDesignThe oDesi gn object corresponds to an instance of a design in the project. This object is used tomanipulate the design and its data. Its data includes variables, modules, and editors.One example of accessing this object is:

    Set oDesi gn = oPr oj ect . Get Act i veDesi gn( )

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    34/308

    2-4 HFSS and VBScript

    See the following chapters for details about the script commands recognized by the oDesi gn object:

    Chapter 8, Design Object Script Commands

    Chapter 9, Output Variable Script Commands Chapter 11, Reporter Editor Script Commands

    oEditorThe oEdi t or object corresponds to an editor, such as the 3D Modeler. This object is used to addand modify data in the editor.

    One example of accessing this object is:

    Set oEdi t or = oDesi gn. Set Act i veEdi t or ( " 3D Model er " )

    The Ansof t Hf ss product scripting supports the following editors:

    See Chapter 10, 3D Modeler Editor Script Commands , for details about the script commands rec-ognized by the oEdi t or object and Chapter 11, Reporter Editor Script Commands for detailsabout Reporter editor commands.

    oModuleThe oModul e object corresponds to a module in the design. Modules are used to handle a set ofrelated functionality.

    One example of accessing this object is:

    Set oModul e = oDesi gn. Get Modul e( " Boundar ySet up" )

    Editor Name in Script

    3D Modeler Editor " 3D Model er "

    Reporter Editor There is no Reporter editor object in the script. Instead,Reporter editor commands are executed by the HFSSdesign object oDesi gn .

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    35/308

    HFSS and VBScri pt 2-5

    The Ansof t Hf ss product scripting supports the following modules:

    Module Name in Script Chapter

    Boundary/Excitations ModuleCorresponds to the Boundaries andExcitations branches in theproject tree.

    " Boundar ySet up" Chapter 12, Boundary andExcitation Module ScriptCommands

    Mesh Operations Module

    Corresponds to the MeshOperations branch in the projecttree.

    " MeshSet up" Chapter 13, Mesh OperationsModule Script Commands

    Analysis ModuleCorresponds to the Analysis branchin the project tree.

    " Anal ysi sSet up" Chapter 14, Analysis ModuleScript Commands

    Optimetrics ModuleCorresponds to the Optimetrics branch in the project tree.

    "Opt i met r i cs" Chapter 15, Optimetrics ScriptCommands

    Solutions ModuleCorresponds to the operations inthe Solution Data dialog box,which is accessed by clickingHFSS>Results> Solution Data .

    "Sol ut i ons" Chapter 16, Solutions ModuleScript Commands

    Field Overlays ModuleCorresponds to the Field Overlays branch in the project tree.

    "Fi el dsRepor t er " Chapter 17, Field OverlaysModule Script Commands

    Radiation ModuleCorresponds to the Radiation branch in the project tree.

    " RadFi el d" Chapter 18, Radiation ModuleScript Commands

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    36/308

    Introduction to Scripting in HFSS

  • 8/10/2019 2010101493952386668.pdf

    37/308

    HFSS and VBScri pt 2-7

    WSH.arguments collection, not the AnsoftScriptHost.arguments collection. To handle this,you can write this:

    on er r or r esume next

    di m ar gsSet args = Ansof t Scr i pt . argument si f ( I sEmpt y( ar gs) ) t henSet ar gs = WSH. ar gument sEnd i f on er r or got o 0' At t hi s poi nt , ar gs has t he ar gument s no mat t er i f you ar e runni ng' under wi ndows scr i pt host or Ansof t scr i pt hostmsgbox "Count i s " & ar gs. Countf or i = 0 t o ar gs. Count - 1 msgbox ar gs( i )next

    Pausing and Resuming a ScriptTo pause a script during its execution:

    Click Tools >Pause Script .

    To resume a script after pausing it:

    Click Tools >Resume Script .

    Stopping a Script On the Tools menu, click Stop Script .

    HFSS stops executing the script that has been paused.

    Modifying a Script for Easier PlaybackIn the sample script on page 2-2, note that the oPr oj ect variable is set to "Pr oj ect 1" . Thatmeans that the script must be played back within Project1 to operate correctly. Alternatively,oPr oj ect could be set to the active project without specifying a project name.For example:

    Set oPr oj ect = oDeskt op. Get Act i veProj ect ( )

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    38/308

    2-8 HFSS and VBScript

    Using the line above, the script can be played back in any project.

    HFSS Scripting Conventions

    Syntax ConventionsThe following data types will be used throughout this scripting guide:

    Script Command ConventionsThe majority of this guide lists individual script commands. The following conventions are usedto describe them:

    Script Command NameUse: Describes the function of the script command.Command: Lists the interface command that corresponds to the script command. Menu

    commands are separated by carats. For example,HFSS>Excitations>Assign>Wave Port .

    Syntax: Demonst r at es t he cor r ect synt ax f or t he command. Car atbr acket s < > encl ose i nf or mat i on or ar gument s t hat youmust ent er .

    Return Value: Describes the return value, if any.

    A quoted string.

    A boolean value. Should be set to either t r u e or f al se (no quotes).Example: "Sol veI ns i de: =", t r ue

    A double precision value.Example: 1. 2

    An integer. Example: 1

    Can be a number, a VBScript variable, or a quoted string containing avalid HFSS expression.

    Examples:- "XSi ze: =", 1- " XSi ze: =" , " 3mm"- "XSi ze: =" , VBScr i pt _Var- " XSi ze: =" , " Hf ss _Var + 10mm"

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    P t D i b t h t i f t i i t h t

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    39/308

    HFSS and VBScri pt 2-9

    Parameters: Descr i bes t he ar gument s or i nf or mat i on i n t he synt axdescr i pt i on, i f an expl anat i on i s needed.

    Example: Pr ovi des a wor ki ng exampl e of t he scr i pt command, i fneeded.

    Passing Arguments to ScriptsThare are two ways to pass arguments to scripts:1 When running from command line using -runscriptandexit or -runscript, you can give -

    scriptargs parameters and specify arguments.2 When running from Tools>Run script , there is an edit field at the bottom of the file selec-

    tion dialog that you can use to enter script arguments.The user can access the script arguments using the AnsoftScriptHost.arguments collection fromvbscript. This is a standard COM collection.

    There is an issue if the user runs the script from DOS prompt as a .vbs file (that is, you dontopen hfss, but launch vbs directly, or use wscript.exe or cscript.exe). The arguments will be inthe WSH.arguments collection, not the AnsoftScriptHost.arguments collection. To handle this,you can write this:

    on er r or r esume nextdi m ar gsSet args = Ansof t Scr i pt . argument si f ( I sEmpt y( ar gs) ) t henSet ar gs = WSH. ar gument sEnd i f on er r or got o 0

    ' At t hi s poi nt , ar gs has t he ar gument s no mat t er i f you ar e runni ng' under wi ndows scr i pt host or Ansof t scr i pt hostmsgbox "Count i s " & ar gs. Countf or i = 0 t o ar gs. Count - 1msgbox ar gs( i )

    next

    Named ArgumentsMany HFSS script commands use named arguments. The names can appear in three ways:

    1. Named data, name precedes data.

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    For example: " Sol veI ns i de: =" t r ue

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    40/308

    2-10 HFSS and VBScript

    For example: . . . , Sol veI ns i de: = , t r ue, . . .

    2. Named Array, name precedes array.

    For example: . . . , " At t r i but es: =" , Ar r ay( . . . ) , . . .

    3. Named Array, name inside array.

    For example: . . . , Ar r ay( " NAME: At t r i but es " , . . . ) , . . .

    In the first and second examples, the name is formatted as " : =" . This signals HFSS that

    this is a name for the next argument in the script command. In the third example, the name isformatted as " NAME: " and is the first element of the Array.The names are used both to identify what the data means to you and to inform HFSS which datais being given. The names must be included or the script will not play back correctly. However, ifyou are writing a script, you do not need to pass in every piece of data that the command cantake. For example, if you are modifying a boundary, the script will be recorded to include everypiece of data needed for the boundary, whether or not it was modified. If you are writing ascript by hand, you can just add the data that changed and omit anything that you do not wantto change. HFSS will use the names to determine which data you provided.

    For example, when editing an impedance boundary, HFSS records the edit impedance boundarycommand as follows:

    oModul e. Edi t I mpedance " I mped1" , Ar r ay( " NAME: I mped1" , _ " Resi st ance: =" , " 100" , " React ance: =" , " 50" , _

    " I nf Gr oundPl ane: =" , f al se)

    If you only want to change the resistance, then you can leave out the other data argumentswhen you are manually writing a script:

    oModul e. Edi t I mpedance " I mped1" , Ar r ay( " NAME: I mped1" , _ " Resi st ance: =" , " 100" )

    Setting Numerical ValuesFor script arguments that expect a number, the following options are possible:

    Pass in the number directly. For example:oModul e. Edi t Vol t age " Vol t age1" , Ar r ay( " NAME: Vol t age1" , _

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    " Vol t age: =" 3 5)

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    41/308

    HFSS and VBScr ipt 2-11

    Vol t age: = , 3. 5)

    Pass in a string containing the number with units. For example:

    oModul e. Edi t Vol t age " Vol t age1" , Ar r ay( " NAME: Vol t age1" , _ " Vol t age: =", " 3. 5V" )

    Pass in an HFSS defined variable name. For example:oModul e. Edi t Vol t age " Vol t age1" , Ar r ay( " NAME: Vol t age1" , _

    " Vol t age: =", " $var 1" )

    Pass in a VBScript variable. For example:vb_var = " 3. 5V"oModul e. Edi t Vol t age " Vol t age1" , Ar r ay( " NAME: Vol t age1" , _

    "Vol t age: =" , vb_var )

    Executing a Script from Within a ScriptHFSS provides a script command that enables you to launch another script from within the scriptthat is being executed:

    oDeskt op. RunScr i pt

    If the full path to the script is not specified, HFSS searches for the specified script in the follow-ing locations, in this order:

    Personal library directory.This is the PersonalLib subdirectory in the project directory. The project directory can bespecified in the General Options dialog box (click Tools>Options>General Options to openthis dialog box) under the Project Options tab.

    User library directory.This is the userlib subdirectory in the library directory. The library directory can be specifiedin the General Options dialog box (click Tools>Options>General Options to open this dialogbox) under the Project Options tab.

    System library directory.This is the syslib subdirectory in the library directory. The library directory can be specifiedin the General Options dialog box (click Tools>Options>General Options to open this dialogbox) under the Project Options tab.

    HFSS installation directory.

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    Editing Properties

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    42/308

    2-12 HFSS and VBScript

    Editing PropertiesAny data that is shown in the dockable Properties dialog box or in the modal Properties pop-upwindow is called a property. For example, project and local variables are properties. The XSize

    of a box in the Geometry editor is also a property. See Chapter 6, Property Script Commands , for an explanation of how to manipulate properties in a script.

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    43/308

    Anso ft Appl ic ation Object Scr ip t Commands 3-1

    3 Ansoft Application ObjectScript Commands

    The Application object commands permit you to set parameters for RAM andprocessor use. Application object commands should be executed by theoAnsof t App object.oAnsof t App. < CommandName >

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    GetAppDesktop

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    44/308

    3-2 Ansoft A pplication Object Script Commands

    pp pUse: Get AppDeskt op is a function of oAnsof t App . This function does not take

    an input and it returns an object. The object is assigned to the variableoDeskt op.

    Syntax: Get AppDeskt op( )Return Value: Object.Parameters: NoneExample: Set oDeskt op = oAnsof t App. Get AppDeskt op( )SetDesiredRamMBLimitUse: Sets the Desired RAM Limit (MB) value.

    Syntax: Set Desi r edRamMBLi mi t ( )Return Value: NoneParameters:

    Type: Example: oAnsof t App. Set Desi r edRamMBLi mi t ( 2000)

    SetMaximumRamMBLimitUse: Sets the Maximum RAM Limit (MB) value.Syntax: Set Maxi mumRamMBLi mi t ( )Return Value: NoneParameters:

    Type: Example: oAnsof t App. Set Maxi mumRamMBLi mi t ( 2000)

    SetNumberOfProcessorsUse: Sets the Number of Processors value.Syntax: Set Number Of Pr ocessor s( )Return Value: NoneParameters:

    Type: Example: oAnsof t App. Set Number Of Pr ocess or s( 2)

    GetDesiredRamMBLimitUse: Gets the Desired RAM Limit (MB) value.Syntax: Get Desi r edRamMBLi mi t ( )

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    45/308

  • 8/10/2019 2010101493952386668.pdf

    46/308

  • 8/10/2019 2010101493952386668.pdf

    47/308

    Introduction to Scripting in HFSS

    CloseAllWindowsl ll h ld d h d k

  • 8/10/2019 2010101493952386668.pdf

    48/308

    4-2 Desktop Object Script Commands

    Use: Closes all MDI child windows on the desktop.Command: Fr om mai n menu, Window>CloseAll .

    Syntax: Cl oseAl l Wi ndows( )Return Value: NoneParameters: NoneExample: Deskt op. Cl oseAl l Wi ndows( )

    CloseProjectUse: Closes a specified project. Changes to the project will not be saved. Save

    the project using the Project command Save or SaveAs before closing tosave changes.

    Command: File>CloseSyntax: Cl osePr oj ect Return Value: NoneParameters:

    Type: Example: oDeskt op. Cl osePr oj ect " Pr oj ect 1"

    CloseProjectNoForceUse: Closes a specified project unless there are simulations ongoing. Changes to

    the project will not be saved. Save the project using the Project commandSave or SaveAs before closing to save changes.

    Command: File>CloseSyntax: Cl oseProj ect NoFor ce Return Value: NoneParameters:

    Type: Example: oDeskt op. Cl osePr oj ect NoFor ce " Pr oj ect 1"

    CountUse: Gets the total number of queried projects or designs obtained by

    GetProjects() and GetDesigns() commands. See the example query .Syntax: CountReturn Value: Returns an integer value.Parameters: None

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    Example: set pr oj ect s = oDeskt op. Get Proj ect s( )numpr oj ect s = pr oj ect s Count

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    49/308

    Desktop Object Script Commands 4-3

    numpr oj ect s = pr oj ect s. Count

    Example:' i t er at e t hr ough pr oj ect s and desi gns usi ng f or eachf or each pr j i n oDeskt op. Get Pr oj ect s( )

    msgbox pr j . Get Name( )f or each desi gn i n pr j . Get Desi gns( )

    msgbox desi gn. Get Name( )next

    next

    ' i t er at e t hr ough usi ng i nt eger i ndexDi m pr oj ectsset pr oj ect s = oDeskt op. Get Proj ect s( )f or i = 0 t o pr oj ect s. Count - 1

    msgbox pr oj ect s( i ) . Get Name( ) di m desi gns

    set desi gns = pr oj ect s( i ) . Get Desi gns( )f or j = 0 t o desi gns. Count

    msgbox desi gns( j ) . Get Name( )next

    next' l ookup by name

    EnableAutoSaveUse: Enabl e or di sabl e aut osave f eat ur e .Syntax: Enabl eAut oSave( bool )Return Value: None

    Parameters: NoneExample: oDeskt op. Enabl eAut oSave( t r ue)

    GetActiveProjectUse: Returns the project that is active in the desktop.Command: None

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    50/308

    Introduction to Scripting in HFSS

    GetNameUse: Gets names of queried projects or designs obtained by GetProjects() and

  • 8/10/2019 2010101493952386668.pdf

    51/308

    Desktop Object Script Commands 4-5

    Use: Gets names of queried projects or designs obtained by GetProjects() andGetDesigns() commands. See the example query .

    Syntax: GetName()Return Value: Returns a name of type string.Parameters: NoneExample: set pr oj ect s = oDeskt op. Get Proj ect s( )

    pr oj ect _name = pr oj ect s( 0) . Get Name( )

    GetLibraryDirectoryUse: Gets the library directory path.Syntax: Get Li br ar yDi r ect or yReturn Value: Returns a directory path.

    Type: Parameters: NoneExample: l i bdi r = oDeskt op. Get Li br ar yDi r ect or y

    GetProjectsUse: For querying projects. Once you have the projects you can iterate through

    them using standard VBScript methods. See the example query .Syntax: Get Pr oj ect s( )Return Value: Returns a COM collection of opened projects.Parameters: None

    Example: set pr oj ect s = oDeskt op. Get Proj ect s( )

    GetProjectDirectoryUse: Gets the project directory path.Syntax: Get Pr oj ect Di r ect or yReturn Value: Returns a directory path.

    Type: Parameters: NoneExample: pr oj di r = oDeskt op. Get Pr oj ect Di r ect or yGetProjectListUse: Returns a list of all projects that are open in the desktop.Command: None

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    52/308

  • 8/10/2019 2010101493952386668.pdf

    53/308

    Introduction to Scripting in HFSS

    Command: File>ExitSyntax: Qui t Appl i cat i on

  • 8/10/2019 2010101493952386668.pdf

    54/308

    4-8 Desktop Object Script Commands

    Return Value: None

    Parameters: NoneExample: oDeskt op. Qui t Appl i cat i on

    RestoreWindowUse: Restores a minimized HFSS window.Command: NoneSyntax: Rest or eWi ndowReturn Value: NoneParameters: NoneExample: oDeskt op. Rest or eWi ndow

    RunProgramUse: Runs an external program.

    Command: NoneSyntax: RunPr ogr am , , , Return Value: NoneParameters: < Pr ogName >

    Type: Name of the program to run.

    Type: Location of the program. Pass in an empty string to use the system path.

    Type:

    Working directory in which program will start.

    Type: Array of stringsArguments to pass to the program. If no arguments, pass in None .

    Example: oDeskt op. RunPr ogr am " wi nword. exe", _

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    55/308

    Introduction to Scripting in HFSS

    Type: Example: Set oPr oj ect = oDeskt op. Set Act i vePr oj ect ( "Pr oj ect 1" )

  • 8/10/2019 2010101493952386668.pdf

    56/308

    4-10 Desktop Object Script Commands

    SetActiveProjectByPathUse: If a user has two projects open with the same name, the result of

    SetActiveProject is ambiguous (The first one listed in selected). Thiscommand permits unambiguous specification of the active project.

    Syntax: Set Act i vePr oj ect ByPat h( )Return Value: The specified project becomes active in the desktop.Parameters:

    Example: Set oPr oj ect =oDeskt op. Set Act i vePr oj ect ByPat h( "C: \ wor ki ng\ t ee. hf ss" )

    SetLibraryDirectoryUse: Sets the library directory path. The specified directory must already exist

    and contain a syslib folder.Syntax: Set Li br ar yDi r ect or y

    Return Value: NoneParameters:

    Type: Example: oDeskt op. Set Li br ar yDi r ector y " c: \ l i br ar i es"

    SetProjectDirectoryUse: Sets the project directory path. The directory will be automatically created

    if it does not already exist.Syntax: Set Pr oj ect Di r ect or y Return Value: NoneParameters:

    Type: Example: oDeskt op. Set Pr oj ect Di r ect or y " c: \ pr oj ect s"

    SetTempDirectoryUse: Sets the temp directory path. The directory will be automatically created if

    it does not already exist.Syntax: Set TempDi r ect or y Return Value: None

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    57/308

    Introduction to Scripting in HFSS

  • 8/10/2019 2010101493952386668.pdf

    58/308

    4-12 Desktop Object Script Commandswww.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    5 Project Object Script

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    59/308

    Project Object Script Commands 5-1

    5 oject Object Sc ptCommands

    Project commands should be executed by the oPr oj ect object. One exam-ple of accessing this object is:Set oPr oj ect = oDeskt op. Get Act i veProj ect ( )

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    CloseUse: Closes the active project. Unsaved changes will be lost.Command: None

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    60/308

    5-2 Project Object Script Commands

    Command: None

    Syntax: Cl oseReturn Value: NoneParameters: NoneExample: oPr oj ect . Cl ose

    CopyDesignUse: Copies a design.Command: Edit>CopySyntax: CopyDesi gn Return Value: NoneExample: oPr oj ect . CopyDesi gn " HFSSDesi gn1"

    CutDesign

    Use: Cuts a design from the active project. The design is stored in memory andcan be pasted in any HFSS project.Command: Edit>CutSyntax: Cut Desi gn Return Value: NoneExample: oPr oj ect . Cut Desi gn " HFSSDesi gn1"

    DeleteDesignUse: Deletes a specified design in the project.Command: Edit>DeleteSyntax: Del et eDesi gn Return Value: NoneExample: oPr oj ect . Del et eDesi gn " HFSSDesi gn2"

    Warning This is a legacy command that is no longer supported and should not beused as it may have unintended effects on solved designs.

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    GetActiveDesignUse: Returns the design in the active project.Command: None

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    61/308

    Project Object Script Commands 5-3

    Command: None

    Syntax: Get Act i veDesi gnReturn Value: The active design.Parameters: NoneExample: Set oDesi gn = oPr oj ect . Get Act i veDesi gn ( )

    GetDesignUse: Returns the specified design.

    Command: NoneSyntax: Get Desi gn Return Value: The specified design.Parameters:

    Type: Name of the design to return.

    Example: Set oDesi gn = oPr oj ect . Get Desi gn ( " HFSSDesi gn1" )

    GetNameUse: Returns the project name.Command: NoneSyntax: Get NameReturn Value: The active projects name.

    Parameters: NoneExample: name = oPr oj ect . Get Name ( )

    GetPathUse: Returns the location of the project on disk.Command: None

    Syntax: Get Pat hReturn Value: The path to the project, which does not include the project name.Parameters: NoneExample: pat h = oPr oj ect . Get Pat h ( )

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    GetTopDesignListUse: Returns a list of the names of the top-level designs.Command: None

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    62/308

    5-4 Project Object Script Commands

    Syntax: Get TopDesi gnLi stReturn Value: An array of strings that are the names of the top-level designs.Parameters: NoneExample: name_l i st = oPr oj ect . Get TopDesi gnLi st ( )

    InsertDesignUse: Inserts a new design in the project. In HFSS scripts, the last argument will

    always be empty.Command: Project>Insert HFSS DesignSyntax: I nser t Desi gn " HFSS" , , , " "Return Value: NoneParameters:

    Type: Name of the new design.

    Type: Solution type of the new design. Can be " Dr i venModal " ," Dr i venTer mi nal " , or " Ei genmode" .

    Example:

    oPr oj ect . I nser t Desi gn "Hf ss" , "HFSSDesi gn3", _ " Dr i venModal " , " "

    PasteUse: Pastes a design in the active project.Command: Edit>PasteSyntax: Past eReturn Value: NoneParameters: NoneExample: oPr oj ect . Pas t e

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    63/308

  • 8/10/2019 2010101493952386668.pdf

    64/308

    6 Material Script Commands

  • 8/10/2019 2010101493952386668.pdf

    65/308

    Material Script Commands 6-1

    Material commands should be executed by the oPr oj ect object. Materialcommands apply to all products.Set oPr oj ect = oDeskt op. Set Act i vePr oj ect ( " Pr oj ect 1")oPr oj ect . CommandName

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    66/308

    Introduction to Scripting in HFSS

    Example: oPr oj ect . AddMat er i al Ar r ay( " NAME: Mat er i al 2", _"di el ect r i c_l oss_tangent : =", "44",Ar r ay( " NAME: sat ur at i on_mag" , _

    "proper t y t ype: =" "Ani soPr oper t y"

  • 8/10/2019 2010101493952386668.pdf

    67/308

    Material Script Commands 6-3

    "proper t y_t ype: =" , "Ani soPr oper t y", _ "uni t : =", "Gauss", _ " component 1: =" , " 11" , _ " component 2: =" , " 22" , _" component 3: =" , " 33" ) , _

    " del t a_H: =" , " 44Oe")

    EditMaterialUse: Modifies an existing material.Command: View/Edit Materials command in the material editor.Syntax: Edi t Mat er i al , Ar r ay( " NAME: " ,

    , , . . . )Return Value: NoneParameters:

    Type: Name of the material before editing.

    Type:

    New name for the material.

    ExportMaterialUse: Exports a local material to a library.Command: Export to Library command in the material editor.Syntax: Expor t Mat er i al , Return Value: NoneParameters:

    Ar r ay( " NAME: " ,, , . . . )

    Example: oPr oj ect . Expor t Mat er i al Ar r ay( " NAME: mo0907b" , _ "Mat er i al 1", "Mat er i al 2", "Mat er i al 3") , _

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    Introduction to Scripting in HFSS

    " User Li b"RemoveMaterialUse: Removes a material from a library.Command: Remove Material(s) command in the material editor

    http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    68/308

    6-4 Material Script Commands

    Command: Remove Material(s) command in the material editor.Syntax: RemoveMat er i al , ,

    , Return Value: NoneParameters:

    Type: Name of the material to be removed.

    Type: If true, HFSS assumes the material is a project material. In this case,the last two parameters will be ignored.

    Type: The name of the user or personal library where the material resides.

    Type: Should be " User Li b" or "Per sonal Li b".

    Example:oPr oj ect . RemoveMat er i al " Mat er i al 1" , f al se, " mo0907" , " UserLi b"oPr oj ect . RemoveMat er i al "Mat er i al 1", t r ue, "Local ", "Proj ect "

    www.cadfamily.com EMail:[email protected] document is for study only,if tort to your rights,please inform us,we will delete

    http://www.cadfamily.com/http://www.cadfamily.com/
  • 8/10/2019 2010101493952386668.pdf

    69/308

  • 8/10/2019 2010101493952386668.pdf

    70/308

  • 8/10/2019 20101