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)

...

Horizontal Alignment View Automation Process

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

// Let assume ViewSpec(ASDSpecHorizontalAlignmentView) , InputAlignment(AECAlignment), InputStartDistance(LENGHT), InputEndDistance(LENGHT) and InputOverlap(LENGHT) are input. 
if InputAlignment <> NULL

{
                // Get horizontal alignment
                Let horizontalAlignment(AECAlignment2DHorizontal)
                horizontalAlignment = InputAlignment->GetHorizontalAlignment( )
                
                // Get horizontal alignment length
                Let lengthAlignment(Length)
                lengthAlignment = 0m
                if (NULL <> horizontalAlignment)
                {
                                lengthAlignment = horizontalAlignment->GetLength()
                }
                
                // Add horizontal alignment to view links
                Let ViewLinks(List)
                ViewLinks.Append( horizontalAlignment )
                ViewSpec->SetViewLinks( ViewLinks )
                
                //Set view template
                Let ViewTemplateName(String)
                ViewTemplateName = "Road horizontal view"
                ViewSpec.SetViewTemplate(ViewTemplateName)
                
                // Set start distance
                if InputStartDistance-InputOverlap > 0m
                {
                                ViewSpec->SetStartDistance( InputStartDistance-InputOverlap )
                }
                else
                {
                                ViewSpec->SetStartDistance( 0m )                            
                }
                
                // Set end distance
                if InputEndDistance+InputOverlap < lengthAlignment
                {
                                ViewSpec->SetEndDistance( InputEndDistance+InputOverlap )
                }
                else
                {
                                ViewSpec->SetEndDistance( lengthAlignment )                   
                }
                
                // Set view name
                ViewSpec.ViewName = "HA View"
                
                // Set view position
                Let SpecViewPositionAlignment(ASDSpecViewPositionAlignment)
                ViewSpec->CreateViewPositionAlignment(SpecViewPositionAlignment)
                if SpecViewPositionAlignment <> NULL
                {
                                SpecViewPositionAlignment->SetStartAnchor(0)
                                SpecViewPositionAlignment->SetDirections(1,2)                                                                                                                                   
                                SpecViewPositionAlignment->SetSheetMargins( 10, 10 )
                                SpecViewPositionAlignment->SetViewSizeMode(2)                          
                }
                
                Let BackgroundImageType(BackgroundImageTypeEnum)
                Let oBackgroundImageRelimit (Boolean)
                BackgroundImageType = "ImageMapping"
                oBackgroundImageRelimit = TRUE
                ViewSpec.SetBackgroundImageType(BackgroundImageType)
                ViewSpec.SetBackgroundImageRelimit(oBackgroundImageRelimit)
}

Vertical Alignment View Automation Process

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

// Let assume ViewSpec(ASDSpecVerticalAlignmentView) , InputAlignment(AECAlignment), InputStartDistance(LENGHT), InputEndDistance(LENGHT) and InputOverlap(LENGHT) are input. 
if InputAlignment <> NULL
{
                // Get vertical alignment
                Let verticalAlignment(AECAlignment2DVertical)
                verticalAlignment = InputAlignment->GetVerticalAlignment( )
                
                Let EndVerticalAlignment(Length)
                EndVerticalAlignment = 0mm
                if (NULL <> verticalAlignment)
                {
                                EndVerticalAlignment = verticalAlignment->GetEndPointDistance()
                }
                
                Let BeginVerticalAlignment(Length)
                BeginVerticalAlignment = 0mm
                if (NULL <> verticalAlignment)
                {
                                BeginVerticalAlignment = verticalAlignment->GetStartPointDistance()
                }
                
                // Add vertical alignment to view links
                Let ViewLinks(List)
                ViewLinks.Append( verticalAlignment )
                ViewSpec->SetViewLinks( ViewLinks )
                
                //Set view template
                Let ViewTemplateName(String)
                ViewTemplateName = "Road vertical view"
                ViewSpec.SetViewTemplate(ViewTemplateName)
                
                // Get horizontal alignment
                Let horizontalAlignment(AECAlignment2DHorizontal)
                horizontalAlignment = InputAlignment->GetHorizontalAlignment( )
                
                // Get horizontal alignment length
                Let lengthAlignment(Length)
                lengthAlignment = 0mm
                if (NULL <> horizontalAlignment)
                {
                                lengthAlignment = horizontalAlignment->GetLength()
                }
                
                // Set start distance
                if InputStartDistance-InputOverlap > BeginVerticalAlignment
                {
                                ViewSpec->SetStartDistance( InputStartDistance-InputOverlap )
                }
                else
                {
                                ViewSpec->SetStartDistance( BeginVerticalAlignment )                                
                }
                
                // Set end distance
                if InputEndDistance+InputOverlap < EndVerticalAlignment
                {
                                ViewSpec->SetEndDistance( InputEndDistance+InputOverlap )
                }
                else
                {
                                if(EndVerticalAlignment < lengthAlignment)
                                                ViewSpec->SetEndDistance( EndVerticalAlignment )
                                else
                                                ViewSpec->SetEndDistance( lengthAlignment )                                             
                }
                //Set stretch
                let stretch(real)
                stretch = 5.0
                ViewSpec->SetStretch(stretch)
                // Set view name
                ViewSpec.ViewName = "VA View"
                
                // Set view position
                Let SpecViewPositionAlignment(ASDSpecViewPositionAlignment)
                ViewSpec->CreateViewPositionAlignment(SpecViewPositionAlignment)
                if SpecViewPositionAlignment <> NULL
                {
                                SpecViewPositionAlignment->SetStartAnchor(2)
                                SpecViewPositionAlignment->SetDirections(1,2)
                                SpecViewPositionAlignment->SetSheetMargins( 10, 10 )
                                SpecViewPositionAlignment->SetViewSizeMode(2)       
                }
}