CONSTRAINT(nged)

manage parametric geometric constraints stored on database objects

πŸ“… published 7.44.0, from nixpkgs unstable

πŸ’– CONSTRAINT(nged) β€” BRL-CAD User Commands πŸ’–

✨ NAME ✨

constraint β€” manage parametric geometric constraints stored on database objects. literally the command that keeps your geometry’s relationships in check, bestie πŸ’…

🌸 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 πŸ¦‹

okay so 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. periodt ✨

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.

🚨 vibe check warning, bestie: database version 5 or later is the requirement. If yours is older, dbupgrade first. no cap πŸ’€

πŸ’… 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. no object, no update, sorry 😭
  • 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. raw data, straight up 🫢
  • 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. this is the cute, readable version ✨
  • eval constraint_name1 [constraint_name2 ...] β€” Evaluate (attempt to solve) the constraint attributes stored on the named objects. Requires a writable database. writable database is the move here πŸ”₯
  • help [command] β€” Print extended help, including the full list of supported constraint expression types and entity functions. when you need the whole lore drop πŸ“š

πŸŽ€ Constraint Expressions πŸŽ€

The following geometric constraint types are supported in expressions. The original table had Type and Description columns, and the cells got a little chaotic, so here every row is paired up clearly. Where the source table has no separate description line, I’m saying so instead of inventing one iykyk πŸ’….

  • coincident {point pointT}:T{ point edgeT} T{ 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 {pointT}:T{ edgeT} T{ faceT}:T{ object} β€” Specified entity is immutable with respect to the global coordinate system.
  • parallel {edge edgeT} T{ edge faceT}:T{ face faceT} T{ object object} β€” (the source table has no separate description line for this row)
  • perpendicular {edge edgeT}:T{ edge faceT} T{ face faceT}:T{ object object} β€” Specified entities are perpendicular (90Β° to each other).
  • horizontal {point pointT} T{ edgeT}:T{ vector} β€” Specified entities have X/Y values set to match each other.
  • vertical {point pointT} T{ edgeT}:T{ 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 pointT} T{ curve curve} line β€” (the source table has no separate description line for this row)
  • 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 πŸ¦‹

okay so these are the little function besties you can drop inside your constraint expressions, and each one hands you back either a point or a value. literally just pick your fave, iykyk:

  • bisect(curve) β†’ returns a point (yes bestie, the midpoint vibe) ✨
  • center(surface) β†’ returns a point (the center of a surface, iconic)
  • centroid(object) β†’ returns a point (the centroid of an object, no cap)
  • angle(curve1, curve2) β†’ returns a value (the angle between two curves πŸŽ€)
  • area(surface) β†’ returns a value (surface area, periodt)
  • diameter(arccurve) β†’ returns a value (diameter of an arc curve, slay)
  • distance(entity, entity) β†’ returns a value (distance between two entities)
  • hdistance(entity, entity) β†’ returns a value (horizontal distance, fr fr)
  • length(curve) β†’ returns a value (how long the curve is πŸ’…)
  • magnitude(vector) β†’ returns a value (the magnitude of a vector, highkey useful)
  • radius(arccurve) β†’ returns a value (radius of an arc curve 🌸)
  • vdistance(entity, entity) β†’ returns a value (vertical distance, bestie)

✨ EXAMPLES ✨

like, here's where it gets fun β€” real actual things you can type 🫢

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. cute, done, no drama. πŸ’–

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. math is literally main character energy here 🌈

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 β€” very raw, very honest, we respect it πŸ™ˆ

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. way easier on the eyes, ngl πŸ‘‘

Example 5. Evaluate a constraint

mged> constraint eval c3

Evaluates the constraint expression stored on c3. go off, king πŸ’€

Example 6. Get help

mged> constraint help

Prints the full help text including all expression types, entity functions, and value functions. the whole buffet, bestie πŸ“


🌸 SEE ALSO 🌸

  • cc(nged)
  • attr(nged)

go read those too, they're giving supporting-character excellence ✨


πŸ’œ AUTHOR πŸ’œ

BRL-CAD Team


πŸŽ€ BUG REPORTS πŸŽ€

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


not me writing a whole sign-off but like… this gorgeous page came from BRL-CAD and its name is CONSTRAINT(nged) πŸ¦‹ if you made it this far you're literally a unix scholar, mwah πŸ’…β­πŸ«Ά
πŸ“¦ where this page comes from