3 Replies Latest reply on Feb 1, 2012 8:45 AM by Patrick.Cashman

    How to rename a net in DxDesigner?



      How can I rename a net in DxDesigner using Automation?

      I mean, not just on one sheet so that then the net falls apart but consistently across a schematic.


      lots of Greetings!


        • 1. Re: How to rename a net in DxDesigner?

          The basic idea is that you loop through all the sheets in the schematic and then on each sheet, find net labels with the name you want to change, and change them.  Here is code that works (vb.net):



          1. You already have the hooks into DxDesigner application.

          2. You have a form with two text boxes, txt_old_net and txt_new_net

          3. You have a control on your form that executes this subroutine.




              Sub replace_net_names()

                  Dim n, i As Integer

                  Dim schms As ViewDraw.IStringList

                  Dim sheets As ViewDraw.IStringList

                  Dim label_col As Object

                  Dim label_obj As ViewDraw.Label




                  schms = app.SchematicSheetDocuments.GetAvailableSchematics    'gets all the schematics in the project

                  For n = 1 To schms.GetCount

                      sheets = app.SchematicSheetDocuments.GetAvailableSheets(schms.GetItem(n))    'gets all the sheets in each schematic


                      For i = 1 To sheets.GetCount


                          app.SchematicSheetDocuments.open(schms.GetItem(n), sheets.GetItem(i))


                          view = app.ActiveView

                          label_col = view.query(256, 0)     'collect all the labels on the sheet


                          For Each label_obj In label_col

                              If label_obj.TextString.ToString = txt_old_net.Text Then

                                  label_obj.TextString = txt_new_net.Text

                              End If






                  msgbox("Changing net names is complete.", MsgBoxStyle.SystemModal)

              End Sub

          1 of 1 people found this helpful
          • 2. Re: How to rename a net in DxDesigner?

            So I really have to go thorough all sheets. I was hoping ot avoid that.


            Thanks a lot!


            • 3. Re: How to rename a net in DxDesigner?

              Yes.  There is an Application.DesignNets method, but the architecture of DX appears to not be built on the concept of a name property for each net.  It's based on a label attached to a particular segment.  From an architectural standpoint I do not understand this logic, but for me this is nothing new with the Mentor products.


              I do my best to work with what is available in the most efficient manner I can.


              On a related note there is an Application.DesignComponents method which does let you visit each component and all its properties.  So if you are doing a component related script, it is very useful and doesn't require opening each sheet.