6 Replies Latest reply on Mar 28, 2012 3:00 PM by jim.granville

    Can you use the scipting language to change Net names?

    baxsie

      I'm looking to selectively name some of my Nets with the same name as the pin function they are connected to on my processor.  I thought a simple script could do this.

       

      Sub Main

          Dim objs As Object

          Set objs = ActiveDocument.GetObjects(plogObjectTypePin,,True)

          If objs.Count = 1 Then

              MsgBox "Pin " + objs.Item(1).FunctionName + " Selected and Connected to " + objs.Item(1).Net.Name + ".  Net renamed to match pin function."

      >>>  objs.Item(1).Net.Name = objs.Item(1).FunctionName

          Else

              MsgBox "One Pin Not Selected"  

          End If  

      End Sub

       

      The line with the >>>> gives a vauge error when run:

      (10097) ActiveX AutomationL wrong number of parameters

       

      Maybe you cannot change the Net names in that manner?  Is there another way to change a Net name with a script?

       

      Thank you.

        • 1. Re: Can you use the scipting language to change Net names?
          jduquette

          While I'm not an expert on scripts this might help:

           

          Change

           

          objs.Item(1).Net.Name = objs.Item(1).FunctionName

           

           

          to

           

            tempname = objs.Item(1).FunctionName

           

            objs.Item(1).Net.Name = tempname

           

           

          I've run into issues having an object on both sides of an equals sign before.

           

          John D

          • 2. Re: Can you use the scipting language to change Net names?
            baxsie

            Hi John,

             

            I've just heard from Mentor that Name is a read-only property for Nets and Components.

             

            If you have another method for automating changing Net names, I'm all ears.

             

            Thanks!

            • 3. Re: Can you use the scipting language to change Net names?
              taco.de.vries

              I think what you need to do is

              1. loop the Net

              2. loop the Segements for that Net

              3. If there is a label it is connected to a segment as Label.TextString

               

              Now it becomes hard, you should be able to just set that Label.TextString to a different value,

              I tried, but could not get that to work..

              I also tried Net.AddLabel, but that fails if the net is allready labeled...

              Next I tried to Select that label and do a DeleteSelected, but for some reason that also fails.

               

              So.. I am putting this on the backburner to think over..

               

              This is the code I have sofar, I must be overlooking something, maybe somebody else can

              point out what I am doing wrong..

               

              Taco

               

               

              Set dxdView = GetObject(, "ViewDraw.Application")

               

              For Each Net In ActiveView.Query(VDM_NET, VD_SELECTED)

              For Each Seg In Net.GetSegments()

                Set Label = Net.GetLabel(Seg)

                If Not Label Is Nothing Then

                 X = Label.GetLocation.X

                 Y = Label.GetLocation.Y

               

                 AppendOutput "Output", "1 Net: " & Label.TextString

                 'Label.TextString = "New NetName" ' This fails

                 Set Block = Net.Parent

                 Block.DeSelectAll()

                 Label.Selected = True

                 Block.DeleteSelected(False)

                 AppendOutput "Output", "2 Net: " & Label.TextString

                 NLabel = "RenamedNet"

                 Set NewLabel = Net.AddLabel(Seg,NLabel,X,Y)

                End If

              Next

              AppendOutput "Output", "3 Net: " & Label.TextString

              • 4. Re: Can you use the scipting language to change Net names?
                rtennill

                I wish that I had come across this information an hour ago before I ended up at the same dead end! It seems odd to me that they will let us change the names of parts and other objects but not nets. Naming nets in a new schematic is quite tedious especially when all the net names for a part are so easily accessible with automation.

                 

                I will see if this has been posted on the pads bright ideas page and if not make one. If you're still interested in this then swing by and add your vote!

                 

                PS: a previous post said that component names were read only but this may be a recent change? I have a script posted on this board that definitely renames a component with the following line: Let objs.Item(n).Name = "Z_" & pin_id.Net.Name

                 

                Can anyone verify that something like this stillworks in a more recent version of Pads? Still using 9.2 until license upgrade goes through....

                • 5. Re: Can you use the scipting language to change Net names?
                  jim.granville

                  baxsie wrote:

                  If you have another method for automating changing Net names, I'm all ears.

                  There is a pathway for this, which is not too hard, once you have the framework.

                   

                  You need to just create a file like this

                   

                  *PADS-ECO-V9.3.1-MILS*


                  *RENNET*

                  SELA  SELA_RENAME

                  {repeat as needed for all nets }

                  *END*

                   

                  and there are script commands to ImportECO / ImportASCII files.

                  So you simply open/create the tmp eco file, scan your design with CurrentName Newname, writing them to the file as above, and  close, then just do an ImportECO, all in one script.

                  You even get a record of what was changed.

                   

                  added: Note that such a Net/Pin scan script, can run unchanged in either PADS-Logic, or PADS-Layout, and the ECO can be Imported into either.

                  • 6. Re: Can you use the scipting language to change Net names?
                    jim.granville

                    rtennill wrote:

                     

                    PS: a previous post said that component names were read only but this may be a recent change? I have a script posted on this board that definitely renames a component with the following line: Let objs.Item(n).Name = "Z_" & pin_id.Net.Name

                     

                    Can anyone verify that something like this stillworks in a more recent version of Pads? Still using 9.2 until license upgrade goes through....

                    yes, this

                     

                    part.Name = part.Name & "_"

                     

                    still works.

                    The Script help says 'sets or returns', but the HTML help omits the sets word. MIght be the reason for the confusion.