4 Replies Latest reply on Apr 1, 2011 7:55 AM by keith.padgett

    DxDesigner Component.FindAttributes returns only schematic level ATTR

    keith.padgett

      When attempting to gather data on selected components, the Component.FindAttribute only returns data on the schematic level attributes such as REFDES.  I know that the attributes I'm looking for exist at the symbol level.

       

      In the code fragment below, I get the "No MFGR attribute found" message.

       

      For Each Comp in vdview.Query(VDM_COMP, VD_Selected)

          ' Identify the Manufacturer attribute on the component

          Set MfgrDir = Comp.FindAttribute("MFGR")

          If MfgrDir Is Nothing Then

              MsgBox "No MFGR attribute found"

          Else

              MsgBox "MFGR=" & MfgrDir.Value

          End If

      Next

       

      With this code, I get only the REFDES and none of the other attributes returned.

       

      For Each Comp in vdview.Query(VDM_COMP, VD_Selected)

          MsgBox Comp.GetBatchAttributes(),,"GetBatchAttributes"

      Next

       

      Can anyone tell me how to access the attributes at the symbol level when running a script with a schematic sheet active?

        • 1. Re: DxDesigner Component.FindAttributes returns only schematic level ATTR
          Patrick.Cashman

          I've had success using the integer constants to define the query instead of the text names.  ie, instead of

           

          vdview.Query(VDM_COMP, VD_Selected)

           

          use

           

          vdview.Query(128, 0)

           

          I don't know that it makes any difference, but I've done the exact same thing as you are doing and it works with the numbers.  This is in the help under DxDesigner Automation Reference, Query Method, VdObjectTypeMask Enum.

           

          Here's an example of code I have that works (vb.net, not vbscript, but you should get the idea)

           


                  view = app.ActiveView

           

                  txt_col = view.query(4, 0)

                  attr_col = view.query(64, 0)

                  label_col = view.query(256, 0)

                  comp_col = view.query(128, 0)

           

                  For Each comp_obj In comp_col

                      If instr(1, comp_obj.SymbolBlock.LibraryName.ToString, "Borders") Then

                          'do nothing

                      Else

                          conns = comp_obj.GetConnections

                          For Each conn In conns

                              comp_pin = conn.CompPin

                              attr_obj = comp_pin.FindAttribute("Pin Number")

                              If attr_obj Is Nothing Then

                                  'do nothing

                              else

                                  attr_obj.Size = size

                              end if

                          Next

           

                          tmp = ""

                          attrs = split(comp_obj.GetBatchAttributes, vbcr)

                          For Each tmp In attrs

                              If instr(1, tmp, "3") = 1 Then

                                  tmp = tmp.Substring(2)

                                  tmp = tmp.Substring(0, instr(1, tmp, "=") - 1)

                                  attr_obj = comp_obj.FindAttribute(tmp)

                                  attr_obj.Size = size

                              End If

                          Next

                      End If

                  Next

          • 2. Re: DxDesigner Component.FindAttributes returns only schematic level ATTR
            keith.padgett

            Thanks for the info Patrick, but that did not seem to help. I can observe the values for VDM_COMP and VD_Selected from within the script and they report the correct numbers but still have the problem of not seeing the symbol level attributes.

             

            I'm exploring how to get and open the SymbolBlock to see if that aids in getting the ATTR's and Values.

            • 4. Re: DxDesigner Component.FindAttributes returns only schematic level ATTR
              keith.padgett

              Thanks, John. I'm new to automation in DxDesigner and did not catch that post when I searched the discussions.