AnsweredAssumed Answered

Script : get unplaced components (variant manager)

Question asked by michael_38 on Oct 26, 2017
Latest reply on Nov 30, 2017 by michael_38

Hello,

 

I made an Excel script to get all components in a schema :

Private Sub LoadPADSVX()
    Dim vdapp As CVdApp
    Dim vdComp As Object
    Dim schName As String
    Dim i As Integer
    Dim dBquery As Object

    Set vdapp = GetObject(, "ViewDraw.Application")
    schName = vdapp.GetProjectData.GetiCDBDesignRootBlock(vdapp.GetActiveDesign)

    i = 0
    Set dBquery = vdapp.DesignComponents("", schName, -1, "STD", True)
    For Each vdComp In dBquery
        i = i + 1
           
        Cells(i, 1).value = PADSVX_getProperty(vdComp, "Ref Designator")
        Cells(i, 2).value = PADSVX_getProperty(vdComp, "Part Number")
        Cells(i, 3).value = PADSVX_getProperty(vdComp, "Property1")
        Cells(i, 4).value = PADSVX_getProperty(vdComp, "Property2")
    Next vdComp
End Sub

Function PADSVX_getProperty(vdComp As Object, property As String) As String
    Dim oRefSymbolAttrOrg
    Dim oRefAttrOrg

    Set oRefAttrOrg = vdComp.FindAttribute(property)
    
    If property = "Ref Designator" Then
        Set oRefSymbolAttrOrg = vdComp.SymbolBlock.FindAttribute(property)
        If oRefSymbolAttrOrg Is Nothing Then
            PADSVX_getProperty = ""
        Else
            If oRefAttrOrg Is Nothing Then
                PADSVX_getProperty = oRefSymbolAttrOrg.value
            Else
                If Len(oRefAttrOrg.InstanceValue) > 0 Then
                    PADSVX_getProperty = oRefAttrOrg.InstanceValue
                Else
                    PADSVX_getProperty = oRefAttrOrg.value
                End If
            End If
        End If
    Else
        If oRefAttrOrg Is Nothing Then
            PADSVX_getProperty = ""
        Else
            PADSVX_getProperty = oRefAttrOrg.value
        End If
    End If
End Function

 

Now I would like to add a column in Excel to see unplaced components for the active variant : how must I do (What is the property name ?) ?

=> the active variant is the variant selected when you press button "Create Variant/Function Schematics" in the variant manager

 

In a variant, a component could be placed or unplaced or replace. Now I would like add a new state (state "rework") : How can I do it ?

 

Where can I found a detailed description for Dx designer scripting API ?

Outcomes