1 Reply Latest reply on Nov 12, 2016 11:56 AM by Patrick.Cashman

    Is it possible to copy the Assembly Outline of some components of a board to a User Draft Layer?

    marco.colombo

      Is it possible to copy the Assembly Outline and Ref Des of some components of a board to a User Draft Layer?

      The targhet is to do a script that copy on a layer only Ref and Assebly used in BOM (for topographic design).

      Thanks!!!

       

      Marco Colombo

        • 1. Re: Is it possible to copy the Assembly Outline of some components of a board to a User Draft Layer?
          Patrick.Cashman

          There is no direct copy command.  You have to get each graphics object then redraw it on the userlayer.

          This assumes you already have a reference to the PCB document object (pcbdoc):

           

          Sub copy_assy_outlines_to_user_layer()

                   Dim comps As MGCPCB.Components

                   Dim comp As MGCPCB.Component

                   Dim fab_gfxs As MGCPCB.FabricationLayerGfxs

                   Dim fab_gfx As MGCPCB.FabricationLayerGfx

                   Dim ul As MGCPCB.UserLayer

                   Dim ptary    'points array for a drawn object

                   Dim pts As Integer    'number of points in a points array

                   Dim geom As MGCPCB.Geometry        'a single geometry object

                   Dim ulgfx As MGCPCB.UserLayerGfx

                  

                   ul = pcbdoc.UserLayers("Assy")    'assign the userlayer you want to the userlayer variable ul. The userlayer must already exist.

                   comps = pcbdoc.Components(1)    'gets selected components

                  

                   For Each comp In comps    'cycle through the selected components

                       fab_gfxs = comp.FabricationLayerGfxs    'get the fabrication graphics for the component

                       For Each fab_gfx In fab_gfxs    'cycle through the fab graphics

                           If fab_gfx.Type = 1 Then    'select out the assembly graphics

                               geom = fab_gfx.Geometry    'get the geometery of the object

                               ptary = geom.PointsArray    'get the points array of the geometery

                               pts = UBound(ptary, 2) + 1    'get the number of points in the points array

                               ulgfx = pcbdoc.PutUserLayerGfx(ul, geom.LineWidth, pts, ptary, geom.Filled)    'draw the graphics object

                           End If

                       Next

                   Next

                  

          End Sub

          Use similar commands to get and redraw the text, kind of like this:

           

                               fabtxt_objs = comp.FabricationLayerTexts

                               For Each fabtxt_obj In fabtxt_objs

                                   If fabtxt_obj.Type = 1 Then 'Select out Assy Text

                                   ...

                              Next