2 Replies Latest reply on Feb 9, 2017 11:20 AM by jmarsel@curtisswright.com

    Add a blind via with a script in Xpedition (vx1.2)

    jmarsel@curtisswright.com

      Hi folks...

      I'm writing a script for Xpedition VX1.2 in which the script searches for blind/buried spans within the design that can be reduced.... for instance I have a 22 layer design that uses 2-11, 12-21, and 2-21 buried spans.  I have a script that analyzes and finds 2-21 spans that can be changed to a 2-11 where connections do not exist above layer 11.  I'm not seeing methods in the automation interface that allow either changing the span of an existing via, or deleting the 2-21 and replacing with a 2-11.  For that matter I don't see a method of adding a via with a particular span to begin with. Maybe I'm just not looking in the right place?  Can anyone shed some light on this?

       

      thanks

      Jmarz

        • 1. Re: Add a blind via with a script in Xpedition (vx1.2)
          Patrick.Cashman

          There is a trick to doing this.  It is the doc.putpadstack function.

          The other tricky thing about doing this is that there is a difference between the list of via padstacks used in the design and the padstacks loaded in the design's local library.

           

          Here is a set of routines & functions that load all padstacks in the design's library to a combobox, then show how to put a new via with a specified layer span.  Of course you would change this so that you specify the span in your code, but it looks like you have already figured out how to determine the span you want.

           

          You'll have to fill in some of the blanks, but the basic idea is:

           

          1. Get a reference to the design's padstack library:

           

          Public Sub ps_connect()

                   'Creates a handle to the Parts Editor in Library Manager

                   Try

                       ps_editor = CreateObject("MGCPCBLibraries.PadstackEditorDlg" & "." & prog_id.ToString)

                   Catch ex As Exception

                       Debug.Print("failing to create padstack editor session with this error: " & ex.Message)

                   End Try

          '       

                   has_ps_editor = False

                   If ps_editor is Nothing Then

                       Exit Sub

                   Else

                       has_ps_editor = True

                   End If

                  

                   ps_editor = doc.PadstackEditor

                   ps_editor.LockServer

                   ps_db = ps_editor.ActiveDatabase

                  

                   has_ps_db = False

                   If ps_db Is Nothing Then

                   Else

                       has_ps_db = True

                   End If

          End Sub

          (note there are many variables which I have declared outside these routines.  If you don't see the declaration, do it globally)

           

          2. Get all the padstack names from the design padstack library.  In this case I load them into a combobox:

           

          Sub load_vias()

                   If Not ps_db Is Nothing Then

                       pss = ps_db.Padstacks

                       cbo_select_via.Items.Clear

                       For Each ps In pss

                           If ps.Type = 16 Then

                               cbo_select_via.Items.Add(ps.name)

                           End If

                       Next

                   End If

                   cbo_select_via.SelectedIndex = 0

          End Sub

           

          3. Disconnect the padstack library:

          Public Sub ps_disconnect()

                   Debug.Print("In ps_disconnect")

                   ps_db = Nothing

                   ps_editor.UnlockServer

                   ps_editor.Quit

                  

                   ps_editor = Nothing

          End Sub

           

          4. Use a routine something like this to replace the vias

          Sub replace_vias()

                   Dim vias As MGCPCB.Vias

                   Dim via, newvia As MGCPCB.Via

                   Dim pstack_to_use As MGCPCB.Padstack

                   Dim x, y As Double

                   Dim net As MGCPCB.Net

                   Dim n_from, n_to As Integer

                   Dim fixlock As Integer

                  

                   If doc.TransactionStart(0) = True Then

                       vias = doc.Vias(1)

                       For Each via In vias

                          

                           fixlock = via.FixLock

                           via.FixLock = 0

                          

                           n_from = via.StartLayer

                           n_to = via.EndLayer

                          

                           pstack_to_use = doc.PutPadstack(n_from, n_to, cbo_select_via.Text, False, False)

                           x = via.PositionX

                           y = via.PositionY

                           net = via.Net

                           via.Delete

                           newvia = doc.PutVia(x, y, pstack_to_use, net)

                           newvia.FixLock = fixlock

                       Next

                       doc.TransactionEnd(True)

                   End If

          End Sub

           

          The key item here is this line:

          pstack_to_use = doc.PutPadstack(n_from, n_to, cbo_select_via.Text, False, False)

           

          This was not intuitive to me because I was thinking of it in terms of adding padstacks to the design over and over. That doesn't happen. It can be thought of as a virtual padstack that does not get implemented physically until a few lines later when the new via is added.

           

          The nice thing is that you get to specify the span on the fly, and it puts the via in with that span. 

           

          The other thing to consider with all this is the via layer ranges defined in the setup parameters dialog.  From what I can see so far, there is no close relation between the setup parameters and what spans you can place with automation.  Of course in practice you'd want them to all match up and have a correct definition, but there appears to be no restrictions on adding a span with no existing definition to match.

          • 2. Re: Add a blind via with a script in Xpedition (vx1.2)
            jmarsel@curtisswright.com

            Patrick... you rock my man!  that works like a charm.... my script will now replace a via of one Padstack and span with another ....either one at a time or in bulk.  Thanks !