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
- Type
RECand press ReturnEnter. Type0,0, ReturnEnter,100,50, ReturnEnter. - Type
AUTOCONSTRAINand press ReturnEnter. TypeALL, 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.
- Type
GCFIXand 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
- Type
DCHORIZONTALand press ReturnEnter. - Click near the lower-left corner, then near the lower-right corner.
- Click below the rectangle for the dimension line.
- The prompt shows
Dimension text <d1=100>. Typewidth=120and press ReturnEnter.
The rectangle is now 120 wide, and the label reads width=120.
- Type
DCVERTICALand press ReturnEnter, typeOand press ReturnEnter, then click the right side. - Click to the right of it, type
width/2and 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
| Command | Keeps |
|---|---|
GCHORIZONTAL, GCVERTICAL | a line or segment level or plumb (2P: two points level or plumb) |
GCPARALLEL, GCPERPENDICULAR, GCCOLLINEAR | two lines parallel, square or on one line |
GCCOINCIDENT | two points together; O: a point on a line, circle or arc |
GCTANGENT | a line and a circle or arc, or two of them, touching |
GCCONCENTRIC, GCEQUAL | two circles or arcs on one centre; two lengths or two radii equal |
GCSYMMETRIC | two points, lines or circles mirrored across a line |
GCFIX | a point (click near it) or a whole object (O) where it is |
DCLINEAR, DCHORIZONTAL, DCVERTICAL, DCALIGNED | a distance |
DCRADIUS, DCDIAMETER, DCANGULAR | a 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.
DELCONSTRAINTremoves every constraint from the objects you select.CONSTRAINTBAR:Sshows every bar,Hhides them; select objects first to show or hide theirs. More has Show constraint bars and Hide constraint bars.DCDISPLAYshows or hides the dimensional constraints. They never plot.DCCONVERTturns dimensions drawn on lines, circles and arcs into dimensional constraints.