| | 
import com.sun.electric.database.hierarchy.Cell;import com.sun.electric.database.geometry.Orientation;
 import com.sun.electric.database.topology.ArcInst;
 import com.sun.electric.database.topology.NodeInst;
 import com.sun.electric.technology.ArcProto;
 import com.sun.electric.technology.PrimitiveNode;
 import com.sun.electric.technology.Technology;
 import java.awt.geom.Point2D;
 
 // create the new cell
 Cell newCell = Cell.makeInstance(Library.getCurrent(), "samp2{lay}");
 
 Technology tech = Technology.findTechnology("mocmos");
 
 // place a rotated transistor
 PrimitiveNode trP = tech.findNodeProto("P-Transistor");
 NodeInst tP = NodeInst.makeInstance(trP, new Point2D.Double(0, 20),
 trP.getDefWidth(), trP.getDefHeight(), newCell,
 Orientation.R, "T1");
 
 // place a metal-Active contact
 PrimitiveNode coP = tech.findNodeProto("Metal-1-P-Active-Con");
 NodeInst maP = NodeInst.makeInstance(coP, new Point2D.Double(8, 20),
 coP.getDefWidth(), coP.getDefHeight(), newCell);
 
 // wire the transistor to the contact
 ArcProto aP = tech.findArcProto("P-Active");
 ArcInst.makeInstance(aP, tP.findPortInst("diff-bottom"),
 maP.findPortInst("metal-1-p-act"));
 
 // export the contact
 com.sun.electric.database.hierarchy.Export.newInstance(newCell,
 maP.findPortInst("metal-1-p-act"), "IN", PortCharacteristic.IN);
 | 
 | This example goes a bit further: it creates a rotated transistor and a contact, wires them together,
and exports the contact.
The transistor is named "T1." |