pw:: DatabaseEntity

Base type for all database entities

Derives From

pw::Object pw::Entity

Summary
Base type for all database entities
This action returns a list of db entities adjacent to the given entities.
This action gets a database entity using the name.
This action gets a database entity using the sequence number.
This action deletes this entity.
This action transforms this entity by the given matrix.
This action gets the closest point on this entity to the given point or ray.
This action checks if this entity is defined.
This action checks if this entity is parametric.
This action checks if this entity is curve-like.
This action checks if this entity is surface-like.
This action checks if this entity can be projected onto using a project command.
This action checks if connectors can be built on the entity using the pw::Connector.createOnDatabase command.
This action checks if domains can be built on the entity using the pw::DomainStructured.createOnDatabase command.
This action checks if domains can be built on the entity using the pw::DomainUnstructured.createOnDatabase command.
This action gets the description of how this entity was defined.
This action gets the number of parts of the entity of a given type.
This action gets a string representing a part of the entity that can be used to reference the part in other actions.
This action gets a list of string names for the available attribute dictionaries attached to this entity.
This action gets a dictionary of key-value pairs of attributes that have been attached to this entity with the given dictionary name.
This action attaches a dictionary of key-value pairs to this entity with the given dictionary name.
This action gets the type and value of an entity attribute.
This action gets the entity’s available attribute names.
This action gets the entities that this entity requires.
This action gets the entities that require this entity to exist.
This action gets the entities that reference this entity, but not necessarily depend on it to support.
This action gets the grid entities that this entity supports.

Static Actions

getAdjacentEntities

pw::DatabaseEntity getAdjacentEntities ?-tolerance tol? ?-maximumAngle angle? ?-all? ents

This action returns a list of db entities adjacent to the given entities.

Parameters

-tolerance tolThis optional parameter is the float tolerance used to find adjacent entities.  The default is fit tolerance.
-maximumAngle angleThis parameter is the float maximum bend angle for considering entities as adjacent with the range [0, 180].  The default is 180.
-allThis optional flag is the notification to continue looking for adjacent entities as new ones are added.
entslist of pw::DatabaseEntity objects to be used as the seed

Returns

This action returns a list of adjacent pw::DatabaseEntity objects.

Information

If the -all flag is specified, the process is repeated until no more adjacent entities are found.

The return list will not include any entities specified in the argument list.

Database entities are only considered adjacent for certain types;

Example

This example shows how to get quilts adjacent to a given quilt in order to assemble them.  The -all option is used to continue finding adjacent quilts to the ones already added.  The original quilt must then be added to the list before assembly.

Code

set quilt(1) [pw::Database getByName "quilt-1"]
set adjQuilts \
[pw::DatabaseEntity getAdjacentEntities -all $quilt(1)]
lappend adjQuilts $quilt(1)
foreach db $adjQuilts {
puts [$db getName]
}
pw::Quilt assemble $adjQuilts

Output

quilt-2
quilt-3
quilt-4
quilt-1

See Also

pw::Quilt

getByName

pw::DatabaseEntity getByName ?-path path? name

This action gets a database entity using the name.

Parameters

nameThis parameter is a name string.

Returns

This action returns a pw::DatabaseEntity object.  -path path - This parameter and its argument specify the path to the framework in which the database entity resides.  The path argument must be a list of either pw::Framework objects or framework names.  The path must start at the root framework, start at the active framework, or start at a child of the active framework.  The active framework is used as the default if this parameter is not specified.

Example

This example shows how to get a database entity named model-1 in order to find out how many quilts are in that model.

Code

set mdl(1) [pw::DatabaseEntity getByName "model-1"]
puts "[$mdl(1) getName] has [$mdl(1) getQuiltCount] quilts."

Output

model-1 has 188 quilts.

See Also

pw::Model

getBySequence

pw::DatabaseEntity getBySequence number

This action gets a database entity using the sequence number.

Parameters

numberThis parameter is the integer sequence number with the range [1, entity count].

Returns

This action returns a pw::DatabaseEntity object.

Notes

This function is extremely inefficient for querying the entire database system.  It is much more efficient to call pw::Database.getAll and simply index into the returned list.

Example

Code

set db [pw::DatabaseEntity getBySequence 11]
puts "[$db getName] is of the type [$db getType]."

Output

BSurf-425 is of the type pw::Surface.

Instance Actions

delete

$entity delete ?-force? ?-dependents?

This action deletes this entity.

Parameters

-forceThis optional flag is the notification that the entity will be deleted, even if grid entities reference it.
-dependentsThis optional flag is the notification that the entity will be deleted along with any dependent database entities.

Returns

This action returns nothing.

Example

This example shows how to delete $mdl(1), which is referencing an existing model.  The -dependents parameter causes all quilts and other hidden database entities that depend on the model to be deleted also.

Code

$mdl(1) delete -dependents

transform

$entity transform matrix

This action transforms this entity by the given matrix.  The matrix is a list of 16 values, but in practice, the utility functions for transform matrices are generally used instead.

Parameters

matrixThis parameter is the 4x4 transform matrix.

Returns

This action returns nothing.

Example

This example shows how to scale database entities using a transform utility command that sets an anchor point from the uv vector “0 0” on $crv(1) and a scaling vector of “5 5 0” to form the matrix.  $crv(1) is referencing an existing database curve.

Code

$crv(1) transform [pwu::Transform scaling -anchor \
[pw::Application getXYZ [list 0 0 $crv(1)]] {5 5 0}]

See Also

pwu::Transform

closestPoint

$entity closestPoint ?-from fromVar? ?-distance distVar? point ?dir?

This action gets the closest point on this entity to the given point or ray.

Parameters

-from fromVarThis optional parameter is the string name of a variable to receive the xyz of the given point or the point along the ray that is closest to this entity.
-distance distVarThis optional parameter is the string name of a variable to receive the float distance between the given point or ray and the point entity.
pointThis parameter is the point that is projected onto this database entity.
dirThis parameter is a direction vector for finding the closest point from a ray.

Returns

This action returns a point, in the parameter space of this database entity, if there is no closest point this action will return the origin.

Example

This example finds the closest point in parameter space on $mdl(1) from the given point “0 0 10”.  The -distance parameter is used to find the distance between the points.  $mdl(1) is referencing an existing model.

Code

set pt [$mdl(1) closestPoint -distance dist [list 0 0 10]]
puts [pw::Application getDescription $pt]
puts "The UV point is $dist units from the given point."

Output

quilt-1 (0.00596421,0)
The UV point is 16.379883785930257 units from the given point.

isDefined

$entity isDefined

This action checks if this entity is defined.

Parameters

This action has no parameters.

Returns

This action returns a boolean, true if the entity is defined.

Example

This example checks to see if $mdl(1) is defined.  $mdl(1) is referencing an existing model.

Code

puts [$mdl(1) isDefined]

Output

1

isParametric

$entity isParametric

This action checks if this entity is parametric.

Parameters

This action has no parameters.

Returns

This action returns a boolean, true if the entity is parametric.

Example

This example checks to see if $mdl(1) is parametric.  $mdl(1) is referencing an existing model.

Code

puts [$mdl(1) isParametric]

Output

0

isCurve

$entity isCurve

This action checks if this entity is curve-like.

Parameters

THis action has no parameters.

Returns

This action returns a boolean, true if the entity is a curve.

Example

This example checks to see if $crv(1) is curve-like.  $crv(1) is referencing an existing database curve.

Code

puts [$crv(1) isCurve]

Output

1

isSurface

$entity isSurface

This action checks if this entity is surface-like.

Parameters

This action has no parameters.

Returns

This action returns a boolean, true if the entity is a surface.

Example

This example checks to see if $crv(1) is surface-like.  $crv(1) is referencing an existing database curve.

Code

puts [$crv(1) isSurface]

Output

0

isBaseForProject

$entity isBaseForProject

This action checks if this entity can be projected onto using a project command.

Parameters

This action has no parameters.

Returns

This action returns a boolean, true if the entity is a target for projection.

Example

This example checks to see if $mdl(1) can be projected onto.  $mdl(1) is referencing an existing model.

Code

puts [$mdl(1) isBaseForProject]

Output

0

See Also

pw::Entity.project pw::GridEntity.project pw::Curve.project pw::Connector.project <pw::Domain.project>

isBaseForConnector

$entity isBaseForConnector

This action checks if connectors can be built on the entity using the pw::Connector.createOnDatabase command.

Parameters

This action has no parameters.

Returns

This action returns a boolean, true if the entity is a base for connectors.

Example

This example checks to see if $qlt(1) can have connectors built on it.  $qlt(1) is referencing an existing quilt.

Code

puts [$qlt(1) isBaseForConnector]

Output

1

isBaseForDomainStructured

$entity isBaseForDomainStructured

This action checks if domains can be built on the entity using the pw::DomainStructured.createOnDatabase command.

Parameters

This action has no parameters.

Returns

This action returns a boolean, true if the entity is a base for strcutured domains.

Example

This example checks to see if $qlt(1) can have structured domains built on it.  $qlt(1) is referencing an existing quilt.

Code

puts [$qlt(1) isBaseForDomainStructured]

Output

1

isBaseForDomainUnstructured

$entity isBaseForDomainUnstructured

This action checks if domains can be built on the entity using the pw::DomainUnstructured.createOnDatabase command.

Parameters

This action has no parameters.

Returns

This action returns a boolean, true if the entity is a base for unstrcutured domains.

Example

This example checks to see if $qlt(1) can have unstructured domains built on it.  $qlt(1) is referencing an existing quilt.

Code

puts [$qlt(1) isBaseForDomainUnstructured]

Output

1

getDescription

$entity getDescription

This action gets the description of how this entity was defined.

Parameters

This action has no parameters.

Returns

This action returns a string description.

Information

All possible string returns: AkimaSpline, AveragePoint, BezierSpline, BSplineCurve, BSplineSurface, Boundary, BoundedSurface, CatmullRomSpline, Circle, CompositeCurve, CompositeSurface, ConeSurface, ConicCurve, CoonsSurface, Copious, CurveOnSurface, CylinderSurface, Edge, Face, FilletSurface, Group, IntersectionCurve, IntersectionPoint, Line, LinearSpline, LinearSweep, Loop, Model, Note, OffsetCurve, OffsetSurface, OpenModel, ParametricCurve, ParametricSurface, Plane, PlaneSurface, Point, ProjectedCurve, Quilt, RuledSurface, Shell, SolidModel, SphereSurface, SubfigureDefinition, SubfigureInstance, Revolution, TabulatedCylinder, ToroidalSurface, TrimmedCurve, TrimmedSurface, Unknown, Vertex.

Example

This example shows how to get the description for $crv(1).  $crv(1) is referencing an existing database curve.

Code

puts [$crv(1) getDescription]

Output

LinearSpline

getPartCount

$entity getPartCount part_type

This action gets the number of parts of the entity of a given type.

Parameters

part_typeThis parameter is the string type of the part to get.  Valid values are < Region | Shell | Sheet | Face | Loop | Coedge | String | Edge | Vertex >.

Returns

This action returns the integer number of parts of the entity

Information

Some database entities are constructed from several internal parts which may need to be addressed by different actions, but the parts themselves are considered entities.  This action is used in combination with getPart to build a string that can be used to reference these internal parts.

getPart

$entity getPart part_type < index | point | boundary >

This action gets a string representing a part of the entity that can be used to reference the part in other actions.

Parameters

part_typeThis parameter is the string type of the part to get.  Valid values are < Region | Shell | Sheet | Face | Loop | Coedge | String | Edge | Vertex >.
indexThis parameter is the integer index of the part to get with range [1, count of part type].
pointThis parameter is a point that is constrained to or geometrically near the part to get.
boundaryThis parameter is a boundary that is constrained to the part to get.

Information

Some database entities are constructed from several internal parts which may need to be addressed by different actions, but the parts themselves are considered entities.  This action is used in combination with getPartCount to build a string that can be used to reference these internal parts.

Returns

This action returns a string representing the part for use by other acitions.

getAttributeDictionaryNames

$entity getAttributeDictionaryNames ?-part part? ?-children?

This action gets a list of string names for the available attribute dictionaries attached to this entity.

Parameters

-part partThis optional flag is the string part name within the entity to look for dictionaries.  Only strings returned by getPart should be used for this parameter.
-childrenThis optional flag is the notification to include names of attribute dictionaries attached to children of this entity as well.

Returns

This action returns a list of strings.

getAttributeDictionary

$entity getAttributeDictionary ?-part part? ?-children? dict_name ?attr_names?

This action gets a dictionary of key-value pairs of attributes that have been attached to this entity with the given dictionary name.

Parameters

-part partThis optional flag is the string part name within the entity to look for dictionaries.  Only strings returned by getPart should be used for this parameter.
-childrenThis optional flag is the notification to include the attribute dictionary attached to children of this entity as well.
dict_nameThis parameter is the string name of the dictionary.
attr_namesThis optional parameter is a string name or a list of string names to limit the attributes which should be returned by this action.  If not specified, all existing attributes will be returned by this action.

Returns

This action returns a list of strings that can be converted into a tcl dictionary (list of alternating keys and values).

Information

When using the -children flag, the dictionary will be a combination of values from multiple dictionaries from different entities, but only the first value found while traversing the children is retained.

setAttributeDictionary

$entity setAttributeDictionary ?-part part? dict_name ?dict?

This action attaches a dictionary of key-value pairs to this entity with the given dictionary name.

Parameters

-part partThis optional flag is the string part name within the entity to attach the dictionary.  Only strings returned by getPart should be used for this parameter.
dict_nameThis parameter is the string name of the dictionary.
dictThis optional parameter is a list of string values of alternating key-value pairs.  If the parameter is not given, the dictionary will be cleared from the entity.

Returns

This action returns nothing.

getImportedAttribute

$entity getImportedAttribute attribute_name

This action gets the type and value of an entity attribute.

Parameters

attribute_nameThis parameter is the attribute name string.

Returns

This action returns the list {type value}.  The type can be one of Int, String, or Real.

Example

This example shows how to get a named attribute from the existing database entity $db.

Code

set attrName "OUTLET"
if { ![catch {$db getImportedAttribute $attrName} result] } {
lassign $result attrType attrVal
puts "$attrType $attrName = '$attrVal'"
} else {
puts "Attribute not found."
}

Output

"String OUTLET = 'PRESSURE'"

getImportedAttributeNames

$entity getImportedAttributeNames ?-regex? ?pattern?

This action gets the entity’s available attribute names.

Parameters

-regexThis optional flag signifies that the given pattern should be considered a regular expression pattern rather than a glob pattern.
patternThis optional parameter is the string pattern used to filter the returned attribute names.  If a pattern is not given, all attribute names are returned.

Returns

A string list of the attribute names.

Example

This example shows how to get attribute names from the existing database entity $db.

Code

# get all attribute names
puts "all : [$db getImportedAttributeNames]"

# get attribute names matching glob pattern
puts "glob : [$db getImportedAttributeNames "EX.*"]"

# get attribute names matching the regex pattern "EX.Word.postfix"
# where "Word" must start with a capital letter.
puts "regex: [$db getImportedAttributeNames -regex {EX\.[A-Z]{1}\w+\..+}]"

Output

all  : Attrib1 Attrib2 EX.Mach EX.Node.attr1 EX.Con9.attr EX.1234.attr
glob : EX.Mach EX.Node.attr1 EX.Con9.attr EX.1234.attr
regex: EX.Node.attr1 EX.Con9.attr

getSupportEntities

$entity getSupportEntities

This action gets the entities that this entity requires.

Parameters

This action has no parameters.

Returns

This action returns a list of pw::DatabaseEntity objects.

Example

This example shows how to get the support entities for $qlt(1).  $qlt(1) is referencing an existing quilt.

Code

foreach ent [$qlt(1) getSupportEntities] {
puts [$ent getName]
}

Output

TrimSurf-39

getDependentEntities

$entity getDependentEntities

This action gets the entities that require this entity to exist.  Effectively, this returns the list of entities that would be deleted if this entity is deleted.  It is not necessarily the complete set of entities defined in the parameter space if this entity.  Use getReferencingEntities to get all supported entities.

Parameters

This action has no parameters.

Returns

This action returns a list of pw::DatabaseEntity objects.

Example

This example shows how to get the dependent entities for $qlt(1).  $qlt(1) is referencing an existing quilt.

Code

foreach ent [$qlt(1) getDependentEntities] {
puts [$ent getName]
}

Output

TrimSurf-39
model-1

getReferencingEntities

$entity getReferencingEntities

This action gets the entities that reference this entity, but not necessarily depend on it to support.

Parameters

This action has no parameters.

Returns

This action returns a list of pw::DatabaseEntity objects.

Example

This example shows how to get the referencing entities for $curve.  $curve is referencing an existing intersection curve.

Code

foreach ent [$curve getReferencingEntities] {
puts [$ent getName]
}

Output

surface-1
plane-1

getGridEntities

$entity getGridEntities

This action gets the grid entities that this entity supports.

Parameters

This action has no parameters.

Returns

This action returns a list of pw::GridEntity objects.

Example

This example shows how to get the grid entities for $qlt(1).  $qlt(1) is referencing an existing quilt.

Code

foreach ent [$qlt(1) getGridEntities] {
puts [$ent getName]
}

Output

dom-2
pw::DatabaseEntity getAdjacentEntities ?-tolerance tol? ?-maximumAngle angle? ?-all? ents
This action returns a list of db entities adjacent to the given entities.
pw::DatabaseEntity getByName ?-path path? name
This action gets a database entity using the name.
pw::DatabaseEntity getBySequence number
This action gets a database entity using the sequence number.
$entity delete ?-force? ?-dependents?
This action deletes this entity.
$entity transform matrix
This action transforms this entity by the given matrix.
$entity closestPoint ?-from fromVar? ?-distance distVar? point ?dir?
This action gets the closest point on this entity to the given point or ray.
$entity isDefined
This action checks if this entity is defined.
$entity isParametric
This action checks if this entity is parametric.
$entity isCurve
This action checks if this entity is curve-like.
$entity isSurface
This action checks if this entity is surface-like.
$entity isBaseForProject
This action checks if this entity can be projected onto using a project command.
$entity isBaseForConnector
This action checks if connectors can be built on the entity using the pw::Connector.createOnDatabase command.
pw::Connector createOnDatabase ?-merge tolerance? ?-splitConnectors split_angle? ?-joinConnectors join_angle? ?-parametricConnectors mode? ?-reject rejectVar? ?-type type? entity_or_boundary_list
This action creates new connector objects on the given database entities.
$entity isBaseForDomainStructured
This action checks if domains can be built on the entity using the pw::DomainStructured.createOnDatabase command.
pw::DomainStructured createOnDatabase ?-merge tolerance? ?-splitConnectors split_angle? ?-joinConnectors join_angle? ?-parametricConnectors mode? ?-reject rejectVar? entities
This action creates new structured domain objects on the given database entities.
$entity isBaseForDomainUnstructured
This action checks if domains can be built on the entity using the pw::DomainUnstructured.createOnDatabase command.
pw::DomainUnstructured createOnDatabase ?-merge tolerance? ?-splitConnectors split_angle? ?-joinConnectors join_con_angle? ?-joinDomains join_dom_angle? ?-parametricConnectors mode? ?-reject rejectVar? entities
This creates new unstructured domain objects on the given database entities.
$entity getDescription
This action gets the description of how this entity was defined.
$entity getPartCount part_type
This action gets the number of parts of the entity of a given type.
$entity getPart part_type < index | point | boundary >
This action gets a string representing a part of the entity that can be used to reference the part in other actions.
A string is an array of characters.
$entity getAttributeDictionaryNames ?-part part? ?-children?
This action gets a list of string names for the available attribute dictionaries attached to this entity.
$entity getAttributeDictionary ?-part part? ?-children? dict_name ?attr_names?
This action gets a dictionary of key-value pairs of attributes that have been attached to this entity with the given dictionary name.
$entity setAttributeDictionary ?-part part? dict_name ?dict?
This action attaches a dictionary of key-value pairs to this entity with the given dictionary name.
$entity getImportedAttribute attribute_name
This action gets the type and value of an entity attribute.
$entity getImportedAttributeNames ?-regex? ?pattern?
This action gets the entity’s available attribute names.
$entity getSupportEntities
This action gets the entities that this entity requires.
$entity getDependentEntities
This action gets the entities that require this entity to exist.
$entity getReferencingEntities
This action gets the entities that reference this entity, but not necessarily depend on it to support.
$entity getGridEntities
This action gets the grid entities that this entity supports.
Base type for all glyph types
Entity type
A float is a fractional number.
Base type for all database entities
Database curve type
Database surface type
Database model type
Database quilt type
Database trim surface type
Database shell type
Framework type
An integer is a whole number.
pw::Database getAll ?-framework framework? ?-type type_string?
This action gets a list of all database entities.
Utility functions for transform matrices, which are represented as a list of sixteen real values.
A point is a position either in model space or database parameter space.
A boolean is represented as a 0 or 1, with 0 being false and 1 being true.
pw::Entity project ?-type proj_type? ?-direction direction? ?-center center? ?-axis point normal? ?<-interior | -shape>? entities ?dbentities?
This action projects the given entities onto database entities.
pw::GridEntity project ?-type proj_type? ?-direction direction? ?-center center? ?-axis point normal? ?<-interior | -shape>? entities ?dbentities?
This action projects grid entities onto database entities.
$curve project ?-type proj_type? ?-direction direction? ?-center center? ?-axis point normal? ?-interior? ?dbentities?
This action projects this curve onto one or more database entities.
$con project ?-type proj_type? ?-direction direction? ?-center center? ?-axis point normal? ?<-interior | -shape>? ?dbentities?
This action projects this connector onto one or more database entities.
A boundary is reference to either a database curve or the edge of a database surface.