6 Replies Latest reply on Feb 2, 2017 7:27 AM by delinquent

    Identifying Border symbol?


      Hi all,

      we are planning to change our schematic borders. Some new properties are added, some will be deleted. All new properties are listed in CentLib.prp

      Now Im trying to identify if a titleblock was updated or is still the old one....

      So far so good. The concept of searching for new titleblock properties does not work since these properties are not listed after processing "Tools - Update Symbols..."

      Also selecting these properties in schematic is not possible until you change the value in properties window.

      Im using this code: Old properties are listed completely. New properties are not listed unless value was changed....

      Sub ReadBorderProps()

          Dim comp, attr, colAttrs


          ' Activate the current view, important after switching active windows.



          ' Scan each component until you find the one that has a unique border property.

          For Each comp In Application.ActiveView.Query(VDM_COMP, VD_ALL)

              If Not comp Is Nothing Then

                  ' Look for the property TitleHeading on the symbol

                  Set attr = comp.SymbolBlock.FindAttribute("TITLEHEADING" )

                  If Not attr Is Nothing Then

                      ' Found the border, comp now points to it.

                      Set gobjBorderComp = comp

                      ' Now read the attributes from the border comp and get their values.

                      For Each attr In gobjBorderComp.Attributes

                          gdictBorderProps(attr.Name) = attr.EitherValue

                          ListBoxMessages.AddString(attr.Name & " : " & gdictBorderProps(attr.Name))


                      Exit For

                  End If

              End If


      End Sub

      What can I do to get it to work? How can I identify new titleblock

        • 1. Re: Identifying Border symbol?

          First, you can identify the symbol by its name.  Look for the new symbol name, or look for the old one. 


          Second, use comp.getbatchattributes, then parse the resulting string to get the current values of the properties and the property names.


          The following is for vb.net, but you should be able to use it with minor modifications in vbscript:


          Sub get_border_symbol(old_name As String, new_name As String)

                   Dim comps As Object

                   Dim comp As ViewDraw.Component

                   Dim attr As ViewDraw.Attribute

                   Dim attrs As Object

                   Dim bloc As ViewDraw.Block

                   Dim is_old, is_new As Boolean


                   view = app.ActiveView


                   comps =  view.query(128, 0)  'save some time by only collecting symbols,

                   is_old = False

                   is_new = false

                   For Each comp In comps

                       bloc = comp.SymbolBlock


                       If Not bloc.SymbolType = 3 Then GoTo next_comp '3 = VDB_ANNOTATE; skip everything that is not an annotation symbol


                       If bloc.GetName(0) = old_name Then is_old = True

                       If bloc.GetName(0) = new_name Then is_new = True

                       'note you may need to use getname(1) or getname(2) to match what you are looking for

                       'experiment to verify the option you should use





                   If is_old = True Then

                       'it's the old border


                   End If


                   If is_new = True Then

                       'it's the new border


                   End If

                   'of course  you could also check for both being false if you want to


                   'if you want to cycle through the properties and their values, you could do something like this:


                   Dim ary(), ary1(), ary2() As String

                   Dim n As Integer


                   For Each comp In comps

                       bloc = comp.SymbolBlock


                       If Not bloc.SymbolType = 3 Then GoTo next_comp2 '3 = VDB_ANNOTATE


                       If bloc.GetName(0) = new_name Then


                           ary = Split(comp.GetBatchAttributes, vbCr)   'split the text string into an array based on carriage returns

                           If UBound(ary) > -1 Then

                               For n = 0 To UBound(ary)

                                   If InStr(ary(n), " ") > 0 Then

                                       ary1 = Split(ary(n), " ")     'split the text string into an array based on the space between the display indicator and the name=value part of the string

                                       If InStr(ary1(1), "=") > 0 Then

                                           ary2 = Split(ary1(1), "=")    'split the text string into an array based on the equal sign between the name and value

                                           Debug.Print(ary2(0) & vbTab & ary2(1))     'element 0 is the property name, element 1 is the value

                                       End If

                                   End If


                           End If

                       End If





          End Sub

          You may have slightly different methods of doing this, but this example will work, and hopefully it gives you some ideas on how to proceed to find the thing you want without false negative results.

          • 2. Re: Identifying Border symbol?

            Hi Patrick,

            the borders have the same name and differ in properties. Reading border properties works so far with both methods, yours and mine. The issue is: Properties aren't listed unless they are modified once.

            When updating a border to the latest revision the new properties aren't listed with GetBatchAttributes as well.

            Any other idea?

            • 3. Re: Identifying Border symbol?

              Sorry I didn't get it that you are using the same symbol.  Your explanation was clear, I just missed it.


              What happens when you run Tools > Update Other Objects with the Properties option selected?

              • 4. Re: Identifying Border symbol?

                HI Patrick,

                it seems



                returns the Properties Im looking for.

                Thanks for your effort and help.


                2 of 2 people found this helpful
                • 5. Re: Identifying Border symbol?

                  Excellent.  Glad you found that.  I may have used it at some time in the past, but did not remember. 


                  Often these things are not intuitive and so kudos to you for hunting around and trying until you found it.

                  • 6. Re: Identifying Border symbol?

                    I wish I would be the one who found that.

                    Honor belongs to Mitra from MGC, who gave me the hint.