Expert API
1. Introduction
This article describes Expert's Application Programming Interface (Expert API) based on C/C++ language.
Expert API is intended for customizing and extending the existing software functionality by functions written by the users of Expert using C/C++.
Expert API is provided in a form of library. It contains numerous API functions that give users very powerful and flexible tools to control, edit and modify Expert's project data and user interface.
The library (ExpAPI.lib file) is to be added into a project where users build their plug-in in the form of a Dynamic Linked Library (DLL). The built DLL is to be integrated into Expert main application.
Good programming experience in C++ is required to use Expert API.

Figure 1. Using Expert API
2. Plug-in Creation
The easiest way to start creating plug-ins is to use the example included into the distribution of CELEBRITY. It requires Microsoft Visual C++ v.6.0. The example is complete MS VC++ project for a simple plug-in that creates a new menu item in Expert. You must do the following:
1. Unzip Plugset.zip into any place (PlugSet directory structure will be created there).
2. Run VC++.
3. File >>Open Workspace... select PlugSet\Plug\Plug.dsw
4. Project >> Settings... (Alt-F7)
Use the following settings for: Win32 Debug and Release:
Tab "General": Output Files: put \PlugIns subdirectory of the directory where Expert.exe is installed
(e.g.,. C:\Silvaco\lib\expert\3.4.3.R\x86-nt\PlugIns)
Tab "Debug": Executable for debug session: Input directory with GuiAppStarter.exe
( or browse to GuiAppStarter.exe)
(ex. C:\Silvaco\etc\GuiAppStarter.exe)
Click OK for close dialog.
5. Builg >> Set Active configuration Choose Plug-Win32 Debug (or Release)
6. Build >> Build Plug.dll (F7) 7. Execute (Ctrl-F5) You should see Expert running, with a new "Plug" menu item.

Figure 2. Plug-in Creation
3. API Description
All Expert API functions are grouped into the following categories:
3.2 Setup
3.2.1: General Setup
3.2.2: Setup Technology
3.2.3: GDS Setup
3.2.4: CIF Setup
3.2.5: Applicon Setup
3.3 Project
3.4 User Interface (UI)
3.5 Objects
3.5.1: Objects
3.5.2: Cells
3.5.3: Layers
3.5.4: Primitives
3.6 Tools
3.6.1: Selection Modes
3.6.2: Drawing Modes
3.6.3: Edit Modes
3.7 Support
3.8 Script Language (LISA)
All of these functions have ExpApi prefix.
3.1. Data Types
HOBJECT - handle to layout object;
HCELL - handle to cell
HLAYER - handle to laye
OBJECT_PROPERTY - structure storing data of layout object;
LAYER_PROPERTY - structure storing specs of technology layer;
UUNITS -Enumerated type for measurement units
UNIT_NM - nanometers (1.0e-3 um)
UNIT_UM - microns (1.0 um)
UNIT_MIL - mils (2.54 um)
UNIT_MM - millimeters (1.0e3 um)
UNIT_CM - centimeters (1.0e4 um)
UNIT_INCH - inches (2.54e4 um)
UNIT_M - meters (1.0e6 um)
UNIT_LAMBDA - user defined units.
EAPoint - point class
EARect - rectangle class EAPointsArray - array of points class
GENERAL_SETUP
TECHNOLOGY_SETUP
GDS_SETUP
CIF_SETUP
APPLICON_SETUP
3.2. Functions
| void | ExpApiSetUnits(UUNITS nUnit, double dValue = 0.); |
| UUNITS | ExpApiGetUnits(); |
| Double | ExpApiGetUnitUMValue(UUNITS nUnit); |
| void | ExpApiXiInit(); |
| BOOL | ExpApiXiRun(LPCTSTR sz); |
| BOOL | ExpApiFileSelector(LPCTSTR szFileName, LPCTSTR lpszFilter = NULL, LPCTSTR lpszDefExt = NULL, BOOL bLoad = TRUE); |
| void | ExpApiUpdate(); |
| void | ExpApiRedrawView(CEARect* rect = NULL); |
| void | ExpApiRedrawObject(HOBJECT hObject); |
| BOOL | ExpApiProjectNew(LPCTSTR szProjName, LPCTSTR szTechName = NULL); |
| BOOL | ExpApiProjectLoad(LPCTSTR szProjName, LPCTSTR szOutputProjectName = NULL, LPCTSTR szTechName = NULL, BOOL bReadOnly = FALSE); |
| BOOL | ExpApiCloseProject(); |
| BOOL | ExpApiSaveProject(); |
| BOOL | ExpApiSaveAsProject(LPCTSTR szProjName); |
| BOOL | ExpApiCompressProject(); |
| CEAPoint | ExpApiGetMousePoint(RCEAPoint ptPtev); |
| CEARect | ExpApiGetMouseRect(); |
| BOOL | ExpApiIsRMousePress(); |
| void | ExpApiSetRefPoint(RCEAPoint pt); |
| CEAPoint | ExpApiGetRefPoint(); |
| BOOL | ExpApiActivateRefPoint(BOOL bRefPointActivate = TRUE); |
| BOOL | ExpApiSetActiveLayer(LPCTSTR szLayerName); |
| LPCTSTR | ExpApiGetActiveLayer(); |
| BOOL | ExpApiSetActiveCell(LPCTSTR szCellName); |
| LPCTSTR | ExpApiGetActiveCell(); |
| void | ExpApiGetObjectProperty(HOBJECT hObject, OBJECT_PROPERTY& Property); |
| int | ExpApiSearch(CEASearchContext& SearchContext, LPCTSTR szCellName = NULL); |
| HOBJECT | ExpApiGetFoundFirstObject(LPCTSTR szCellName = NULL); |
| HOBJECT | ExpApiGetFoundNextObject (LPCTSTR szCellName = NULL); |
| HOBJECT | ExpApiGetFoundPrevObject (LPCTSTR szCellName = NULL); |
| HOBJECT | ExpApiGetFoundLastObject (LPCTSTR szCellName = NULL); |
| BOOL | ExpApiSelectObject(HOBJECT hObject); |
| BOOL | ExpApiDeleteSelected(); |
| HOBJECT | ExpApiAddObject(OBJECT_PROPERTY& Property); |
| HOBJECT | ExpApiModifyObject(HOBJECT hObject, OBJECT_PROPERTY& Property); |
| BOOL | ExpApiDeleteObject(HOBJECT hObject); |
| HOBJECT | ExpApiGetFirstObject(LPCTSTR szCellName = NULL, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiGetNextObject(LPCTSTR szCellName = NULL, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiGetFirstInstObject(LPCTSTR szCellName = NULL, LPCTSTR szInstName = NULL); |
| HOBJECT | ExpApiGetNextInstObject(LPCTSTR szCellName = NULL, LPCTSTR szInstName = NULL); |
| BOOL | ExpApiCreateNewCell(LPCTSTR szCellName); |
| BOOL | ExpApiCreateAsNewCell(LPCTSTR szCellName); |
| BOOL | ExpApiDeleteCell(LPCTSTR szCellName = NULL, BOOL bHier = FALSE); |
| BOOL | ExpApiRenameCell(LPCTSTR szTargetCell, LPCTSTR szCellName = NULL); |
| BOOL | ExpApiSaveCell(LPCTSTR szCellName = NULL, BOOL bCheckInOut = FALSE); |
| BOOL | ExpApiSaveAsCell(LPCTSTR szTargetCell, LPCTSTR szCellName = NULL, BOOL bCheckInOut = FALSE); |
| BOOL | ExpApiDiscardCell(LPCTSTR szCellName = NULL); |
| BOOL | ExpApiReadOnlyCell(LPCTSTR szCellName = NULL); |
| HOBJECT | ExpApiCreateBox(double dSx, double dSy, double dEx, double dEy, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateBox(RCEAPoint ptPos, RCEAPoint ptSize, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateBox(RCEARect rtRect, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateCircle(double dSx, double dSy, double dRadius, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateCircle(RCEAPoint ptCenter, double dRadius, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateEllipse(double dSx, double dSy, double dEx, double dEy, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateEllipse(RCEAPoint ptCenter, RCEAPoint ptRadius, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateEllipse(RCEARect rtRect, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateDonut(RCEAPoint ptCenter, double dRad1, double dRad2, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateRegion(CEAPointsArray& Points, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateLine(CEAPointsArray& Points, double dWidth, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateText(LPCTSTR szText, RCEAPoint ptPos, double dWidth, double dHeight, double dEscapement = 0., BOOL bSlant = FALSE, BOOL bMirroring = FALSE, LPCTSTR szLayerName = NULL); |
| HOBJECT | ExpApiCreateText(LPCTSTR szText, RCEARect rtRect, double dEscapement = 0., BOOL bSlant = FALSE, BOOL bMirroring = FALSE, LPCTSTR szLayerName = NULL); |
| BOOL | ExpApiSetOrigin(RCEAPoint pt, LPCTSTR szCellName = NULL); |
| BOOL | ExpApiSetOrigin(double dx, double dy, LPCTSTR szCellName = NULL); |
| BOOL | ExpApiSetAngleMode(DAM daMode); |
| DAM | ExpApiGetAngleMode(); |
| BOOL | ExpApiCut(); |
| BOOL | ExpApiCopy(); |
| BOOL | ExpApiPaste(RCEAPoint pt); |
| BOOL | ExpApiPaste(double dx, double dy); |
| BOOL | ExpApiMove(RCEAPoint pt); |
| BOOL | ExpApiMove(double dx, double dy); |
| BOOL | ExpApiDuplicate(RCEAPoint pt); |
| BOOL | ExpApiDuplicate(double dx, double dy); |
| BOOL | ExpApiRotate(double dx, double dy, double dAngle, BOOL bDuplicate = FALSE); |
| BOOL | ExpApiRotate(RCEAPoint pt, double dAngle, BOOL bDuplicate = FALSE); |
| BOOL | ExpApiFlipVertical(double dCenter); |
| BOOL | ExpApiFlipHorizontal(double dCenter); |
| BOOL | ExpApiMirrorVertical(double dCenter); |
| BOOL | ExpApiMirrorHorizontal(double dCenter); |
| BOOL | ExpApiSelectNewest(); |
| BOOL | ExpApiSelectLayer(LPCTSTR szLayerName = NULL); |
| BOOL | ExpApiSelectAll(); |
| BOOL | ExpApiUnselectAll(); |
| BOOL | ExpApiInvertSelection(); |
| BOOL | ExpApiSelReselect(); |
| BOOL | ExpApiSelSelect(); |
| BOOL | ExpApiSelDeselect(); |
| BOOL | ExpApiSelModeInside(); |
| BOOL | ExpApiSelModeCross(); |
| BOOL | ExpApiSelModeBoundary(); |
| BOOL | ExpApiSelModeSolid(); |
| BOOL | ExpApiSelectByType(SEARCH_OBJECT_ TYPE sType, LPCTSTR szCellName = NULL); |
| BOOL | ExpApiIgnoreInstances(); |
| BOOL | ExpApiIgnorePrimitives(); |
| BOOL | ExpApiMoveToActiveLayer(); |
| BOOL | ExpApiCopyToActiveLayer(); |
| BOOL | ExpApiSaveSelectedAsCell(LPCTSTR szCellName); |
| BOOL | ExpApiSelectByBox(double dSx, double dSy, double dEx, double dEy, SELECT_BOOL_MODE selMode = SBM_SELECT_RESELECT); |
| BOOL | ExpApiSelectByBox(RCEAPoint ptStart, RCEAPoint ptEnd, SELECT_BOOL_MODE selMode = SBM_SELECT_RESELECT); |
| BOOL | ExpApiSelectByBox(RCEARect rtRect, SELECT_BOOL_MODE selMode = SBM_SELECT_RESELECT); |
| BOOL | ExpApiMergeSelected(); |
| BOOL | ExpApiResizeSelected(double dSize, BOOL bUnderSize = FALSE, BOOL bGrid = FALSE, BOOL bMerge = FALSE); |
| BOOL | ExpApiMergeWires(); |
| BOOL | ExpApiGenDLayer(LPCTSTR szLayerName = NULL); |
| BOOL | ExpApiGenAllDLayers(); |
| BOOL | ExpApiCleanCellPrimitivesDLayer(); |
| BOOL | ExpApiCleanCellHierarchyDLayer(); |
| BOOL | ExpApiCleanWholeProjectDLayer(); |
| BOOL | ExpApiCleanCellPrimitivesSLayer(); |
| BOOL | ExpApiCleanCellHierarchySLayer(); |
| BOOL | ExpApiCleanWholeProjectSLayer(); |
| BOOL | ExpApiDeleteTechnologySLayers(); |
| BOOL | ExpApiCreateNewCellInPlace(LPCTSTR szCellName, BOOL bInPlace = FALSE); |
| BOOL | ExpApiExplodeSelected(); |
| BOOL | ExpApiExplodeAll(); |
| BOOL | ExpApiFlatten(LPCTSTR szCellName = NULL); |
| BOOL | ExpApiReplaceSelectedInstances(LPCTSTR szCellName = NULL); |
| BOOL | ExpApiReplaceInstancesInCell(LPCTSTR szSourceCell, LPCTSTR szTargetCell); |
| BOOL | ExpApiReplaceInstancesInProject(LPCTSTR szSourceCell, LPCTSTR szTargetCell); |
| LPCTSTR | ExpApiGetCellName(HCELL hCell); |
| int | ExpApiGetCellNumber(LPCTSTR szLibName = NULL); |
| HCELL | ExpApiGetFirstCell(LPCTSTR szLibName = NULL); |
| HCELL | ExpApiGetNextCell(LPCTSTR szLibName = NULL); |
| LPCTSTR | ExpApiGetLayerName(HLAYER hLayer); |
| int | ExpApiGetLayerNumber(LPCTSTR szCellName = NULL); |
| HLAYER | ExpApiGetFirstLayer(LPCTSTR szCellName = NULL); |
| HLAYER | ExpApiGetNextLayer(LPCTSTR szCellName = NULL); |
| LPCTSTR | ExpApiGetCellLayerName(HCLAYER hLayer); |
| int | ExpApiGetCellLayerNumber(LPCTSTR szCellName = NULL); |
| HCLAYER | ExpApiGetFirstCellLayer(LPCTSTR szCellName = NULL); |
| HCLAYER | ExpApiGetNextCellLayer(LPCTSTR szCellName = NULL); |
| LPCTSTR | ExpApiGetTechLayerName(HTLAYER hLayer); |
| int | ExpApiGetTechLayerNumber(); |
| HTLAYER | ExpApiGetTechFirstLayer(); |
| HTLAYER | ExpApiGetTechNextLayer(); |
| BOOL | ExpApiAddTechLayer(const LAYER_PROPERTY& Property); |
| BOOL | ExpApiGetTechLayer(LPCTSTR szLayerName, LAYER_PROPERTY& Property); |
| BOOL | ExpDeleteTechLayer(LPCTSTR szLayerName); |
| void | ExpApiSetSetupTechnology(const TECHNOLOGY_SETUP& sTechSetup); |
| void | ExpApiGetSetupTechnology(TECHNOLOGY_SETUP& sTechSetup); |
| void | ExpApiSetSetupGeneral(const GENERAL_SETUP& sGeneralSetup); |
| void | ExpApiGetSetupGeneral(GENERAL_SETUP& sGeneralSetup); |
| void | ExpApiSetSetupGDS(const GDS_SETUP& sGDSSetup); |
| void | ExpApiGetSetupGDS(GDS_SETUP& sGDSSetup); |
| void | ExpApiSetSetupCIF(const CIF_SETUP& sCIFSetup); |
| void | ExpApiGetSetupCIF(CIF_SETUP& sCIFSetup); |
| void | ExpApiSetSetupApplicon(const APPLICON_SETUP& sAPPLICONSetup); |
| void | ExpApiGetSetupApplicon(APPLICON_SETUP& sAPPLICONSetup); |
| BOOL | ExpApiSaveSettings(LPCTSTR szFileName); |
| BOOL | ExpApiLoadSettings(LPCTSTR szFileName); |
| HOBJECT | ExpApiCreateBox(double dSx, double dSy, double dEx, double dEy, LPCTSTR szLayerName = NULL) |
| HOBJECT | ExpApiCreateBox(RCEAPoint ptPos, RCEAPoint ptSize, LPCTSTR szLayerName = NULL) |
| HOBJECT | ExpApiCreateBox(RCEARect rtRect, LPCTSTR szLayerName = NULL) |
3.3 Example Description of Functions for Box Creation
double dSx, double dSy - initial position of Top Left corner;
RCEAPoint ptPos - initial position of Top Left corner;
double dEx, double dEy - width, height; RCEAPoint ptSize - width, height;
RCEARect rtRect - initial position of Top Left corner, width, height;
LPCTSTR szLayerName -name of the layer. New object will be created in a current layer if layer name is not given.
Example:
HOBJECT hObject = ExpApiCreateBox(0, 0, 10, 100, "Poly");