1 of 1 people found this helpful
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.
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
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
msgbox("Changing net names is complete.", MsgBoxStyle.SystemModal)
So I really have to go thorough all sheets. I was hoping ot avoid that.
Thanks a lot!
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.