Creating a new cell with Assembly Outline with Automation

Version 4

    This community already has an example on how to create a cell with automation, to be run from within Library Manager. That other example also shows how to add a Placement outline.

    As the addition of an Assembly outline is a little different, I thought that I'd provide that example here.


    Assuming tht you have an open cell in the celleditor by use of something like celldoc = cell.Edit, you can now add the Placement outline like this :


    Set outline = cedDoc.PutPlacementOutline( epcbSideMount, points, array, 0, 0, Nothing, epcbUnitCurrent ), where your array could be setup like this:

    Dim array

        ReDim array(2,4)

        array(0,0) = minX :array(1,0) = minY :array(2,0) = 0.0

        array(0,1) = minX :array(1,1) = maxY :array(2,1) = 0.0

        array(0,2) = maxX :array(1,2) = maxY :array(2,2) = 0.0

        array(0,3) = maxX :array(1,3) = minY :array(2,3) = 0.0

        array(0,4) = minX :array(1,4) = minY :array(2,4) = 0.0


    and thus, points = 5 in the above statement.


    The difference when adding an Assembly outline is that you need to use a different command - the documentation is not very clear about this.


    The command for adding the Assembly Outline is outline = cedDoc.PutFabricationLayerGfx, or in detail :


    'Document.PutFabricationLayerGfx(ByVal eType As EPcbFabricationType ,

        'ByVal eSide As EPcbSide ,

        'ByVal dGraphicsWidth As Double ,

        'ByVal nPnts As Long , safeArrayOfPnts As Variant ,

        '[ByVal bFilled As Boolean = False] ,

        '[ByVal pComponent As IMGCPCBComponent] ,

        '[ByVal eUnit As EPcbUnit = epcbUnitCurrent]) As IMGCPCBFabricationLayerGfx


        'eType = epcbFabAssembly

        'In Cell Editor, set pComponent to 'Nothing'

        'eSide - use epcbSideTopOrBottom top get 'Mount' for Assy outline. use of epcbSideTop will only give you 'Top'


    The command also uses an array - here is an example :


    Set outline = cedDoc.PutFabricationLayerGfx(epcbFabAssembly,epcbSideToporBottom,0,points,array,False,Nothing,epcbUnitCurrent)


    The attached example allows you to add a new cell with both Placement and Assembly Outline.

    The example script shows how to create a new cell in a library

    Library (Line 43), the Cell partition to use (Line 51), the name for the new cell (Line 62), and the padstack to use (Line 79 to 83) are hardcoded


    I added a new version after the correction of handling the Cell partition isse (error if partition did not exist). The structure of the code has changed slightly to solve that.

    New version has improved error handling plus it adds notes to the command window to show progress.

    NOTE : I also moved the definition of LMC, Cell partition and cell name to the top of the script.



    Scripting.AddTypeLibrary( "LibraryManager.Application" )

    Dim CentralLibrary
    CentralLibrary = "c:\DATA\MGTraining\common\libraries\master-DXD\master-DXD.lmc"
    dim cellname : cellname = "_newTestCell7"
    dim partition : partition = "TMP"
    Echo "# Note:  " & "Using Library : "& CentralLibrary
    Echo "# Note:  " & "Using Cell Partition : "& partition
    Echo "# Note:  " & "Adding Cell : "& cellname