The main Electra namespace.
Methods
.cableList([list]) Returns: Array
Update the cable tags that are attached to the Wire
Name | Type | Attributes | Description |
---|---|---|---|
list | Array | optional | 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
Name | Type | Description |
---|---|---|
value1 | string|number | Value for comparison |
value2 | string|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
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lay_sym | Vecta.Shape | Must be a group shape | |||||||||||||||||||||||||||||||||||
opt | object | Options object
|
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
Name | Type | Description |
---|---|---|
shape | Vecta.Shape | Shape to get component info from |
Returns:
Promise that resolves shape's component info
.getConnections(type) Returns: Promise
Get connections on the drawing
Name | Type | Description |
---|---|---|
type | string | The wire type |
Returns:
Promise that resolves the connections object
.getLocation(page_id, point, x, y) Returns: string
Compare alphanumerics, alphabets, and numbers
Name | Type | Description |
---|---|---|
page_id | string | ID of the page |
point | object | Point of the location |
x | number | X of the location |
y | number | Y of the location |
Returns:
The location, E.g. /1.A1
.getRefShapes([ref]) Returns: Object
Get list of shape ids with the same reference
Name | Type | Attributes | Description |
---|---|---|---|
ref | string | optional | 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
Name | Type | Description |
---|---|---|
wire | Vecta.Shape | The wire that we want to scan |
scanned | object | 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
Name | Type | Description |
---|---|---|
autoloc | Vecta.Shape | The AutoLocation symbol that we want to shows or update its locations |
reference | string | The symbol reference that we want to locate |
.updateCableTag(wire) Returns: Promise.<T>
Update the cable tags that are attached to the Wire
Name | Type | Description |
---|---|---|
wire | Vecta.Shape | The Wire that we want to update its cable information |