Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Where To Find This Script

AWR Version 12

For version 12.00, Download

Starting in version 12.01, you can run this script by clicking on Scripts->Models->Parameter_Printer from AWRDE menu.

AWR Version 11

Download

Description

This script prints all parameters of the element chosen to a text file. It will ask the user to pick the schematic and the element.

The user is then prompted to select a file location.

All of the model parameters are then written to that file.

Scripting Information

Scripts included in the install are configured to run directly from the NI AWR Design Environment from the Scripts menu.

Scripts that you download must be imported into a project or placed in your global scripts folder to use them. See Working with VB Scripts for information on how to use these scripts.

You can also customize the AWRDE to run scripts from hotkeys, menus, or toolbar buttons. See Working with VB Scripts for more information.

For complete information about the AWRDE API, see the AWRDE API Programming Guide Help in the AWRDE installation. You can also view our Scripting Website for more scripting examples.

Code

        
        
        
        ' Require all variables to be declared before use
        Option Explicit
        
        Dim el As Element
        Dim elems() As String
        Dim i As Integer
        Dim sch() As String
        Dim pa As Parameter
        Dim sc As Schematic
        
        ' Code Module
        Sub Main
        ' Set up array to feed dialog list box
                For i = 1 To Project.Schematics.Count
                        ReDim Preserve sch(i)
                        sch(i) = Project.Schematics(i).Name
                Next i
        
        '   Define/display dialog for schematics
                Begin Dialog UserDialog 420,196,"Select Schematic" ' %GRID:10,7,1,1
                        DropListBox 140,42,190,70,sch(),.schName,2
                        Text 30,42,90,14,"Schematic",.Text1,1
                        OKButton 160,161,90,21
                End Dialog
                Dim dlgSch As UserDialog
                Dialog dlgSch
        
                Set sc = Project.Schematics(dlgSch.schName+1)
        
                For i = 1 To sc.Elements.Count
                        ReDim Preserve elems(i)
                        elems(i) = sc.Elements(i).Name
                Next i
        
        '       Define/display dialog for elements in chosen schematic
                Begin Dialog UserDialog 420,196,"Select Element" ' %GRID:10,7,1,1
                        DropListBox 140,42,190,70,elems(),.elName
                        Text 30,14,90,14,"Schematic:",.Text1,1
                        Text 30,42,90,14,"Element",.Text2,1
                        TextBox 140,14,190,21,.schName
                        OKButton 160,161,90,21
                End Dialog
                Dim dlgEl As UserDialog
                dlgEl.schName = sc.Name
                Dialog dlgEl
        
                Set el = sc.Elements(dlgEl.elName+1)
        
        
                Open GetFilePath("AWR Data", "txt",,,3) For Output As #1
        '    Loop to print each parameter in selected element
        
                For Each pa In el.Parameters
                        Print #1, pa.Name & vbTab & pa.ValueAsString & " " & Project.Units(pa.UnitType).UnitString
                Next pa
        ' Close file
                Close #1
        
        End Sub
        
  • No labels