Glade Reference


dbObj class

The dbObj class is the base class of Glade database objects (it is derived from a lower level memory allocation class which caches objects, but the user need not be concerned about that). A dbObj is never created directly. Most access to dbObjs is at the derived class level.

 

db_Type type = obj.objType()

Get the type of the object.

 

char * name = obj.objName()

Get the print name of the object, e.g. "POLYGON".

 

bool val = obj.isInst()

Returns True if the object is an inst or an array.

 

bool val = obj.isShape()

Returns True if the object is a shape.

 

bool val = obj.isViaInst()

Returns True if the object is a viaInst.

 

bool val = obj.isSeg()

Retuens True is the object is a segment of some shape.

 

bool val = obj.isVertex()

Returns True if the object is a vertex of some shape.

 

obj.dbAddProp(char *propName, char *propVal)

obj.dbAddProp(char *propName, int propVal)

obj.dbAddProp(char *propName, double propVal)

obj.dbAddProp(char *propName, bool propVal)

obj.dbAddProp(char *propName, db_Orient propVal)

Add a property to a dbObject of the given type. If the property given by propName already exists, its value is updated to propVal .

 

obj.dbReplaceProp(char *propName, char *propVal)

obj.dbReplaceProp(char *propName, int propVal)

obj.dbReplaceProp(char *propName, double propVal)

obj.dbReplaceProp(char *propName, bool propVal)

obj.dbReplaceProp(char *propName, db_Orient propVal)

Replace an existing property with one with a new value of a given type.

 

char * prop = obj.dbGetStringProp(char *name)

int prop = obj.dbGetIntProp(char *name)

double prop = obj.dbGetFloatProp(char *name)

int prop = obj.dbGetBoolProp(char *name)

db_Orient = obj.dbGetOrientProp(char *name)

Get a property of a specified type by name.

 

propType type = obj.dbFindPropType(char *name)

Finds the type of a named property. propType is an enum with names stringType, integerType, floatType, booleanType, orientType.

 

list = obj.getPropList()

Gets the object's property list as a Python list of prop objects. A prop object is a helper class with the following accessor methods:

char *name = prop.name()

Returns the name of the property.

prop.setName(char *name)

Sets the name of the property.

propType type = prop.type()

Returns the type of the property.

prop.setType(propType type)

Sets the type of the property.

union value = prop.data()

Returns the property value. value.s is the string data, value.i the integer data, value,f the float data, value.b the boolean data.

prop.setData(value)

Sets the property value. The function is overloaded for the common propType types.

 

int b = obj.dbDeleteProp(char *name)

Delete a property by name.

 

Casting a dbObj to a derived class

In Python, there is no means of casting a base class to a derived class. So for example if you use the cellView::dbGetOverlaps() function to get a list of objects, these are returned as dbObj class. So to facilitate conversion, there are a set of functions that convert a dbObj to a derived class e.g. rectangle.

arc a = d.toArc()

array a = d.toArray()

cell c = d.toCell()

cellView cv = d.toCellView()

ellipse e = d.toEllipse()

HSeg h = d.toHSeg()

inst i = d.toInst()

label l = d.toLabel()

line l = d.toLine()

path p = d.toPath()

polygon p = d.toPolygon()

rectangle r = d.toRectangle()

segment d = d.toSegment()

shape s = d.toShape()

view v =d.toView()

vertex v = d.toVertex()

viaInst v = d.toViaInst()

VSeg v = d.toVSeg()

 

Getting bounding box coords

Note that you can only get the bounding box coordinates of shapes, insts or viaInsts.

int x = r.left();

int y = r.bottom();

int x = r.right();

int y = r.top();

Gets the specified bounding box coordinate.

 

Contents|Index

Copyright © Peardrop Design 2020.