AnsweredAssumed Answered

Extracting cell information from a user layer

Question asked by navita@rafael.co.il on May 14, 2017
Latest reply on May 31, 2017 by navita@rafael.co.il

Hi,

 

I need to extract an outline dimension of a geometry defined for a cell in a user layer.

You can see (in the attached pictures) that the information is defined under user draft layers -> Thermal outline.

 

I was able to get to this information using automation but only when the Graphic editor of the cell editor was open on a specific cell.

I need to fully automate this process. I can do it in 2 different flows:

1. Extract all cells information stored in the LMC with required information. 

2. For a specific open design in the xPCB extract this information for the cells in the design.

I encounter a problem reching this information when doing it not from the graphic editor

For each flow, i wrote the code that get to the cells information, but I couldn't find a way to get to the geom.otline information.

See code examples.

 

 

//Test with LMC and cell editor graphic open for a specif cell - This  works! missing full automation

MGCPCB.CellEditorApplication cellApplication =

            (MGCPCB.CellEditorApplication)System.Runtime.InteropServices.Marshal.GetActiveObject("MGCPCB.CellEditorApplication");

MGCPCB.Document doc = cellApplication.ActiveDocument;

          

//Check UserLayer Object

MGCPCB.UserLayer layerObj = doc.FindUserLayer("THERMAL OUTLINE");

MGCPCB.IMGCPCBUserLayerGfxs layerGraphic = doc.UserLayerGfxs;//(epcbSelectAll, "THERMAL OUTLINE", False);

Dictionary<string, object> cells = new Dictionary<string, object>();

 

foreach (MGCPCB.UserLayerGfx item in layerGraphic)

{

              item.Selected = true;

               item.Highlighted = true;

              MGCPCB.Dimensions d = item.Dimensions;

              MGCPCB.IMGCPCBProperties Layerprops = item.Properties;

 

 

               Dictionary<string, string> props = new Dictionary<string, string>();

             foreach (MGCPCB.Property item2 in Layerprops)

               {

                 props.Add(item2.Name, item2.Value);

            }

 

 

              MGCPCB.Geometry geom = item.Geometry;

                MGCPCB.EPcbShapeAttr attr = geom.Attributes;

              var geomOut = geom.Outline; ------------------------------> This is what I need

}

 

See code example from xPCB - can't get to the information i need

//Test with xPCB

            MGCPCB.Application app = (MGCPCB.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("MGCPCB.Application");

            MGCPCB.Document doc = app.ActiveDocument;

            GetAutomationLicense(doc);

 

            //Get all layout cells

            MGCPCB.Cells docCells = doc.Cells;

            Dictionary<string, MGCPCB.Cell> celldic = new Dictionary<string, MGCPCB.Cell>();

            foreach (MGCPCB.Cell c in docCells)

            {

                celldic.Add(c.Name, c);

            }

 

            CellEditorDlg celleditor = doc.CellEditor;

            CellDB db = celleditor.ActiveDatabase;

            CellEditorAddinLib.Partitions pars = db.Partitions;

            Dictionary<string, object> pcbCurrentcells = new Dictionary<string, object>();

            List<string> paratitionName = new List<string>();

 

            foreach (CellEditorAddinLib.Partition item in pars)

            {

                paratitionName.Add(item.Name);

                Cells paratitionCells = item.Cells;

                foreach (Cell c in paratitionCells)

                {

                    pcbCurrentcells.Add(c.Name, c);  -----------------------------> When examining the cell object it doesn't contain this information

                }

            }

 

 

 

Any help will be appreciated

Navit

Outcomes