Context:
EKL functions for annotations :
- Instantiate Text/Table/Label Templates with EKL in View and DifView.
- Create Text/Table/Label with EKL in View and DifView.
- Retrieve list of Annotations in View and DifView.
Code :
//=======================
// Example of Knowledge code
//=======================
Let RefLabel (DrwObject)
set RefLabel=Sheet.1\\View.1\\DrwDressUp.1\\Label.4
Let myView(DrwObject)
Set myView=Sheet.1\\View.1
Let coordX(Real)
Set coordX=600
Let coordY(Real)
Set coordY=500
// Instantiate a Label
//===============
Let NewLabelInst(DrwObject)
myView->InstantiateAnnTemplate(RefLabel, coordX, coordY, NewLabelInst)
// Create a Text
//===========
Let Text(String)
Set Text="Hello"
Let NewText(DrwObject)
myView->CreateAnnText(coordX, coordY, Text, NewText)
//Create a Table
//===========
Let nbRows(Integer)
Set nbRows = 5
Let nbColumns(Integer)
Set nbColumns = 8
Let cellW(Real)
Set cellW=0.7
Let cellH(Real)
Set cellH=0.7
Let NewTable(DrwObject)
myView->CreateAnnTable(coordX, coordY, nbRows, nbColumns, cellW, cellH, NewTable)
// Create Label
// ==========
// (Label can be created either from another Label or a detail)
Let myCompRef(DrwObject)
Set myCompRef=`Sheet.2 (Detail)\\2D Component.1`
Let NewLabel(DrwObject)
myView->CreateAnnLabel( myRef, coordX, coordY, NewInst)
// Retrieve list of annotations
//======================
Let ListAnnots(List)
myView->GetViewAnnotations(ListAnnots)
let size(Integer)
size=ListAnnots->Size()
let i(Integer)
let myAnnot(DrwObject)
For i while i<=size
{
set myAnnot=ListAnnots->GetItem(i)
message("scanning annotations in view")
}
Test Data :
