Class Reference sheet

A sheet in the schematic. More...

Member

sElement* addArc(pointArray p,int red, int green, int blue)
sElement* addBus(pointArray p)
sElement* addBusport(point p,string text)
sElement* addCircle(point p1,QPoint p2,int red, int green, int blue)
sElement* addGround(point p)
sElement* addPlacement(string name,string lib, point pos, strans trans_)
sElement* addPlacement(component *, point pos, strans trans_)
sElement* addPort(point p,string text)
sElement* addPolyline(pointArray p,int red, int green, int blue)
sElement* addPolygon(pointArray p,int red, int green, int blue)
sElement* addRect(point p1,QPoint p2,int red, int green, int blue)
sElement* addText(point p,int red, int green, int blue, string textt)
sElement* addWire(pointArray p)
sElement* addWireLabel(point p)
void deleteElement( sElement* element)
bool existsDevicename(string name)
sElementList* firstElement
sElement * getDevice(string name)
component * getSheetComponent()
string getUnusedDevicename(string prefix)
string sheetName

Detailed Description

graph LR la(schematic)--drawing-->dr(schematicDisplay) dr--currentSheet-->ce(sheet) ce--firstElement-->el(sElementList) click ce "/layoutscript/api/sheet" click el "/layoutscript/api/selementlist" click la "/layoutscript/api/schematic" click dr "/layoutscript/api/schematicdisplay" classDef thisClas fill:#eaf5fc,stroke:#3c7faa,stroke-width:4px; classDef clas fill:#eaf5fc,stroke:#3c7faa,stroke-width:1px; class ce thisClas class la,el,dr clas

A sheet is one page of a schematic: the wires, devices, ports and drawing shapes you see in the Schematic Editor. You reach the page on screen as schematic->drawing->currentSheet. The shapes themselves live in firstElement, a linked sElementList; walk thisElement / nextElement to inspect them. New graphics and placements are created with the add… methods on this class, not on the window. Device names must be unique on the sheet; getUnusedDevicename builds a free name from a prefix such as R or M, and existsDevicename tests a name before you place anything. If this sheet was turned into a library device, getSheetComponent returns that component; otherwise it returns NULL.

Example:

sheet *s = schematic->drawing->currentSheet;
s->sheetName = "amplifier";

pointArray w;
w.attach(0, 0);
w.attach(200, 0);
sElement *wire = s->addWire(w);

string name = s->getUnusedDevicename("R");
strans t;
sElement *res = s->addPlacement("resistor", "analog", point(100, 50), t);
if (res != NULL)
 res->addParameter("devicename", name);

Member Function Documentation


sElement* sheet::addArc(pointArray p,int red, int green, int blue)

Adds an arc on this sheet. p holds the points that define the arc. red, green and blue are the colour channels from 0 to 255.

Parameter:
p points of the arc
red red colour channel
green green colour channel
blue blue colour channel

Returns: a pointer to the new sElement.


sElement* sheet::addBus(pointArray p)

Adds a bus along the vertices in p. A bus is a functional connection, not a drawing polyline.

Returns: a pointer to the new sElement.


sElement* sheet::addBusport(point p,string text)

Adds a bus port at p. text is the port name shown on the sheet.

Returns: a pointer to the new sElement.

Parameter:
p p
text text

sElement* sheet::addCircle(point p1,QPoint p2,int red, int green, int blue)

Adds a circle whose bounding box runs from p1 to p2. red, green and blue set the colour of this non-functional shape.

Parameter:
p1 first corner of the bounding box
p2 opposite corner of the bounding box
red red colour channel
green green colour channel
blue blue colour channel

Returns: a pointer to the new sElement.


sElement* sheet::addGround(point p)

Adds a ground symbol at p.

Returns: a pointer to the new sElement.


sElement* sheet::addPlacement(string name,string lib, point pos, strans trans_)

Places a library device on this sheet. name and lib select the component. pos is the origin. trans_ is the strans rotation, mirror and magnification.

Parameter:
name component name in the library
lib library name
pos origin of the placement
trans_ transformation of the placement

Returns: a pointer to the new device sElement.


sElement* sheet::addPlacement(component *, point pos, strans trans_)

Places the given component at pos with transformation trans_. Use this overload when you already hold a pointer from components findComponent or newComponent.

Parameter:
pos origin of the placement
trans_ transformation of the placement

Returns: a pointer to the new device sElement.


sElement* sheet::addPort(point p,string text)

Adds a port at p. text is the port name.

Returns: a pointer to the new sElement.

Parameter:
p p
text text

sElement* sheet::addPolyline(pointArray p,int red, int green, int blue)

Adds a drawing polyline along p. This is not a wire and does not create a net. red, green and blue set the colour.

Parameter:
p vertices of the polyline
red red colour channel
green green colour channel
blue blue colour channel

Returns: a pointer to the new sElement.


sElement* sheet::addPolygon(pointArray p,int red, int green, int blue)

Adds a drawing polygon with vertices p. red, green and blue set the colour.

Parameter:
p vertices of the polygon
red red colour channel
green green colour channel
blue blue colour channel

Returns: a pointer to the new sElement.


sElement* sheet::addRect(point p1,QPoint p2,int red, int green, int blue)

Adds a rectangle with opposite corners p1 and p2. red, green and blue set the colour of this non-functional shape.

Parameter:
p1 first corner
p2 opposite corner
red red colour channel
green green colour channel
blue blue colour channel

Returns: a pointer to the new sElement.


sElement* sheet::addText(point p,int red, int green, int blue, string textt)

Adds a text textt at p. red, green and blue set the colour.

Parameter:
p origin of the text
red red colour channel
green green colour channel
blue blue colour channel
textt the text string

Returns: a pointer to the new sElement.


sElement* sheet::addWire(pointArray p)

Adds a wire along the vertices in p. Wires create electrical connections; use addPolyline for a non-connecting line.

Returns: a pointer to the new sElement.


sElement* sheet::addWireLabel(point p)

Adds a wire label at p. The label names the net at that location.

Returns: a pointer to the new sElement.


void sheet::deleteElement( sElement* element)

Deletes element from this sheet. The pointer is then invalid.


bool sheet::existsDevicename(string name)

Returns: true if a device with name already exists on this sheet, otherwise false.


sElementList* sheet::firstElement

Head of the linked list of all elements on this sheet. See sElementList.


sElement * sheet::getDevice(string name)

Returns: a pointer to the device with name, or NULL if no device uses that name.


component * sheet::getSheetComponent()

Returns: a pointer to the component created from this sheet, or NULL if the sheet was not used as a component.


string sheet::getUnusedDevicename(string prefix)

Returns: a device name that is still free on this sheet, built from prefix plus a number.


string sheet::sheetName

The name of this sheet.