Skip to documentation
DocumentationAll documentsEnglish

CONSTRAINT(nged)

NAME

constraint - manage parametric geometric constraints stored on database objects

On this page

SYNOPSIS

constraint set constraint_name key [expression_parts ...]
constraint get constraint_name1 [constraint_name2 ...]
constraint show constraint_name1 [constraint_name2 ...]
constraint eval constraint_name1 [constraint_name2 ...]
constraint help [command]

DESCRIPTION

The constraint command manages parametric constraint data stored as attributes on database objects. Constraints represent dimensional and geometric relationships between geometry objects, such as coincidence, collinearity, tangency, or parametric formulas.

Constraints are stored as named attributes on database objects. The constraint command requires a database version 5 or later; older databases must be upgraded with dbupgrade first.

Subcommands

set constraint_name key [expression_parts …​]

Add or update the constraint attribute named key on the existing database object constraint_name. The expression value is assembled from all remaining arguments expression_parts. The constraint_name object must already exist in the database.

get constraint_name1 [constraint_name2 …​]

Print the raw constraint attributes for one or more named objects. Output format per attribute: object_name attribute_name value.

show constraint_name1 [constraint_name2 …​]

Print the constraint attributes for one or more objects in a labeled, human-readable format. Each object name is printed as a header, followed by indented attribute = value pairs.

eval constraint_name1 [constraint_name2 …​]

Evaluate (attempt to solve) the constraint attributes stored on the named objects. Requires a writable database.

help [command]

Print extended help, including the full list of supported constraint expression types and entity functions.

Constraint Expressions

The following geometric constraint types are supported in expressions:

Type Description

coincident {point point|point edge|edge edge}

Specified entities stay connected.

collinear {line line}

Straight edges are aligned along the same line.

concentric {circle circle}

Circle/arc curves maintain the same center point.

fixed {point|edge|face|object}

Specified entity is immutable with respect to the global coordinate system.

parallel {edge edge|edge face|face face|object object}

Specified entities are parallel to each other.

perpendicular {edge edge|edge face|face face|object object}

Specified entities are perpendicular (90° to each other).

horizontal {point point|edge|vector}

Specified entities have X/Y values set to match each other.

vertical {point point|edge|vector}

Specified entities have Z values set to match each other.

tangent entity entity

Specified entities maintain contact (point sets overlap without intersecting).

symmetric {point point|curve curve} line

Specified symmetry about an axis.

equal entity entity

Specified values are set equal in magnitude, length, or area.

formula relationship

General parametric relationship using functions, variables, and values.

Entity and Value Functions

Function Returns

bisect(curve)

point

center(surface)

point

centroid(object)

point

angle(curve1, curve2)

value

area(surface)

value

diameter(arccurve)

value

distance(entity, entity)

value

hdistance(entity, entity)

value

length(curve)

value

magnitude(vector)

value

radius(arccurve)

value

vdistance(entity, entity)

value

EXAMPLES

Example 1. Set a constraint attribute on an existing object

mged> constraint set c1 coincident_expr "coincident ell.V arb8.P[4]"

Stores a coincident_expr attribute on the existing database object c1.

Example 2. Set a formula constraint

mged> constraint set p0 formula_expr "formula ell.R[0]=10.0"

Stores a parametric formula on object p0.

Example 3. Get the constraints on an object

mged> constraint get c1

Prints the raw constraint attributes of c1 in the form: c1 attribute_name value

Example 4. Show constraints in readable form

mged> constraint show c1 c2 c3

Prints the constraint attributes for c1, c2, and c3 with labeled headers and attribute = value format.

Example 5. Evaluate a constraint

mged> constraint eval c3

Evaluates the constraint expression stored on c3.

Example 6. Get help

mged> constraint help

Prints the full help text including all expression types, entity functions, and value functions.

SEE ALSO

cc(nged), attr(nged)

AUTHOR

BRL-CAD Team

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org