AnsweredAssumed Answered

Check and set the visibility of an attribute

Question asked by gerrythompson on Feb 27, 2013
Latest reply on Apr 9, 2013 by andrew_french

In the following script I can find all the components which have an attribute called "DNI" and that attribute has a value of "DNI".

What I would like to do  is determine if the "DNI" attribute is visible and set it visible if it is not.

 

How do I do this?

 

Gerry

 

Sub Main

    fname = ActiveDocument

        If fname = "" Then fname = "Untitled"

    sFilePath = "C:\temp"

    report = sFilePath & "\" & "checkDNI.txt"

    Open report For Output As #1

    'Output report header

    Print #1, "'Check DNI's "; fname; " on "; Now

    Print #1, "'"

    index = 0

    Dim nextComp As Object

    Dim nextAttr As Object

    For Each nextComp In ActiveDocument.Components

        If Not nextComp.Attributes("DNI") Is Nothing Then

            If Len(nextComp.Attributes("DNI").Value) = "DNI" Then

                Print #1, nextComp.Name;", ";nextComp.PartType;", ";nextComp.Attributes("DNI").Value

            End If

        End If

        index =index+1

    Next nextComp

    Print #1

    Print #1, "Checked ";index;" parts on schematic "; fname

    Close #1

    Shell "Notepad " & Chr(34) & report & Chr(34), 1

End Sub

Outcomes