Specifications Logic Samples

This section consist of the EKL sample scripts for the specifications logic of an automation process.

This page discusses:

Drawing Automation Process

An example of definition of the arguments of a specifications logic for a drawing that creates a new drawing with customized drawing title is as shown below:

Let FinalDrawingTitle(String)
Let DrawingStandard(String)

if (NULL <> InputOccurrence)
{
	// Default drawing title from the name of the product occurrence
	FinalDrawingTitle = "DRW_" + InputOccurrence.Name
	if (NULL <> DrawingTitle)
	{
		if ((DrawingTitle->Length()) > 0)
			FinalDrawingTitle = DrawingTitle // The user has provided a customized drawing title
	}
	DrawingStandard = "ISO"

	DrawingSpec.SetDrawingStandard(DrawingStandard)
	DrawingSpec.Title = FinalDrawingTitle
}

Sheet Automation Process

An example of definition of the arguments of a specifications logic for a sheet that creates a new sheet with customized title and sheet template is as shown below:

Let SheetName(String)
Let SheetTemplateName(String)

if (NULL <> InputOccurrence)
{
	SheetName = "Sheet for " + InputOccurrence.Name
	SheetTemplateName = "Automation Sample ISO Sheet Template"

	SheetSpec.SheetName = SheetName
	SheetSpec.SetSheetTemplate(SheetTemplateName)
}

Front View Automation Process

An example of definition of the arguments of a specifications logic for a front view that creates a new front view customized name, apply view template, and set position in a sheet as shown below:

Let ViewName(String)
Let ViewTemplateName(String)
Let ViewLinks(List)
Let ProjectionPlaneOriginX(Real)
Let ProjectionPlaneOriginY(Real)
Let ProjectionPlaneOriginZ(Real)
Let ProjectionPlaneFirstDirX(Real)
Let ProjectionPlaneFirstDirY(Real)
Let ProjectionPlaneFirstDirZ(Real)
Let ProjectionPlaneSecondDirX(Real)
Let ProjectionPlaneSecondDirY(Real)
Let ProjectionPlaneSecondDirZ(Real)
Let ViewAxisPositionX(Real)
Let ViewAxisPositionY(Real)

if (NULL <> InputOccurrence)
{
	// The created view represents the whole product
	ViewLinks.Append(InputOccurrence)
	ViewSpec.SetViewLinks(ViewLinks)
	
	// Show the name of the product in the view name
	ViewName = "TOP View of " + InputOccurrence.Name
	ViewSpec.ViewName = ViewName
	
	ViewTemplateName = "Automation Sample View Template"
	ViewSpec.SetViewTemplate(ViewTemplateName)
	
	// Create a side view (frame view) using the global 3D referential as 3D origin
	ProjectionPlaneOriginX = 0.
	ProjectionPlaneOriginY = 0.
	ProjectionPlaneOriginZ = 0.
	ProjectionPlaneFirstDirX = 1.
	ProjectionPlaneFirstDirY = 0.
	ProjectionPlaneFirstDirZ = 0.
	ProjectionPlaneSecondDirX = 0.
	ProjectionPlaneSecondDirY = 1.
	ProjectionPlaneSecondDirZ = 0.
	ViewSpec.SetProjectionPlane(ProjectionPlaneOriginX, ProjectionPlaneOriginY, ProjectionPlaneOriginZ, ProjectionPlaneFirstDirX, ProjectionPlaneFirstDirY, ProjectionPlaneFirstDirZ, ProjectionPlaneSecondDirX, ProjectionPlaneSecondDirY, ProjectionPlaneSecondDirZ)
	
	// View is created so that the position of the axis is at (50, 100) of the sheet
	ViewAxisPositionX = 50.
	ViewAxisPositionY = 100.
	ViewSpec.SetViewAxisPosition(ViewAxisPositionX, ViewAxisPositionY)
	
}

Structural View Automation Process

An example of definition of the arguments of a specifications logic for a structural view that creates a new structural view customized name, apply view template, and set position in a sheet as shown below:

...

// Set View Links
ViewLinks.Append(InputOccurrence)
ViewSpec.SetViewLinks(ViewLinks)

// Set View Template
ViewTemplateName = "Automation Sample Structural View Template"
ViewSpec.SetViewTemplate(ViewTemplateName)

// Set View Projection Plane
ViewSpec.SetProjectionPlane(ProjectionPlaneOriginX, ProjectionPlaneOriginY, ProjectionPlaneOriginZ, ProjectionPlaneFirstDirX, ProjectionPlaneFirstDirY, ProjectionPlaneFirstDirZ, ProjectionPlaneSecondDirX, ProjectionPlaneSecondDirY, ProjectionPlaneSecondDirZ)
	
// Set View Name
ViewSpec.ViewName = ViewName	

// Set View Box
ViewSpec.AddNewViewBoxSpec(ViewBox)

...