7 Replies Latest reply on Nov 17, 2017 5:37 AM by phiet

    FabricationLayerGfxs return nothing if cell is opened from library manager

    phiet

      I experencience strange behavior

       

      Manually open the cell in cell editor than drop in code with

      set Doc = Application.ActiveDocument

      Doc.FabricationLayerGfxs is ok, code will return fab layer such as assembly outline.

       

      however, if I open the cell editor from automation's root

      set CellEditorDlgObj = createObject("CellEditorAddin.CellEditorDlg"

      ....

      Doc = cell.edit()

      Doc.FabricationLayerGfxs will return nothing

       

      Does anyone have any idea ?

      Thanks

        • 1. Re: FabricationLayerGfxs return nothing if cell is opened from library manager
          peter_festesen

          Hi - had a quick look at good old CLDump.vbs, in a modified version, where I see Set cellGfxEdtrDoc = cellGfxEdtr.Application

           

          For Each cell in cells

                      Transcript MsgNonote, "Found cell """ & cell.Name & """."

                      Transcript MsgNonote, "  Part relation: " & MapCellTypeToString(cell.CellRefdByPart)  'SoMC

                      Transcript MsgNonote, "  Cell Type: " & MapCellTypeToString(cell.Type)

                      Transcript MsgNonote, "  Allow Overhang:  " & cell.AllowCellOverhang

                      'Transcript MsgNonote, "  Clearance Type: " & cell.ClearanceType 'SoMC

                      Transcript MsgNonote, "  Description: " & cell.Description

                      Transcript MsgNonote, "  Height: " & cell.Height

                      Transcript MsgNonote, "  Units: " & MapUnitsToString(cell.Units)

           

           

                      '  Need to open the Cell Graphics editor to get more stuff ...

                      Set cellGfxEdtr = cell.Edit ' returns the cell document

                     Set cellGfxEdtrDoc = cellGfxEdtr.Application

                      Set FLGfxs = cellGfxEdtr.FabricationLayerGfxs(MGCPCB.EPcbFabricationType.epcbFabAssembly, MGCPCB.EPcbSelectionType.epcbSelectAll, MGCPCB.EPcbSide.epcbSideTopOrBottom, True)

          ...

          ...

          ...

          I hope this helps you in your quest

           

          /P

          • 2. Re: FabricationLayerGfxs return nothing if cell is opened from library manager
            phiet

            Thanks for helping, but doesn't seem to work. I gave a try but I have exactly same result as before.

             

            Analyzing the, I see you set

                       Set cellGfxEdtrDoc = cellGfxEdtr.Application

            but this is not used anywhere else after.

            Everything after refer to original cellGfxEdtr, which is the document returned by Edit previously.

             

            Btw, cell.edit is extremely slow ... iI guess it' not advisable to open cells 1 by 1 to edit ...

            • 3. Re: FabricationLayerGfxs return nothing if cell is opened from library manager
              peter_festesen

              I am sorry about that, phiet !

              I'll have to revisit the code, I may accidentally have grabbed an experimental version. Stay tuned, I'll dig some more...

              • 4. Re: FabricationLayerGfxs return nothing if cell is opened from library manager
                peter_festesen

                #1 : phiet - can you please post your code, I'd like to take a look

                 

                #2 : You are right, the code never uses cellGfxEdtrDoc, but nonetheless the code seems to work. I just verified with EEVX.2.2 I am not running this by drag-dropping the vbs into Cell Editor, maybe that is the difference ? I run it from the MGC_BSD_EEVX.2.2 CMD Shell with mgcscript.
                Let me know if you want a copy ...

                 

                /Peter

                 

                • 5. Re: FabricationLayerGfxs return nothing if cell is opened from library manager
                  phiet

                  Hi Peter,

                  the my code work, as well yours. but tool return nothing for FabricationLayerGfxs, while it return differently  if I drop the code into cell editor.

                   

                  Sub Main

                       ......

                       For each Cell in Partition.Cells   

                              If dict.exists(Cell.Name) then        

                                  Set objDocument  = Cell.Edit        

                                  GetGeomData(objDocument)           

                                  objDocument.Close()

                              end if

                          Next

                  End sub

                   

                  Sub GetGeomData(objDocument)

                       .....

                  ' ' if enalbe this will get info for every pin

                      ' For each Pin in objDocument.Pins

                     ' set oPstk = pin.currentPadstack
                     ' str= Pin.Name & "  " & oPstk.name & "  " & Pin.PositionX & "  " & Pin.PositionY
                     ' file.WriteLine (str)

                      ' Next

                   

                      set fabColl = objDocument.FabricationLayerGfxs(_

                      epcbFabAssembly ,epcbSelectAll, _

                      epcbSideTopOrBottom, True)

                   

                       MsgBox "count= " & fabColl.Count

                  end sub

                   

                  In my case, count will give 1 or 2 depending on the cell if I drop in the vbs code. It will give 0 if I run from library manager.

                  • 6. Re: FabricationLayerGfxs return nothing if cell is opened from library manager
                    matthias.cosaert

                    Hi,
                    You need to add the Expedition PCB type library when you run the script from the library manager otherwise the epcbFabAssembly,epcbSelectAll & epcbSideTopOrBottom variables are nulls.

                     

                    Scripting.AddTypeLibrary("MGCPCB.ExpeditionPCBApplication")
                    Scripting.AddTypeLibrary ("CellEditorAddin.CellEditorDlg")

                     

                    Dim CellEdObj : Set CellEdObj = application.ActiveLibrary.CellEditor
                    Dim CellDB : Set CellDB = CellEdObj.ActiveDatabase

                    Call main

                    CellEdObj.Quit

                     

                    Sub main

                     

                    for Each Partition In CellDB.Partitions
                           For Each Cell In Partition.cells
                               if (cell.type = ecelldbCelltypePackage) then
                                   Cellname = cell.name 'can not get name when the cell is in edit mode
                                   Set CellDocObj = cell.edit
                                    msgbox Cellname & ":" & CellDocObj.FabricationLayerGfxs( epcbFabAssembly ,epcbSelectAll,  epcbSideTopOrBottom, True).count
                                   CellDocObj.Close(False) 'Close but not save
                                    msgbox "exit sub (debug mode)"
                                   Exit Sub
                               end if
                         Next
                    Next

                    End Sub

                     

                     

                    1 of 1 people found this helpful
                    • 7. Re: FabricationLayerGfxs return nothing if cell is opened from library manager
                      phiet

                      Thanks Matthias,

                      you solved the mystery.