This class allows creation and modification of l5x Sheet.

XML data is stored in variablename.l5xdata (XMLDocument format).


Example 1:

Creating an empty l5x Sheet with default parameters:

const mySheet = new kSDKv1.l5xSheet();

New Sheet is a complete (though empty) l5x Sheet that can be modified with methods (see below).


Example 2:

Creating a Sheet from custom XML (this will overwrite all default parameters):

const myNewCustomSheet = new kSDKv1.l5xSheet(`<Sheet Number="1"><Description><![CDATA[]]></Description></Sheet>`);

It is important to inject XML with the root node name = "Sheet". An error is generated if this condition is not satisfied.


METHODSClick on Methods for further information
Category
getsetadddeleteSpecial
NumbergetNumber()setNumber()



Logic ElementgetLogicElements()

addLogicElement()
deleteLogicElement()

DescriptiongetDescription()
setDescription()

Files



toText()

Number


getNumber()

ParametersReturns
Returns a sheet position.
NASheet position - (number)


Example

var newSheet = new kSDKv1.l5xSheet();
newSheet.setNumber(5);
console.log(newSheet.getNumber()); // -> "5"



setNumber(newNumber)

ParametersReturns

Sets new sheet position.

newNumber – (number) New sheet position.
NA


Example

var newSheet = new kSDKv1.l5xSheet();
newSheet.setNumber(5);
console.log(newSheet.getNumber()); // -> "5"

Logic Element


getLogicElements()

ParametersReturns

Returns all logic elements from the given sheet.

NA

Sheet logic elements - ([object]).

NOTE: Logic elements are returned as an array of JS objects. Each object contains all the information about the logic element. See the “Function Block logic elements” section for information about elements’ structure.


Example

var newSheet = new kSDKv1.l5xSheet();
var AOIinst = {
          element: "AddOnInstruction",
          Name: "SomeAOI",
          ID: "123",
          X: "120",
          Y: "80",
          Operand: "AOITag1",
          VisiblePins:"Input1 Output1 InOutParam1 InOutParam2",
          InOutParameter: [
               {Name:"InOutParam1", Argument:"tag1"},                     
               {Name:"InOutParam2", Argument:"tag2"}
          ]
};
newSheet.addLogicElement(AOIinst);
var logElem = newSheet.getLogicElements()[0];
console.log(logElem.Name); // -> "SomeAOI"


addLogicElement(LogicElement)

ParametersReturns

Adds a logic element to the sheet.

logicElement – (Logic) Logic element to add.

NA


NOTE: See the “Function Block logic elements” section for information about elements’ structure.

Example

var newSheet = new kSDKv1.l5xSheet();
var AOIinst = {
          element: "AddOnInstruction",
          Name: "SomeAOI",
          ID: "123",
          X: "120",
          Y: "80",
          Operand: "AOITag1",
          VisiblePins:"Input1 Output1 InOutParam1 InOutParam2",
          InOutParameter: [
               {Name:"InOutParam1", Argument:"tag1"},
               {Name:"InOutParam2", Argument:"tag2"}
          ]
};
newSheet.addLogicElement(AOIinst);
var logElem = newSheet.getLogicElements()[0];
console.log(logElem.Name); // -> "SomeAOI"


deleteLogicElement(LogicElement)

ParametersReturns

Deletes a logic element from the sheet.

logicElement – (object) Logic element to delete.

NA


NOTE: See the “Function Block logic elements” section for information about elements’ structure.

Example

var newSheet = new kSDKv1.l5xSheet();
var AOIinst = {
          element: "AddOnInstruction",
          Name: "SomeAOI",
          ID: "123",
          X: "120",
          Y: "80",
          Operand: "AOITag1",
          VisiblePins:"Input1 Output1 InOutParam1 InOutParam2",
          InOutParameter: [
               {Name:"InOutParam1", Argument:"tag1"},
               {Name:"InOutParam2", Argument:"tag2"}
          ]
};
newSheet.addLogicElement(AOIinst);
console.log(newSheet.getLogicElements().length); // -> "1"
newSheet.deleteLogicElement(AOIinst);
console.log(newSheet.getLogicElements().length); // -> "0"



Description


getDescription()

ParametersReturns

Returns a sheet description.

NA

Sheet comment - (string)


Example

var newSheet = new kSDKv1.l5xSheet();
newSheet.setDescription("New sheet description");
console.log(newSheet.getDescription()); // -> "New sheet description"


addDescription(newDescription)

ParametersReturns

Sets new sheet description.

newDescription – (string) New sheet description.

NA


Example

var newSheet = new kSDKv1.l5xSheet();
newSheet.setDescription("New sheet description");
console.log(newSheet.getDescription()); // -> "New sheet description"