private static void defineAndWrite_Polygon(string outDir) { // Can the system define geometry and write it correctly to Oasis and GDS files. GeoCore g = new(); g.reset(); GCDrawingfield drawing_ = new("") { accyear = 2018, accmonth = 12, accday = 5, acchour = 2, accmin = 10, accsec = 10, modyear = 2018, modmonth = 12, modday = 5, modhour = 2, modmin = 10, modsec = 10, databaseunits = 1000, userunits = 0.001, libname = "noname" }; GCCell gcell = drawing_.addCell(); gcell.accyear = 2018; gcell.accmonth = 12; gcell.accday = 5; gcell.acchour = 2; gcell.accmin = 10; gcell.accsec = 10; gcell.modyear = 2018; gcell.modmonth = 12; gcell.modday = 5; gcell.modhour = 2; gcell.modmin = 10; gcell.modsec = 10; gcell.cellName = "test"; // L GeoLibPoint[] poly = new GeoLibPoint[6]; poly[0] = new GeoLibPoint(0, 0); poly[1] = new GeoLibPoint(0, 20); poly[2] = new GeoLibPoint(10, 20); poly[3] = new GeoLibPoint(10, 10); poly[4] = new GeoLibPoint(20, 10); poly[5] = new GeoLibPoint(20, 0); gcell.addPolygon(poly, 1, 0); // triangle poly = new GeoLibPoint[3]; poly[0] = new GeoLibPoint(0, 0); poly[1] = new GeoLibPoint(10, 20); poly[2] = new GeoLibPoint(20, 0); gcell.addPolygon(poly, 2, 0); // pentagram poly = new GeoLibPoint[5]; poly[0] = new GeoLibPoint(5, 0); poly[1] = new GeoLibPoint(0, 10); poly[2] = new GeoLibPoint(10, 20); poly[3] = new GeoLibPoint(20, 10); poly[4] = new GeoLibPoint(15, 0); gcell.addPolygon(poly, 3, 0); // trapezoid poly = new GeoLibPoint[4]; poly[0] = new GeoLibPoint(0, 0); poly[1] = new GeoLibPoint(5, 20); poly[2] = new GeoLibPoint(15, 20); poly[3] = new GeoLibPoint(20, 0); gcell.addPolygon(poly, 4, 0); // parallelogram poly = new GeoLibPoint[4]; poly[0] = new GeoLibPoint(0, 0); poly[1] = new GeoLibPoint(10, 20); poly[2] = new GeoLibPoint(20, 20); poly[3] = new GeoLibPoint(10, 0); gcell.addPolygon(poly, 5, 0); g.setDrawing(drawing_); g.setValid(true); gds.gdsWriter gw = new(g, outDir + "simple_polygon.gds"); gw.save(); oasis.oasWriter ow = new(g, outDir + "simple_polygon.oas"); ow.save(); }
private void writeLayout_implant(Results_implant currentResult, int resultEntry, int numberOfCases, int type) { string layoutFileName = baseFileName; string paddingString = "D" + numberOfCases.ToString().Length; // count chars in the number of cases as a string, use that to define padding. layoutFileName += "_run" + resultEntry.ToString(paddingString); int scale = 100; // for 0.01 nm resolution GeoCore g = new(); g.reset(); GCDrawingfield drawing_ = new("") { accyear = (short)DateTime.Now.Year, accmonth = (short)DateTime.Now.Month, accday = (short)DateTime.Now.Day, acchour = (short)DateTime.Now.Hour, accmin = (short)DateTime.Now.Minute, accsec = (short)DateTime.Now.Second, modyear = (short)DateTime.Now.Year, modmonth = (short)DateTime.Now.Month, modday = (short)DateTime.Now.Day, modhour = (short)DateTime.Now.Hour, modmin = (short)DateTime.Now.Minute, modsec = (short)DateTime.Now.Second, databaseunits = 1000 * scale, userunits = 0.001 / scale, libname = "variance" }; GCCell gcell_root = drawing_.addCell(); gcell_root.accyear = (short)DateTime.Now.Year; gcell_root.accmonth = (short)DateTime.Now.Month; gcell_root.accday = (short)DateTime.Now.Day; gcell_root.acchour = (short)DateTime.Now.Hour; gcell_root.accmin = (short)DateTime.Now.Minute; gcell_root.accsec = (short)DateTime.Now.Second; gcell_root.modyear = (short)DateTime.Now.Year; gcell_root.modmonth = (short)DateTime.Now.Month; gcell_root.modday = (short)DateTime.Now.Day; gcell_root.modhour = (short)DateTime.Now.Hour; gcell_root.modmin = (short)DateTime.Now.Minute; gcell_root.modsec = (short)DateTime.Now.Second; gcell_root.cellName = "implantCase" + resultEntry; // Resist for (int i = 0; i < 2; i++) { List <GeoLibPointF[]> resistPolys = currentResult.getResistShapes()[i].getPoints(); g.addLayerName("L" + (i + 1) + "D0", "resistPolys" + i); foreach (GeoLibPoint[] ePoly in resistPolys.Select(t => GeoWrangler.resize_to_int(t, scale))) { gcell_root.addPolygon(ePoly.ToArray(), i + 1, 0); } } // Shadowing line List <GeoLibPointF[]> shadowLine = currentResult.getLine(Results_implant.lines.shadow).getPoints(); g.addLayerName("L2D0", "shadowLine"); foreach (GeoLibPoint[] ePoly in shadowLine.Select(t => GeoWrangler.resize_to_int(t, scale))) { gcell_root.addPolygon(ePoly.ToArray(), 2, 0); } g.setDrawing(drawing_); g.setValid(true); switch (type) { case (int)CommonVars.external_Type.gds: gdsWriter gw = new(g, layoutFileName + ".gds"); gw.save(); break; case (int)CommonVars.external_Type.oas: oasWriter ow = new(g, layoutFileName + ".oas"); ow.save(); break; } }