Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Each of the Element Parameters has a reference to an object called a ParameterDefinition. A ParameterDefinition is associated with the model for the object and describes the attributes of the parameters that will be associated with elements representing that model. So each model includes an array of parameter definitions that act like templates for creating the parameters associated with an Element representing the model. To get information about the type of the Parameter object we need to look at the ParameterDefinition or template from which it was created. For example lets create a script that adds a schematic, adds a MLIN element to that schematic and then prints some information about the parameters for that element.

Code Snippets

' Code Module
Sub Main
     Dim schem As Schematic
     Dim elem As Element
     Dim param As Parameter
     Dim paramDef As ParameterDefinition

     Set schem = Project.Schematics.Add("MySchematic")
     Set elem  = schem.Elements.Add("MLIN", 0, 0)

     For Each param In elem.Parameters
          Debug.Print param.Name & " = " & param.ValueAsString;
          Debug.Print "  Data Type = " & param.ParameterDefinition.DataType
     Next param

End Sub


Also if we place a "." after the DataType property then it will give us a list of the possible values as shown in Figure 11.

Image Modified

This can be very useful if we are trying to control flow based on some specific data type, like printing only double values, however in our case we want to print the data type so I'll create a mapping function to map from the type value to a string. A quick mapping function might look like this: