Annotation Template Samples

This section consist of the EKL sample scripts for the various annotation templates.

This page discusses:

Compass Annotation Template

An example of GetNearestSRSPlane to extract the Space Reference System (SRS) name is as shown below:

/* Create rule using Template Parameters. */
let oX(LENGTH)
let oY(LENGTH)
oX=`Elevation Mark Templates\CompassAnnotationArrow\ASDDrwAnnotationTemplate.1\Parameters\AxisOriginPoint_X` 
oY=`Elevation Mark Templates\CompassAnnotationArrow\ASDDrwAnnotationTemplate.1\Parameters\AxisOriginPoint_Y` 

let aX(LENGTH)
let aY(LENGTH)
aX=`Elevation Mark Templates\CompassAnnotationArrow\ASDDrwAnnotationTemplate.1\Parameters\AxisXPoint_X` 
aY=`Elevation Mark Templates\CompassAnnotationArrow\ASDDrwAnnotationTemplate.1\Parameters\AxisXPoint_Y` 

let bX(LENGTH)
let bY(LENGTH)
bX=`Elevation Mark Templates\CompassAnnotationArrow\ASDDrwAnnotationTemplate.1\Parameters\AxisYPoint_X` 
bY=`Elevation Mark Templates\CompassAnnotationArrow\ASDDrwAnnotationTemplate.1\Parameters\AxisYPoint_Y` 

let cX(LENGTH)
let cY(LENGTH)
cX=`Elevation Mark Templates\CompassAnnotationArrow\ASDDrwAnnotationTemplate.1\Parameters\AxisZPoint_X` 
cY=`Elevation Mark Templates\CompassAnnotationArrow\ASDDrwAnnotationTemplate.1\Parameters\AxisZPoint_Y` 

/* at newly created points we can create labels for each direction, in example x,y,z*/

/*x*/
`Elevation Mark Templates\CompassAnnotationArrow\Text.3` ->SetPosition(aX,aY)

/*y*/
`Elevation Mark Templates\CompassAnnotationArrow\Text.4` ->SetPosition(bX,bY) 

/*z*/
`Elevation Mark Templates\CompassAnnotationArrow\Text.6`->SetPosition(cX,cY)  

/* we can also create lines that will look like standard axis */

`Elevation Mark Templates\CompassAnnotationArrow\Line.3` ->SetPoints(oX,oY,aX,aY)
`Elevation Mark Templates\CompassAnnotationArrow\Line.4` ->SetPoints(oX,oY,bX,bY)  
`Elevation Mark Templates\CompassAnnotationArrow\Line.5` ->SetPoints(oX,oY,cX,cY) 


/* next we will create a compass arrow as label and rotate it in direction of axis X*/
let angl_x(ANGLE)
angl_x=`Elevation Mark Templates\CompassAnnotationArrow\ASDDrwAnnotationTemplate.1\Parameters\Angle_X` 


`Elevation Mark Templates\CompassAnnotationArrow\Label.1`->SetOrientation(angl_x)

...

Coordinate Annotation Template

An example of GetNearestSRSPlane to extract the SRS name is as shown below. It takes the elements xyz coordinates and vector direction to output a string.

// global x,y,z are node coordinates 
let GlobalX(LENGTH)	
let GlobalY(LENGTH)
let GlobalZ(LENGTH)

// refrence are x,y,z of reference point of origin or srs plane 
let Reference_X(LENGTH)
let Reference_Y(LENGTH)
let Reference_Z(LENGTH)

// reference is not needed in this scenario, its exposed if we need to do relation computation 
// note: Distance attribute is already computed and exposed as distance between two points

// this is direction of a vector, 1,2 or 3
Let SRS_Direction(INTEGER) 

Let SRS_PlaneOut(STRING)
// valutate the variables 

...

// SRS name 

// direction 1: Frame    
// direction 2: Long     
// direction 3: Deck    

SRS_Direction=1 
SRS_PlaneOut=GetNearestSRSPlane(GlobalX,GlobalY,GlobalZ,SRS_Direction) 

...

View Title Annotation Template

Argument
Name Type
DftView DrwView We can extract all basic information from a drafting view. For example, name or scale.
ASDView ASDView For more advanced information, we can also use the ASD view.

	
/* Create action using Arguments and Template Parameters. */
/* View Name */

/* we will extract name from DFT view*/ 

Let ViewName(String)
ViewName=DftView.Name

/* we can also extract a scale */
Let ViewScaleAsReal(Real)
Let ViewScale(String)
ViewScaleAsReal=DftView.ViewScale 
ViewScale=ToString(ViewScaleAsReal) 

/* or view looking direction */
Let ViewDirection(String)
ViewDirection=DftView->GetLookingDirection()


/* for more advanced information such as name of a reference object view is created from will will use ASD View*/
Let ViewReferenceObject(ProductOccurrence)
Let ViewReferenceObjectName(String)

ViewReferenceObject=ASDView.RepresentedProduct 
ViewReferenceObjectName=ViewReferenceObject.Name

/*Example of creating annotation text*/
Let AnnotationText(String)
AnnotationText=ViewName + " " + ViewReferenceObjectName
`Sheet.2 (Detail)\ASD Simple Annotation\ASDDrwAnnotationTemplate.1\Parameters\ASDAnnotationText` =AnnotationText

/* ... */