1 Reply Latest reply on Dec 23, 2016 12:25 AM by Patrick.Cashman

    How can I change the Property value LineWidth, on a bus line in the xDXDesigner with a script

    joachim.schindlmayr

      Has anyone an example in which he changes the line width with a script, on a bus or net.

        • 1. Re: How can I change the Property value LineWidth, on a bus line in the xDXDesigner with a script
          Patrick.Cashman

          The following will change all the nets on the active schematic sheet to 2 pixel width, and the buses to 5.

           

          If you are using vbscript, the typed declarations are not used, just the declaration of the variables.  If using a .net flavor, all of the collection variables must be of type Object, as there is no built-in collection datatype for segments and nets (and many other things you'd perhaps want to get a collection of).

           

          You could also down-select nets by name or any other attribute of the nets if you wanted to.

           

          This routine assumes you already have a reference to app (the Viewdraw Application), and that app and view are declared globally elsewhere.

           

          Sub change_net_width()

                  

                   Dim segs As Object

                   Dim seg As ViewDraw.Segment

                   Dim nets As Object

                   Dim net As ViewDraw.Net

                   Dim is_bus As Boolean

                  

                   view = app.ActiveView

                  

                   nets = view.query(32, 0) 'collect all the nets

                  

                   For Each net In nets

                       is_bus = False

                       segs = net.GetSegments

                       For Each seg In segs

                           If seg.IsBus Then

                               is_bus = True

                           End If

                       Next

                      

                       If is_bus = True Then

                           net.Width = 5

                       Else

                           net.Width = 2

                       End If

                   Next

          End Sub