GetNPortData [component manager]
Returns NPort data for the component with the specified name.
Command: None
Return Value: Variant array, whose contents depend on the type of component. The array will be empty if the component does not have NPort data. See the syntax for AddDynamicNPortData and AddNPortData for descriptions of the array contents for components with those types of NPort data.
Parameters: <ComponentName>:
<string>
Example: This script displays each item in the returned array for each component in the design.
Sub DisplayVariant(x)
Dim index
index = 0
For Each info In x
curr = x(index)
If TypeName(curr) <> "Variant()" Then
If TypeName(curr) <> "Empty" And TypeName(curr) <> "Null" Then
str = CStr(curr)
If str = "" Then
str = ChrW(34) & ChrW(34)
End If
Msgbox str
Else
str = "Empty/Null item."
Msgbox str
End If
Else
DisplayVariant curr
End If
index = index + 1
Next
End Sub
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim dnpInfo
Dim index
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oComponentManager = oDefinitionManager.GetManager("Component")
Dim componentNames
componentNames = oComponentManager.GetNames()
index = 0
For Each name In componentNames
name = componentNames(index)
message = "NPort data for component " + name
Msgbox message
dnpInfo = oComponentManager.GetNPortData(name)
DisplayVariant dnpInfo
index = index + 1
Next