pwrwb
index
/data0/x7-0-0/rls/os_linux/hw_x86_64/exp/exe/pwrwb.so

ProviewR Workbench Python API
 
The workbench Python API contains a number of classes and functions
to get information about the objects in the ProviewR development database.
There are function to find objects and investigate their relationship
to other objects and to examine the structure and content of the objects.
There are also functions to build and execute commands.
 
The API contains the classes
 
Vid       volume in the development database.
Oid       object in the development database.
Aref      attribute in the development database.
Cid       class.
Tid       type.
ADef      attribute definition.
 
Type help(pwrwb.Oid), help(pwrwb.Aref) etc to get more information about
these classes.

 
Classes
       
builtins.object
ADef
Aref
Cid
Oid
Tid
Vid

 
class ADef(builtins.object)
    Proview attribute definition
 
  Methods defined here:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
cid()
Get the class identity for the attribute definition object.
 
Returns
-------
Returns the class identity as an integer value.
elements()
Get number of elements of the attribute.
 
Returns
-------
Returns the number of elements.
flags()
Get flags word of the attribute.
 
Returns
-------
Returns the flags as an integer value.
name()
Get the name of the attribute.
 
Returns
-------
Returns a string with the attribute name.
 
Example
-------
c = pwrwb.Cid('$PlantHier')
for adef in c.attributes():
  print adef.name()
'Description'
'DefGraph'
...
offset()
Get offset of the attribute.
 
Returns
-------
Returns an integer value with the offset.
size()
Get size of the attribute.
 
Returns
-------
Returns an integer value with the size.
typeref(...)
offset()
--
 
Get TypeRef of the attribute.
 
Returns
-------
Returns an integer value with the TypeRef.

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

 
class Aref(builtins.object)
    Proview development attribute
 
  Methods defined here:
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__gt__(self, value, /)
Return self>value.
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__le__(self, value, /)
Return self<=value.
__lt__(self, value, /)
Return self<value.
__ne__(self, value, /)
Return self!=value.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
arefStr()
Get attribute reference as a string.
 
Returns
-------
Returns a string with the attribute reference.
 
Example
-------
o = pwrwb.attribute('H1-Dv1.ActualValue')
print a.arefStr()
'_A0.1.200.3:334(_T0.2:0.111.1)[88.4]'
fullName()
Get the full name of the attribute.
Returns the full attribute name, including volume and path.
 
Returns
-------
Returns a string with the full attribute name.
 
Example
-------
a = pwrwb.attribute('H1-H2-Dv1.ActualValue')
print a.fullName()
name()
Get the name of the attribute.
Returns the last segment of the object and attribute name, without
 the path.
 
Returns
-------
Returns a string with the attribute name.
 
Example
-------
a = pwrwb.attribute('H1-H2-Dv1.ActualValue')
print a.name()
setValue(value, publicwrite)
Set the value of an attribute.
Set is only permitted if a user with RtWrite or System privileges
is logged in, or if the attribute is an attribute with public write
permissions. In this case the public write argument should be set to 1.
 
Arguments
---------
value         Arbitrary type
  The value types for different attributes types should be
  pwr_tEnum      Integer.
  pwr_tMask      Integer.
  pwr_tStatus    Integer.
  pwr_tObjid     OidObject.
  pwr_tAttrRef   ArefObject.
  pwr_tTime      A string with format '17-JAN-2019 10:51:10.58'. Can be
                 converted from a datetime with format
                 '%d-%b-%Y %H:%M:%S.%f'.
 
publicwrite   Optional Integer
  1 if value is set to an attribute with public write permissions.
 
Example
-------
pwrwb.login('pwrp', 'somepassword')
a = pwrwb.attribute('H1-H2-Dv1.ActualValue')
a.setValue(1)
tid()
Get attribute type.
 
Returns
-------
Returns a Tid object for the type.
 
Example
-------
a = pwrwb.attribute('H1-Dv1.ActualValue')
t = o.tid()
print t.fullName()
value()
Get the value of an attribute.
 
Returns
-------
Returns the value of the attribute.
Return types for different attributes types are
pwr_tEnum      Integer.
pwr_tMask      Integer.
pwr_tStatus    Integer.
pwr_tObjid     OidObject.
pwr_tAttrRef   ArefObject.
pwr_tTime      A string with format '17-JAN-2019 10:51:10.58'. Can be
               converted from a datetime with format
               '%d-%b-%Y %H:%M:%S.%f'.
 
Example
-------
a = pwrwb.object('H1-Dv1.ActualValue')
print a.value()

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Data and other attributes defined here:
__hash__ = None

 
class Cid(builtins.object)
    Class of a development object
 
  Methods defined here:
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__gt__(self, value, /)
Return self>value.
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__le__(self, value, /)
Return self<=value.
__lt__(self, value, /)
Return self<value.
__ne__(self, value, /)
Return self!=value.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
attrObject()
Get the first instance of the class, including attribute objects.
 
Returns
-------
Returns an Aref object for the first instance of the class.
 
Example
-------
cid = pwrwb.Cid('Di')
a = cid.attrObject()
while a:
  print a.fullName()
  a = cid.nextAttrObject(a)
attrObjects()
Get all instances of the class, including attribute objects.
 
Returns
-------
Returns tuple of Aref object for all instance of the class.
 
Example
-------
cid = pwrwb.Cid('Di')
for a in cid.attrObjects():
  print a.fullName()
attributes()
Get all attributes defined in the class.
 
Returns
-------
Returns tuple of ADef objects for all the defined attributes in
the class.
 
Example
-------
cid = pwrwb.Cid('$PlantHier')
for adef in cid.attributes():
  print adef.name(), adef.offset(), adef.size()
fullName()
Get the full name of the class object.
 
Returns
-------
Returns a string with the class name.
 
Example
-------
c = pwrwb.Cid('$PlantHier')
print c.fullName()
'pwrs:Class-$PlantHier'
name()
Get the name of the class.
 
Returns
-------
Returns a string with the class name.
 
Example
-------
c = pwrwb.Cid('$PlantHier')
print c.name()
'$PlantHier'
nextAttrObject(attribute)
Get the next instance of the class, including attribute objects.
 
Arguments
---------
attribute  Aref object
  An Aref object for the previous instance.
 
Returns
-------
Returns an Aref object for the next instance of the class.
 
Example
-------
cid = pwrwb.Cid('Di')
a = cid.attrObject()
while a:
  print a.fullName()
  a = cid.nextAttrObject(a)
nextObject(object)
Get the next instance of the class.
 
Arguments
---------
object  Oid object
  An Oid object for the previous instance.
 
Returns
-------
Returns an Oid object for the next instance of the class.
 
Example
-------
cid = pwrwb.Cid('$PlantHier')
o = cid.object()
while o:
  print o.fullName()
  o = cid.nextObject(o)
object()
Get the first instance of the class.
The object() method only gets whole objects and doesn't include
attribute objects (see attrObject()).
 
Returns
-------
Returns an Oid object for the first instance of the class.
 
Example
-------
cid = pwrwb.Cid('$PlantHier')
o = cid.object()
while o:
  print o.fullName()
  o = cid.nextObject(o)
objects()
Get all instances of the class.
 
Returns
-------
Returns tuple of Oid object for all instance of the class.
 
Example
-------
cid = pwrwb.Cid('$PlantHier')
for o in cid.objects():
  print o.fullName()

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Data and other attributes defined here:
__hash__ = None

 
class Oid(builtins.object)
    ProviewR development object
 
The Oid object represents a ProviewR object.
 
  Methods defined here:
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__gt__(self, value, /)
Return self>value.
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__le__(self, value, /)
Return self<=value.
__lt__(self, value, /)
Return self<value.
__ne__(self, value, /)
Return self!=value.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
attribute(attributeName)
Get an attribute within the object.
 
Arguments
---------
attributeName String
  Name of attribute.
 
Returns
-------
Returns an Aref object for the attribute.
 
Example
-------
o = pwrwb.object('H1-Dv1')
a = o.attribute('ActualValue')
print a.value()
child()
Get first child of the object.
 
Returns
-------
Returns an Oid object for the first child.
 
Example
-------
o = pwrwb.object('H1-H2')
child = o.child()
while child:
  print child.name()
  child = child.next()
children()
Get all children of the object.
 
Returns
-------
Returns a tuple containg Oid objects for all children of the object.
 
Example
-------
o = pwrwb.object('H1-H2')
for child in o.children()
  print child.name()
cid()
Get object class.
 
Returns
-------
Returns a Cid object for the class.
 
Example
-------
o = pwrwb.object('H1-Dv1')
c = o.cid()
print c.fullName()
fullName()
Get the full name of the object.
Returns the full object name, including volume and path.
 
Returns
-------
Returns a string with the full object name.
 
Example
-------
o = pwrwb.object('H1-H2')
print o.fullName()
name()
Get the name of the object.
Returns the last segment of the object name, without the path.
 
Returns
-------
Returns a string with the object name.
 
Example
-------
o = pwrwb.object('H1-H2')
print o.name()
next()
Get the next sibling of the object.
 
Returns
-------
Returns an Oid object for the sibling. If no next sibling exist, a
None object is returned.
 
Example
-------
o = pwrwb.object('H1-H2')
child = o.child()
while (child):
  print child.name()
  child = child.next()
oidStr()
Get object identity as a string.
 
Arguments
---------
format Optional String
  If not supplied oix is in decimal form.
  'hex' oix in hexadecimal.
  'file' for hex file format.
 
Returns
-------
Returns a string with the object identity.
 
Example
-------
o = pwrwb.object('H1-Dv1')
print o.oidStr()
'_O0.1.200.3:334'
parent()
Get the parent of the object.
 
Returns
-------
Returns an Oid object for the parent.
 
Example
-------
o = pwrwb.object('H1-H2')
parent = o.parent()
print parent.name()

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Data and other attributes defined here:
__hash__ = None

 
class Tid(builtins.object)
    Attribute type
 
  Methods defined here:
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__gt__(self, value, /)
Return self>value.
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__le__(self, value, /)
Return self<=value.
__lt__(self, value, /)
Return self<value.
__ne__(self, value, /)
Return self!=value.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
fullName()
Get the full name of the type object.
 
Returns
-------
Returns a string with the full type name.
 
Example
-------
a = pwrwb.attribute('H1-H2-Dv1.ActualValue')
tid = a.tid()
print tid.fullName()
'pwrs:Type-$Boolean'
name()
Get the name of the type.
 
Returns
-------
Returns a string with the type name.
 
Example
-------
a = pwrwb.attribute('H1-H2-Dv1.ActualValue')
tid = a.tid()
print tid.name()
'$Boolean'

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Data and other attributes defined here:
__hash__ = None

 
class Vid(builtins.object)
    ProviewR development volume
 
The Vid object represents a ProviewR volume.
 
  Methods defined here:
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__gt__(self, value, /)
Return self>value.
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__le__(self, value, /)
Return self<=value.
__lt__(self, value, /)
Return self<value.
__ne__(self, value, /)
Return self!=value.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
cid()
Get volume class.
 
Returns
-------
Returns a Cid object for the class.
 
Example
-------
v = pwrwb.volume('VolDemo')
c = v.cid()
print c.fullName()
fullName()
Same as name().
name()
Get the name of the volume.
Returns volume name.
 
Returns
-------
Returns a string with the volume name.
 
Example
-------
v = pwrwb.volume('VolDemo')
print v.name()
next()
Get the next volume.
 
Returns
-------
Returns an vid object for the volume. If no next volume exist, a
None object is returned.
 
Example
-------
v = pwrwb.volume('VolDemo')
while (v):
  print v.name()
  v = v.next()
root()
Get first root object of the volume.
 
Returns
-------
Returns an Oid object for the root object.
 
Example
-------
v = pwrwb.object('VolDemo')
o = v.child()
while o:
  print o.name()
  o = o.next()
roots()
Get all root objects of the volume.
 
Returns
-------
Returns a tuple containg Oid objects for all root objects of the volume.
 
Example
-------
v = pwrwb.volume('VolDemo')
for o in v.children()
  print o.name()
vidStr(...)
vid()
--
 
Get volume identity as a string.
 
Returns
-------
Returns a string with the volume identity.
 
Example
-------
v = pwrwb.volume('VolDemo')
print v.vidStr()
'_V0.1.200.3'

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Data and other attributes defined here:
__hash__ = None

 
Functions
       
attribute(attributeName)
Get an attribute.
 
Arguments
---------
attributeName String
  Name of the attribute.
 
Returns
-------
Returns an Aref object for the attribute.
 
Example
-------
a = pwrwb.attribute('H1-H2-Dv1.ActualValue')
print a.fullName()
'VolDemo:H1-H2-Dv1.ActualValue'
build(nodename)
Build a node.
 
Arguments
---------
nodename String
  Name of the node to build.
 
Example
-------
pwrwb.build('pwrdemo')
close()
Close session and database.
 
Example
-------
pwrwb.close()
closeSession()
Close the current session.
 
Example
-------
pwrwb.closeSession()
closeWb()
Close database.
 
Example
-------
pwrwb.closeWb()
command(cmd)
Execute a wb command.
 
Arguments
---------
cmd String
  Command to execute.
 
Example
-------
pwrwb.command('compile /all')
getPriv()
Returns the current privileges
 
Returns
-------
Returns an integer with the current privileges.
 
Example
-------
priv = pwrwb.getPriv()
getSessionVolume()
Get the volume of the current session.
 
Returns
-------
Returns a Vid object for the volume.
 
Example
-------
v = pwrwb.getSessionVolume()
print v
'VolDemo'
getUser()
Returns the current user
 
Returns
-------
Returns a string with the user.
 
Example
-------
user = pwrwb.getUser()
login(username, password)
Login as a ProviewR user. This is usually done to gain write access
to attributes in the database. The privileges RtWrite or System is
required for write access.
 
Arguments
---------
username
  Name of a user defined in the ProviewR user database.
 
password
  Password for the user.
 
Example
-------
pwrwb.login('pwrp', 'mypassword')
logout()
Logout from the previously logged in user.
The privileges will return to RtRead.
 
Example
-------
pwrwb.logout()
object(objectName)
Get an object.
 
Arguments
---------
objectName Optional String
  Name of the object. If not supplied the first root object is returned.
 
Returns
-------
Returns an Oid object for the object.
 
Example
-------
o = pwrwb.object('Demo-Ge-Dynamics')
print o.fullName()
'VolDemo:Demo-Ge-Dynamics'
open(database)
Open database and open session to root volume in the database.
If no database argument is supplied, the directory volume is opened.
 
Arguments
---------
database Optional String
  Name of the database. If not supplied the directory volume is opened.
 
Example
-------
pwrwb.open('VolDemo')
openSession(volume, access)
Open session.
If no database argument is supplied, the directory volume is opened.
 
Arguments
---------
volume VidObject
  A VidObject for the volume to open a session to.
access Optional String
  'w' for write and 'r' for read access. Default read access.
 
Example
-------
v = pwrwb.volume('VolDemo')
pwrwb.openSession(v, 'w')
openWb(database)
Open database.
If no database argument is supplied, the directory volume is opened.
 
Arguments
---------
database Optional String
  Name of the database. If not supplied the directory volume is opened.
 
Example
-------
pwrwb.openWb('VolDemo')
revertSession()
Revert the current session.
 
Example
-------
pwrwb.revertSession()
saveSession()
Save the current session.
 
Example
-------
pwrwb.saveSession()
sessionIsEmpty()
Returns 1 if no modifications is done in this session since last save,
else 0.
 
Returns
-------
Returns 1 if session is empty, else 0.
version()
Get version
 
Returns
-------
The current ProviewR version.
 
Example
-------
version = pwrwb.version()
print version
'V5.6.0'
volume(volumeName)
Get volume
 
Arguments
---------
volumeName Optional String
  Name of the volume. If not supplied the first volume is returned.
 
Returns
-------
Returns an Vid object for the volume object.
 
Example
-------
vol = pwrwb.volume('VolPwrDemo')
for o in vol.roots():
  print o.fullName()
volumes()
Get all volumes loaded into the database.
 
Returns
-------
Returns a tuple with Vid objects for all the volumes.
 
Example
-------
for v in pwrwb.volumes():
  print v.name()