Tutorials CadCraft help Walkthroughs

Constrain a drawing

Keep lines horizontal, ends together and sizes fixed with geometric and dimensional constraints, and let the drawing follow when you change a size.

Written for CadCraft 0.3. The same help is inside the app: press F1.

What you will make

A plate whose width you change in one place: its sides stay square, one corner stays put, its height stays half its width.

Constraints work on lines, polylines, circles, arcs and points on the Model tab. Each one you add is one undo step.

Draw and constrain the outline

  1. Type REC and press ReturnEnter. Type 0,0, ReturnEnter, 100,50, ReturnEnter.
  2. Type AUTOCONSTRAIN and press ReturnEnter. Type ALL, ReturnEnter, then ReturnEnter again.

The history says "4 constraints applied". Small boxes with H and V appear beside the sides: these are the constraint bars.

  1. Type GCFIX and press ReturnEnter. Click near the lower-left corner. A box with ⊕ appears: that corner stays where it is.

AUTOCONSTRAIN adds coincident constraints where ends nearly meet and horizontal or vertical ones where lines are nearly level or plumb. Type S at its prompt to change how near (0.05 drawing units and 1° to start with).

Add the sizes

  1. Type DCHORIZONTAL and press ReturnEnter.
  2. Click near the lower-left corner, then near the lower-right corner.
  3. Click below the rectangle for the dimension line.
  4. The prompt shows Dimension text <d1=100>. Type width=120 and press ReturnEnter.

The rectangle is now 120 wide, and the label reads width=120.

  1. Type DCVERTICAL and press ReturnEnter, type O and press ReturnEnter, then click the right side.
  2. Click to the right of it, type width/2 and press ReturnEnter.

It is 60 high. The label reads fx: d1=width/2: an expression drives it.

The history now says the outline is fully constrained. To change its size, change width (see Use parameters and equations), or double-click the width=120 label, type a new value and choose Apply.

Moving constrained objects

Move, rotate, scale, grips and the Properties panel all keep the constraints: what you moved is held, and the rest follows. When the constraints cannot follow, the edit is not made and the history says why, for example "Not done: the constraints hold that object where it is". Erasing an object removes its constraints with it.

The constraints

CommandKeeps
GCHORIZONTAL, GCVERTICALa line or segment level or plumb (2P: two points level or plumb)
GCPARALLEL, GCPERPENDICULAR, GCCOLLINEARtwo lines parallel, square or on one line
GCCOINCIDENTtwo points together; O: a point on a line, circle or arc
GCTANGENTa line and a circle or arc, or two of them, touching
GCCONCENTRIC, GCEQUALtwo circles or arcs on one centre; two lengths or two radii equal
GCSYMMETRICtwo points, lines or circles mirrored across a line
GCFIXa point (click near it) or a whole object (O) where it is
DCLINEAR, DCHORIZONTAL, DCVERTICAL, DCALIGNEDa distance
DCRADIUS, DCDIAMETER, DCANGULARa radius, a diameter, an angle between two lines or an arc's angle

GEOMCONSTRAINT and DIMCONSTRAINT ask which one; Constrain and Dimension in the Parametric group run them, and More there lists each. Where you click picks the part: a click near an end, the middle or a center takes that point; a click on a polyline takes the segment under it. The first object stays and the second moves to meet it.

A constraint that conflicts with others, or adds nothing because the others already imply it, is refused with a message and nothing moves.

See, select and remove

  • Click a box in a constraint bar (or a coincident square, or a dimension label) to select that constraint; the history names it. Press fn DeleteDelete to remove it.
  • DELCONSTRAINT removes every constraint from the objects you select.
  • CONSTRAINTBAR: S shows every bar, H hides them; select objects first to show or hide theirs. More has Show constraint bars and Hide constraint bars.
  • DCDISPLAY shows or hides the dimensional constraints. They never plot.
  • DCCONVERT turns dimensions drawn on lines, circles and arcs into dimensional constraints.