Electra

Electra

The main Electra namespace.

Methods

.cableList([list]) Returns: Array

Update the cable tags that are attached to the Wire

NameTypeAttributesDescription
listArrayoptional

Provide undefined to get, and an array of objects to set

Returns:

Return the value if get value or nothing if set value.

Examples:
var list = [ { data: 'name|brand|etc', net: 'wire1|wire2|wire3' } ];

Electra.cableList(list); // this value will be set on the document json

.compareAlphaNum(value1, value2) Returns: number

Compare alphanumerics, alphabets, and numbers

NameTypeDescription
value1string|number

Value for comparison

value2string|number

Value for comparison

Returns:

Returns 1 if value1 larger than value2, otherwise returns -1, can be used for sorting

.createLayoutSymbol(lay_sym, opt) Returns: Promise.<T>

Create layout symbol and add to stencil

NameTypeDescription
lay_symVecta.Shape

Must be a group shape

optobject

Options object

NameTypeAttributesDefaultDescription
is_circlebooleanoptionalfalse

Indicate this layout is circle or not. Default to false

rotate_menubooleanoptionaltrue

Flag to insert horizontal/vertical menu to the layout. Default to true

nameStringoptional'Untitled Symbol'

The symbol name. Default to 'Untitled Symbol'

descStringoptional''

The symbol description.

permStringoptionalopt.name

The symbol permanent link. Default to symbol name.

stencil_idStringoptional

Stencil id. Will create a new stencil if not passed.

Examples:
var opt = {
     is_circle: false,
     rotate_menu: true,
     name: 'My Layout',
     desc: 'My description',
     perm: 'My Layout',
     stencil_id: ...

};

Electra.createLayoutSymbol(lay_sym, opt).then(function () {
    //Layout symbol created
});

.getComponentInfo(shape) Returns: Promise

Get component info from a shape

NameTypeDescription
shapeVecta.Shape

Shape to get component info from

Returns:

Promise that resolves shape's component info

.getConnections(type) Returns: Promise

Get connections on the drawing

NameTypeDescription
typestring

The wire type

Returns:

Promise that resolves the connections object

.getLocation(page_id, point, x, y) Returns: string

Compare alphanumerics, alphabets, and numbers

NameTypeDescription
page_idstring

ID of the page

pointobject

Point of the location

xnumber

X of the location

ynumber

Y of the location

Returns:

The location, E.g. /1.A1

.getRefShapes([ref]) Returns: Object

Get list of shape ids with the same reference

NameTypeAttributesDescription
refstringoptional

Reference to search

Returns:

List of shape ids by page ids. Structure is { pg_id: [shp_ids] }

.getSortedRefs() Returns: string[]

Get list of references on the drawing

Returns:

List of references on the drawing

.getTerminalNames() Returns: Array

Get list of terminal names on the drawing

Returns:

An array of terminal names on the drawing

.getWireNameList() Returns: object

Get the list of wire names and their quantity for printing label stamps of wire names each wire connection from 1 symbol to another symbol will need 2 label stamps

Returns:

List of wire names and their quantity. Example: { 'R1': 3 }

.searchNetwork(wire, scanned) Returns: Promise.<T>

Given a wire, we scan through all the wires and symbols that connected to it

NameTypeDescription
wireVecta.Shape

The wire that we want to scan

scannedobject

The list of wires that already scanned before, its structure is { wire_id: 1 }

Returns:

It resolved an object:

1. If the wire is already scanned previously, it resolves { scanned: true }

2. Otherwise, it resolve { nets: { id: {object} }, shapes: [ {object} ] }

.setAutoLoc(autoloc, reference) Returns: Promise.<T>

Shows or update the locations of a AutoLocation symbol

NameTypeDescription
autolocVecta.Shape

The AutoLocation symbol that we want to shows or update its locations

referencestring

The symbol reference that we want to locate

.updateCableTag(wire) Returns: Promise.<T>

Update the cable tags that are attached to the Wire

NameTypeDescription
wireVecta.Shape

The Wire that we want to update its cable information

Capital™ Electra™ X