Class Reference sElement

A single schematic element. More...

Member

void addParameter(string parameter , string value)
double getDoubleParameter(string parameter)
component* getComponent()
int getIntParameter(string parameter)
string getParameter(string parameter)
stringList getParameterList()
string getParsedParameter(string parameter)
point getPoint()
pointArray getPoints()
point getPortPos(string portname)
bool isGlobal()
bool isPortOrBusport()
bool isArc()
bool isBus()
bool isBusport()
bool isCircle()
bool isDevice()
bool isGround()
bool isPolyline()
bool isPolygon()
bool isPort()
bool isRect()
bool isText()
bool isWire()
bool isWireLabel()
void setColor(int red,int green, int blue)
void setGlobal(bool global)
void setParameter(string parameter, string value, bool triggerCallback=false)

Detailed Description

graph LR ce(sheet)--firstElement-->el(sElementList) el--thisElement-->e(sElement) el--nextElement-->el click ce "/layoutscript/api/sheet" click el "/layoutscript/api/selementlist" click e "/layoutscript/api/selement" classDef thisClas fill:#eaf5fc,stroke:#3c7faa,stroke-width:4px; classDef clas fill:#eaf5fc,stroke:#3c7faa,stroke-width:1px; class e thisClas class ce,el clas

An sElement is one object on a schematic sheet: a device, a wire, a port, a ground, a label, or a drawing shape such as a polygon. You never construct it; addWire, addPlacement and the other add… methods on sheet return the new element. Walk firstElement on the sheet and use the is… tests before you read geometry or parameters. Devices hold a component from getComponent and a list of parameters; addParameter creates or overwrites a value, while setParameter only changes a name that already exists. Colour of non-functional shapes is setColor; wires, devices and ports take their colour from setup. A missing port position is the sentinel point (-123456789, -123456789).

Example:

sElementList *el = schematic->drawing->currentSheet->firstElement;
while (el != NULL) {
 sElement *e = el->thisElement;
 if (e != NULL && e->isDevice()) {
 component *c = e->getComponent();
 string w = e->getParameter("width");
 e->setParameter("width", "1.2u", false);
 }
 el = el->nextElement;
}

Member Function Documentation


void sElement::addParameter(string parameter , string value)

Adds parameter and sets it to value. If the name already exists, only the value is replaced.

Parameter:
parameter parameter
value value

double sElement::getDoubleParameter(string parameter)

Returns: the value of parameter as a double. If the parameter is missing or is not a double, 0 is returned.


component* sElement::getComponent()

Returns: the component of a device, or NULL for every other element type. (introduced with release 20211005)


int sElement::getIntParameter(string parameter)

Returns: the value of parameter as an integer. If the parameter is missing or is not an integer, -1 is returned.


string sElement::getParameter(string parameter)

Returns: the value of parameter as a string. Numerical parameters are converted to text.


stringList sElement::getParameterList()

Returns: a stringList of all device parameter names. The device name itself is not in this list.


string sElement::getParsedParameter(string parameter)

Returns: the value of parameter after iPDK parsing.


point sElement::getPoint()

Returns: the origin of a single-point element such as a port, a text or a ground.


pointArray sElement::getPoints()

Returns: the vertices of a multi-point element such as a wire, a bus or a polygon.


point sElement::getPortPos(string portname)

Returns: the position of the port portname on a device. If the element is not a device or the name is unknown, point(-123456789, -123456789) is returned.


bool sElement::isGlobal()

Returns: true if this port is global, otherwise false.


bool sElement::isPortOrBusport()

Returns: true if the element is a port or a bus port.


bool sElement::isArc()

Returns: true if the element is an arc.


bool sElement::isBus()

Returns: true if the element is a bus.


bool sElement::isBusport()

Returns: true if the element is a bus port.


bool sElement::isCircle()

Returns: true if the element is a circle.


bool sElement::isDevice()

Returns: true if the element is a device placement.


bool sElement::isGround()

Returns: true if the element is a ground.


bool sElement::isPolyline()

Returns: true if the element is a polyline.


bool sElement::isPolygon()

Returns: true if the element is a polygon.


bool sElement::isPort()

Returns: true if the element is a port.


bool sElement::isRect()

Returns: true if the element is a rectangle.


bool sElement::isText()

Returns: true if the element is a text.


bool sElement::isWire()

Returns: true if the element is a wire.


bool sElement::isWireLabel()

Returns: true if the element is a wire label.


void sElement::setColor(int red,int green, int blue)

Sets the colour of a non-functional shape such as a polygon, a polyline or a circle. Functional elements (wires, devices, ports) take their colour from setup.

Parameter:
red red colour channel
green green colour channel
blue blue colour channel

void sElement::setGlobal(bool global)

Marks a port as global when global is true, or as a local port when false. (introduced with release 20260628)


void sElement::setParameter(string parameter, string value, bool triggerCallback=false)

Sets an existing parameter to value. Unlike addParameter, this method never creates a new name. If triggerCallback is true, the component callback runs after the change.

Parameter:
parameter name of an existing parameter
value new value
triggerCallback if true, run the component callback