oaConstraintDef
模块: oapy._oa._base
导入: from oapy._oa import _base
概览
oaConstraintDef 在 oapy 中可用,可通过 _base 模块访问。
本页汇总 oaConstraintDef 当前在 oapy 中可用的 Python 接口。
详细说明
The oaConstraintDef object specifies a definition for a particular constraint。 The definition contains a name, a list of databases that the constraint can be created in, and a list of types of oaValues that are allowed for the constraint。 The names for constraint definitions must be unique。 oaConstraintDefs can be built-in or user defined。 Built-in oaConstraintDefs can be obtained with an enum, for example, using oaLayerConstraintDef::get() 。 User- defined oaConstraintDefs can be obtained by name using find() 。 The oaConstraintDef class can be observed by deriving from oaObserver
方法总览
| 状态 | Python 调用 |
|---|---|
| ✅ | obj.getName(name) |
| ✅ | obj.getValueTypes(allowedValues) |
| ✅ | obj.getObjectTypes(allowedObjects) |
| ✅ | obj.getDatabaseTypes(allowedDbs) |
| ✅ | obj.isBuiltIn() |
| ✅ | obj.destroy() |
| ✅ | obj.remove(database) |
| ✅ | _base.oaConstraintDef.find(name) |
方法说明
obj.getName(name)
绑定状态: 已绑定
Python 调用: obj.getName(name)
This function returns the name of this constraint definition。
参数
name: The returned name。
Python 示例
from oapy._oa import _base
# assume obj is a oaConstraintDef
obj.getName(name)
obj.getValueTypes(allowedValues)
绑定状态: 已绑定
Python 调用: obj.getValueTypes(allowedValues)
This function returns the allowed value types for a constraint specified with this definition。
参数
allowedValues: The returned value types。
Python 示例
from oapy._oa import _base
# assume obj is a oaConstraintDef
obj.getValueTypes(allowedValues)
obj.getObjectTypes(allowedObjects)
绑定状态: 已绑定
Python 调用: obj.getObjectTypes(allowedObjects)
This function returns the types of objects that a constraint specified with this definition can be attached to。
参数
allowedObjects: The objects allowed。
Python 示例
from oapy._oa import _base
# assume obj is a oaConstraintDef
obj.getObjectTypes(allowedObjects)
obj.getDatabaseTypes(allowedDbs)
绑定状态: 已绑定
Python 调用: obj.getDatabaseTypes(allowedDbs)
This function returns the types of databases that a constraint specified with this definition can be created in。
参数
allowedDbs: The databases allowed。
Python 示例
from oapy._oa import _base
# assume obj is a oaConstraintDef
obj.getDatabaseTypes(allowedDbs)
obj.isBuiltIn()
绑定状态: 已绑定
Python 调用: obj.isBuiltIn()
This function returns true if this constraint def is a built-in def。
Python 示例
from oapy._oa import _base
# assume obj is a oaConstraintDef
obj.isBuiltIn()
obj.destroy()
绑定状态: 已绑定
Python 调用: obj.destroy()
This function destroys this constraint definition。 If it is a built-in definition, or there are databases referencing this definition, an exception is thrown。 An exception is also thrown if this function is called when undo is enabled on any of the current in-memory design or tech databases。
异常
oacUnableToDestroyBuiltInType。oacConstraintDefHasReference。oacCannotDestroyDefUndo。
Python 示例
from oapy._oa import _base
# assume obj is a oaConstraintDef
obj.destroy()
obj.remove(database)
绑定状态: 已绑定
Python 调用: obj.remove(database)
This function removes this constraint definition from the specified database。 If there are constraints in the specified database that reference this definition, an error is thrown。
参数
database: The database to remove the constraint definition from。
Python 示例
from oapy._oa import _base
# assume obj is a oaConstraintDef
obj.remove(database)
_base.oaConstraintDef.find(name)
绑定状态: 已绑定
Python 调用: _base.oaConstraintDef.find(name)
This function returns the constraint definition with the specified name。 If no definition by that name is found, NULL is returned。
参数
name: The name of the constraintDef to search for。
Python 示例
from oapy._oa import _base
_base.oaConstraintDef.find(name)