3 Replies Latest reply on Jun 21, 2016 1:11 AM by fuba

    Assembly and Silkscreen Ref Des rearrange


      Hi All,


      we all know that in the end of the layout we need to rearrange Assembly and Silkscreen Ref Des according the component shape, limitations, and orientation.

      Is there any way to sort the Assembly Ref Des and Silkscreen Ref Des automatically ?


      Thanks all



        • 1. Re: Assembly and Silkscreen Ref Des rearrange


          yes, thats also currently my problem. But here I have a small macro for you doing exactely that job.

          It is written in VB.Net, but it is easy to transfer to VBS. It is a cutout of something bigger I have here.

          So a few things are missing here, like inizialization of the ocbDoc Object, and the Licensing, but this

          Snippet is working.


             Sub syncRefDesPos()
                  Dim fabLayerTexts As MGCPCB.FabricationLayerTexts
                  fabLayerTexts = pcbDoc.FabricationLayerTexts(MGCPCB.EPcbFabricationType.epcbFabSilkscreen, MGCPCB.EPcbSelectionType.epcbSelectAll, MGCPCB.EPcbSide.epcbSideTopOrBottom, True)
                  fabLayerTexts = pcbDoc.FabricationLayerTexts(MGCPCB.EPcbFabricationType.epcbFabAssembly, MGCPCB.EPcbSelectionType.epcbSelectAll, MGCPCB.EPcbSide.epcbSideTopOrBottom, True)
                  Dim cnt As Integer
                  cnt = fabLayerTexts.Count
                  Dim str As String
                  str = String.Empty
                  Dim sb As StringBuilder
                  sb = New StringBuilder
                  Dim fabLayerText As MGCPCB.FabricationLayerText     
                  Dim activeComp As MGCPCB.Component
                  For i As Integer = 1 To cnt
                      fabLayerText = fabLayerTexts.Item(i)
                      activeComp = fabLayerText.Component
                      If activeComp.RefDes.StartsWith("TP") Then
                          'Test Point
                          Continue For
                      ElseIf activeComp.RefDes.StartsWith("BH") Then
                          'Black Hole
                          Continue For
                      End If
                      Dim PosX As Double
                      PosX = activeComp.CenterX(MGCPCB.EPcbUnit.epcbUnitMM)
                      Dim PosY As Double
                      PosY = activeComp.CenterY(MGCPCB.EPcbUnit.epcbUnitMM)
                      fabLayerText.PositionX(pcbUnit) = PosX 
                      fabLayerText.PositionY(pcbUnit) = PosY 
              End Sub


          at the beginning of the macro you specify, if you like to work on Silkscreen or Assembly Layer


          ciao /Stefan

          • 2. Re: Assembly and Silkscreen Ref Des rearrange

            Hi Fuba,

            Thanks for the answer...

            Can you upload the file as VBS? I tried to convert online and got many errors and i'm new with the script's option.


            • 3. Re: Assembly and Silkscreen Ref Des rearrange

              Hi Nadav,

              I am not good in working / creating vbs files. The Mentor Editor is not convenient enough, thats also the reason,

              why I am using VB.Net / Visual Studio. Anyway, I have converted / modified the code above and here it is.


              Hope its doing its job. No gaurantee, If you have any doubts, create a project backup or test it on a

              small job.