7 Replies Latest reply on Sep 24, 2010 12:31 PM by patrick.cashman

    Change value of "Global Signal Name" on user global

    patrick.cashman

      We have several global symbols with Global Signal Names like USER_GND, USER_V, and so on.  I would like to place them programmatically and then change the value to the name of a power net, such as +5V, PWR_RTN, or whatever.

       

      Even though there is already a "Global Signal Name" property on the symbol, using GetBatchAttributes doesn't show it. Looking through the documentation I find the concept of Promotion of symbol attributes/properties to the schematic level.  Of course there is no PromoteAttribute command, so I guessed and attempted to add the attribute even though it's already there.  This method has worked for other properties on normal component symbols.  So I have come up with this:

       

      Dim comp As ViewDraw.Component
      Dim attr As ViewDraw.Attribute

       

      comp = app.ActiveView.Block.AddComponent("globals:user_gnd.1", x + 200, y)
      attr = comp.AddAttribute("Global Signal Name", x + 210, y - 10, 3)

      attr.Value = net_name

       

       

      After doing this, selecting the symbol and displaying properties shows that "Global Signal Name" now has the correct value.  No errors result from adding the attribute.  Everything looks good.  BUT, the netlist doesn't come out right.  So now I'm scratching my head.

       

      Since some of the documentation describes globals as a 'special pin, I have also experimented with getting the connections of the symbol, setting to component pin, and trying to use GetBatchAttributes for the pin object.  No attributes are acquired using this method.

       

      I've also tried going the route of getting the symbol block, using FindAttribute, and changing the value that way, but if you do that it changes all of them at once and all power nets are shorted as one.

       

      If anyone has any ideas on this, please share.

       

      Thank you,

       

      Patrick

        • 1. Re: Change value of "Global Signal Name" on user global
          john_dube

          Hi Patrick,

           

          Is there a net attached to the power symbol?  Are you adding the net through automation also, or is the user connecting the net interactively?

           

          John

          • 2. Re: Change value of "Global Signal Name" on user global
            patrick.cashman

            John,

             

            I am adding the net programmatically.

             

            This came about as a result of the need to create schematics for 2 old backplanes that were netlist driven BS designs.  They both have approximately 2800 connector pins.  I did not want to have to type in 5600 net names, so I am working on a script that will do this.  I add the connector pin, then the net, then either an offpage, voltage global, or ground global.  So I have the net name, and a separate list of power and ground nets.  For each net I place, I cycle through the power and ground net lists to see if the given net is a match for any power or ground net, then place the symbol accordingly.

             

            See the attached image for an example.

             

            So with the netname, I place the user global, then try to change it's 'Global Signal Name'.  That's where I'm running into trouble.

             

            Thanks for the quick reply and any help you can give,

             

            -Patrick

            • 3. Re: Change value of "Global Signal Name" on user global
              john_dube

              Patrick,

               

              Try doing things in the same order interactively, and you will see that the net will be renamed to the Global Signal Name property value.

               

              Instead, you could add the net after setting the Global Signal Name property.

               

              If that is not possible, add a label to the net (or set the label's TextString property) after you set the Global Signal Name property.

               

              John

              • 4. Re: Change value of "Global Signal Name" on user global
                patrick.cashman

                John,

                 

                The problem is not that the net name changes.  I want to make the global signal name the same as the net name, because I already know that that pin needs to be attached to that net from my existing netlist.  I could just leave the global symbol off entirely, and the new netlist would be fine, but visually it would not be correct.

                 

                I already know what I want the global signal name to be, I just can't make it so.  It actually looks right; if I select the symbol after doing this, it will show the correct net name next to the 'Global Signal Name' property.  But something is still wrong because the new netlist I generate from this schematic still shows some of these pins tied to USER_GND or USER_V.

                 

                So my question really is: How do you change the value of 'Global Signal Name' on a user global symbol programmatically?

                 

                Thanks,

                 

                Patrick

                • 5. Re: Change value of "Global Signal Name" on user global
                  john_dube


                  In my experience, nothing special was needed for setting the Global Signal Name property value.

                   

                  The only difference is that I supply both the name and value when calling the AddAttribute method:

                   

                  Set dxdProp = dxdComp.AddAttribute("Global Signal Name=" & net_name, 0, 0, VDVALUEVISIBLE)

                   

                  John

                  • 6. Re: Change value of "Global Signal Name" on user global
                    patrick.cashman

                    Ladies and Gentlemen, we have a winner:

                     

                     

                     

                    AddAttribute Method (Block Object)

                    Arguments

                     

                    • String

                     

                    String in the form NAME=VALUE.
                    John, your post correctly shows the syntax of the AddAttribute function, per the documentation snippet above:
                    "Global Signal Name=" & net_name, 0, 0, VDVALUEVISIBLE
                    I mistakenly thought the first item in the command syntax was just the attribute name, not NAME=VALUE.  Somewhere along the line I didn't read the instructions carefully enough - probably the first time I used AddAttribute.  And then I just kept doing it that way.
                    I'm surprised it worked at all, but in a lot of cases, it did.
                    I'll work this into the script and let you know how it turns out.
                    Thanks very much for the correction.
                    -Patrick
                    ps I pasted some HTML code into this post so the formatting is goofy.
                    • 7. Re: Change value of "Global Signal Name" on user global
                      patrick.cashman

                      It turns out that the syntax of the command doesn't matter.  The problem I was having did not go away when I changed that.

                       

                      But I did get it figured out.  What made the difference is that the symbol was made with the Global Signal Name property already attached, and that is not the best way to do it.  To get around the problem, I made another global symbol without the property attached.  Then in the script, at the schematic level, I add the property.  The result of this is that there is only one case of the property on the symbol, and it is selectable and editable.

                       

                      There is some interesting interaction between the global symbol and the net segment, which I don't quite understand.  What ends up happening is that the symbol gets its Name property populated with the global signal name, and this property is then visible near the symbol.  And it adds a label to the net segment with the same value. So I have to take a couple more steps to select and hide these.  Here is the code:

                       

                      (this one is for a power net, the symbol is called script_v)

                       

                       

                                          'the following adds the net segment

                                          net = app.ActiveView.Block.AddNet(x, y, x + 175, y, null_pin , null_pin , 0)

                                          'the following adds the net name ( same as the global signal name) to the net then hides it
                                          seg = net.GetSegments.Item(1)
                                          lbl = net.AddLabel(seg, net_name, x + 10, y + 5)
                                          lbl = net.GetLabel(seg) ' the net label I add
                                          lbl.Visible = 0
                                          lbl.Origin = 9
                                          lbl = net.GetConnectedLabel(seg) ' the net label the connector pin (placed before this code) creates on the net when they are attached
                                          lbl.Visible = 0
                                          lbl.Origin = 9

                       

                       

                                           'the following adds the global symbol, gives it the global signal name property, and then hides the extra labels


                                          comp = app.ActiveView.Block.AddComponent("globals:script_v.1", x + 175, y)
                                          attr = comp.AddAttribute("Global Signal Name=" & net_name, x + 175, y + 20, 3)
                                          attr.Origin = 6
                                          comp.Label.Visible = 0 'the Name property of the symbol
                                          lbl = net.GetConnectedLabel(seg) ' the label added to the net by the global when they are attached to each other
                                          lbl.Visible = 0

                       

                       

                      Thanks to John and Ken at Mentor for their help with this problem.

                       

                      With this problem out of the way I am able to draw a my entire schematic (nearly 2900 pins, 14 sheets) with just a few mouse clicks.  This is a great way to end the week.

                       

                      -Patrick