About the Automation of Branch Creation in EKL

The Entreprise Knowledge Language provides a library of functions and methods to create automatically a branch and define its route.

The library can be handled in the following order:

This page discusses:

Creation of a Branch

CreateBranch

Sample

The following sample illustrates how to create route elements, and then define a new branch and its route.

let result(Boolean)


/* ------------------------------------------------------------*/
/*Create point route element from an existing geometrical point*/
/* ------------------------------------------------------------*/

let PointRouteElement(Elec3DPointRouteElement)

result=FALSE
result=CreatePointRouteElement( ExistingPoint, PointRouteElement)

if ( result==TRUE) Notify("point route element created ")
	else Notify(" point route element NOT created !!! ") 


/* ------------------------------------------------------*/	
/* Create Support route element from an existing support */
/* ------------------------------------------------------*/

let SupportRouteElement(Elec3DSupportRouteElement)

result=FALSE
result=CreateSupportRouteElement(ExistingSupport, 1, SupportRouteElement)
if ( result==TRUE) Notify("support route element created ")
	else Notify(" support route element  NOT created !!! ") 
	

/* -----------------------------------------------------*/	
/* Create device route element from an existing Device  */
/* -----------------------------------------------------*/

/* First we need to know on which connection point we will create the route element */

let ListOfCntPt(List)
let TypeOfCntPt(list)
let ElecCntPoint(Elec3DSegmentConnectionPoint)

TypeOfCntPt.Append("Elec3DSegmentConnectionPoint")

/* list all connection points of the reference of the device */

ListElectricalConnectionPoints(ExistingDevice.Reference, TypeOfCntPt, ListOfCntPt)

/* we take the first connection point */

if(ListOfCntPt.Size()>0)
{
	ElecCntPoint=ListOfCntPt.GetItem(1)
}


let DeviceRouteElement(Elec3DDeviceRouteElement)

result=FALSE
result=CreateDeviceRouteElement(ExistingDevice, ElecCntPoint, DeviceRouteElement)

if ( result==TRUE) Notify("Device route element created ")
	else Notify("Device route element NOT created !!! ") 
	

/* -----------------------------------------------------*/	
/* Create branch from all the route elements previously created     */
/* -----------------------------------------------------*/

/* create the list of route element */
let ListOfRouteElement(List)

ListOfRouteElement.Append(PointRouteElement)
ListOfRouteElement.Append(SupportRouteElement)
ListOfRouteElement.Append(DeviceRouteElement)

let NewBranch(Branch)
result=FALSE


/* Create the branch under the Electrical Branch Geometry set at first argument */
result=CreateBranch(EBG,ListOfRouteElement, NewBranch)

if ( result==TRUE) Notify("NewBranch created ")
	else Notify("NewBranch NOT created !!! ") 
	


/* ----------------------------------------*/	
/* Modify the attributes of the branch     */
/* ----------------------------------------*/

/* Set the Name of the branch */
NewBranch.Name="Branch.1"

/* Set the build mode of the branch */
NewBranch.SetBuildMode("Bend")

/* Set the bend radius of the branch */
NewBranch.SetBendRadius(20mm)

/* Set the profile on the segment of the branch */
let Circle(ElecCircularProfile)
CreateCircularProfile(20mm, Circle)


let ListSegment(List)
let Segment1(Segment)

ListSegment=NewBranch.Children

if(ListSegment.Size()>0)
{
	Segment1 = ListSegment.GetItem(1)
}

Segment1.SetProfile(Circle)