2 Replies Latest reply on Jan 27, 2009 10:11 AM by juha.manninen

    Attributes from the underlying symbol

    juha.manninen

       

      Hi,

       

       

       

       

       

      I have a script for DxDesigner that iterates all components and then gets some attributes from them.

       

       

      I used Comp.FindAttribute(...) to get the attribute's value by name.

       

       

      However, as the documentation says: "This only finds attributes attached to the component -- it doesn't find attributes that are only on the underlying symbol."

       

       

      The documentation does not tell which property or method I should use when I also want attributes from the underlying symbol.

       

       

      I tried GetBatchAttributes instead of FindAttribute. It didn't help.

       

       

      Then I tried "Comp.SymbolBlock.FindAttribute". It didn't give errors but it didn't return right attribute values either.

       

       

      So, how can I get the attributes from symbol level?

       

       

       

       

       

      Juha Manninen

       

       

       

       

       

       

       

       

        • 1. Re: Attributes from the underlying symbol
          john_dube

          Hi Juha,

           

          Here is a function that will get the occurrence, component, or symbol attribute value:

           

          Function GetAttrValue(objComp, sAttrName)
               Dim objAttr, sRetVal
               
               ' First, check for the attribute on the component
               Set objAttr = objComp.FindAttribute(sAttrName)
               If Not objAttr Is Nothing Then
                    sRetVal = objAttr.EitherValue
               Else
                    Set objAttr = objComp.SymbolBlock.FindAttribute(sAttrName)
                    If Not objAttr Is Nothing Then
                         sRetVal = objAttr.Value
                    Else
                         sRetVal = ""
                    End If
               End If
               GetAttrValue = sRetVal
          End Function
          

           

          John

          • 2. Re: Attributes from the underlying symbol
            juha.manninen

             

            Thanks,

             

             

             

             

             

            It really works!

             

             

            I actually tried something similar but apparently made a mistake then.

             

             

             

             

             

            Juha Manninen