C.a.R. > Documentation > Command Mode
There are two construction modes.
The visual mode is the default mode. To switch the mode, use . In the descriptive mode, the status line will be replaced by an input line.
This mode uses the mouse to create objects.
In this mode, there is an input line below the construction. The following differences apply.
There is a fixed syntax for the input.
name=function(parameter,...)
If the name is missing, the object will get the default name. Here is a short description of the syntax. Note, that expressions may be used in all places, where a value is expected. Empty brackets can be omitted.
Syntax |
Long |
Description |
---|---|---|
A=P() |
point |
Generates a point at random position. |
A=P(0,1) |
A fixed point. |
|
a=s(B,C) |
segment |
A segment from B to C. |
a=s(B,2) |
A segment of fixed length. |
|
a=g(B,C) |
line |
A line through B and C. |
a=r(B,C) |
ray |
A ray from B to C. |
k=k(A,B) |
circle |
A circle around A trough B. |
k=k(A,2) |
A circle with fixed radius. |
|
k=k(A,B,C) |
A circle around A with radius BC. |
|
A=S(g,g) |
intersection |
An intersection between two lines. |
A,B=S(k,k) |
Both intersections between circles, or circles and lines. |
|
away(A,P) |
away |
Keeps the intersection A away from the point P. |
M=M(A,B) |
middle |
The midpoint of AB. |
g=p(g,A) |
parallel |
The parallel through A to g. |
g=l(g,A) |
plumb |
The perpendicular through A to g. |
a=w(A,B,C) |
angle |
The angle A,B,C |
a=w(A,B,90) |
An angle of fixed size. |
|
A=area(P1,P2,P3) |
area |
Creates an area with these corners. |
value(P,0,1) |
value |
Fixes the coordinates of the point |
value(s,2) |
Fixes the length of the segment. |
|
value(k,2) |
Fixes the radius of a circle. |
|
value(w,90) |
Fixes the size of an angle. |
|
value(true,o) |
Sets the display of the value for o. |
|
value(o) |
Sets the display of the value for o to on. |
|
value(true) |
Sets the default display of values. |
|
name(o,p) |
name |
Sets the name of o to p. |
name(true,o) |
Sets the display of the name for o. |
|
name(o) |
Sets the display of the name for o to on. |
|
name(true) |
Sets the default display of names. |
|
hide(true,o) |
hide |
Hides or un-hides o. |
hide(o) |
Hides o. |
|
hide(true) |
Sets the default hidden state for objects. |
|
col(green,o) |
color |
Sets the color of o to red, green, blue or brown. |
col(green) |
Sets the default color. |
|
th(thick,o) |
thickness |
Sets the thickness of o to thick, normal or thin. |
th(thick) |
Sets the default thickness |
|
type(square,P) |
type |
Sets the point type to square, circle, diamond or point. |
type(square) |
Sets the default point type. |
|
part(true,k) |
partial |
Sets the object k to partial display or full display. |
part(k) |
Sets the object k to partial display. |
|
part(true) |
Sets the default partial state. |
|
fill(true,o) |
fill |
Sets the object o to filled state or outline state. |
fill(o) |
Sets the object o to filled state. |
|
back(true,o) |
background |
Sets the object o to the background or not. |
back(o) |
Sets the object o to the background. |
|
window(0,0,5) |
window |
Sets the view window to width 2*5 and center (0,0). |
Macros can be used too. Names left of = will be assigned to targets. If there are several targets, the names must be separated by commas. One additional parameter may be used to assign a value for an object, which would be prompted in interactive mode.
One can load constructions from a file, or edit and then load such constructions. The syntax is line oriented and uses the commands described above. Line comments starting with // may be used. The files may contain macros like this
macro U // Constructs a circle through three points parameter A=point // Select first point parameter B=point // Select second Point parameter C=point // Select third point g1=MS(A,B) g2=MS(A,C) U=intersection(g1,g2) target k=circle(U,A) end
The indents are optional. Comments in the parameter lines are used as prompts, if the macro is used interactively. This macro calls the macro MS with two parameters.
macro MS param A=point param B=point partial(true) k1=circle(A,B) k2=circle(B,A) partial(false) P1,P2=intersection(k1,k2) target g=line(P1,P2) end
If a line constructs two objects, the target must be defined separately.
A,B=intersection(g,k) target B
If a macro has more than one target, all targets must be assigned.
A,B=test(...)
Prompts are defined by the keyword prompt in front of an object name.
k=circle(A,5) pompt k
Here is an example of a macro using a segment as a parameter.
macro MS // Mittelsenkrechte A=point B=point parameter s=segment(A,B) ... Ende
If circles are used as a paramter, there is the special syntax
M=point parameter circle(M)
This kind of circle can only be used in parameters.
C.a.R. > Documentation > Command Mode