Choose a langage

or Auto Translate

This page corresponds to the online help of CaRMetal for scripts.

You can search instructions by dictionnaries :

  • Creation : creation of objets (CaRCommands)
  • Properties : informations about objets (CaRCommands)
  • Javascript : Javascript programming commands
  • Hyperbolic geometry : CaRCommands in the Poincaré Disk

Javascript Function Detail

Creation of objects

Point

Point(String name,String x,String y)
                              
Create a point at given coordinates. coordinates can be defined by numerical values (e.g. Point("A",-1,5.2)) or using expressions (e.g. Point("C","x(B)+1","y(B)+1"). If the name is not given (e.g. Point("",2,-2.5)),the point will be created as well.
From javascript,you can also do something like this :
  1. a=Point("",1,2)
  2. b=Point("",-2,3)
  3. m=4
  4. c=Point("","(x_a+x_b)/_m","(y_a+y_b)/_m")
The "_" symbol means that javascript must use the content of variables. For example The string "_m" will be replaced by "4" (line 3).
Another "shortcut" : if,for example,a contains "P1" (the real name of the point created by step 1),the string x_a is equivalent to the string "x(P1)".

 

Parameters:
name - Name of the point (suggestion)
x - x-coordinate (number or expression)
y - y-coordinate (number or expression)
Returns:
Name of the created point

PointOn

PointOn(String name,String obj)
Sets or creates a bounded point.
Exemple :  PointOn(“A”,”s1”) will create the point A bounded to the objet s1. If A already exists, it will just be bounded to s1.

 

Parameters:
name - Name of the point (suggestion)
obj - Object the point will be bounded to
Returns:
Name of the created or set point

MidPoint

MidPoint(String name,String a,String b)
Create the midpoint of two existing points

 

Parameters:
name - Name of the midpoint
a - Name of first point
b - Name of second point
Returns:
the midpoint name

Symmetry

Symmetry(String name,String a,String b)
Reflect the point b with center a

 

Parameters:
name - Name of the Symmetric
a - Symmetry center
b - Point to relect
Returns:
the symmetric point name

Reflection

Reflection(String name, String l, String p)
Reflects the point p with line l

 

Parameters:
name - Name of the Symmetric (suggestion)
l - Reflection line
b - Point to relect
Returns:
Name of the created point

Translation

Translation(String name, String a, String b, String p)
Translates the point p with vector ab

 

Parameters:
name - Name of the translated point (suggestion)
a - Origin of the vector
b - Extremity of the vector
p - Point to translate
Returns:
Name of the created point

Intersection

Intersection(String name,String a,String b)
Creates the intersection between two objects. If you provide a name for the intersection,only one intersection point will be created. If you give the empty string "" as name parameter,two intersection points will be created,if the a and b objects are two circles or line/circle.

 

Parameters:
name - Name of the intersection point
a - Name of first object
b - Name of second object
Returns:
Name of intersection point
See Also:
Intersection2(String,String,String,String)

Intersection2

Intersection2(String name1,String name2,String a,String b)
When two objects have two intersection points (two circles or one line/one circle) you may use this command to create them both.

 

Parameters:
name1 - Name of first intersection point
name2 - Name of second intersection point
a - Name of first object
b - Name of second object
Returns:
Name of intersection point
See Also:
Intersection(String,String,String)

Intersections

@See Intersection, Intersection2

Intersections(String name,String a,String b)
The number of the intersection points depends on the nature of the curves.

 

Parameters:
name - Name of the first intersection point (suggestion)
a - Name of first object
b - Name of second object
Returns:
List of the intersection points

Segment

Segment(String name,String a,String b)
Creates a segment between two points.

 

Parameters:
name - Name of the segment (suggestion)
a - Name of first point
b - Name of second point
Returns:
Name of the created segment

FixedSegment

FixedSegment(String name,String a,String r)
Creates a segment with center a and length r.

 

Parameters:
name - Name of the segment (suggestion)
a - Center point
r - Length (number or expression)
Returns:
Name of the segment

Polygon

Polygon(String name,String params)
Creates a polygon defined by a list of points. e.g. Polygon("","A,B,C") will create the triangle ABC.

 

Parameters:
name - Name of the polygon (suggestion)
params - list of objects
Returns:
Name of the created polygon

Triangle

Triangle(String name,String a,String b,String c)
Creates the triangle with three existing points.

 

Parameters:
name - Name of the triangle (polygon)
a - Name or first point
b - Name of second point
c - Name of third point
Returns:
the name of the triangle

Quadrangle

Quadrangle(String name,String a,String b,String c,String d)
Creates the quadrangle with four existing points.

 

Parameters:
name - Name of the quadrangle (polygon)
a - Name or first point
b - Name of second point
c - Name of third point
c - Name of fourth point
Returns:
the name of the quadrangle.

Line

Line(String name,String a,String b)
Creates a line between two points

 

Parameters:
name - Name of the line (suggestion)
a - Name of first point
b - Name of second point
Returns:
Name of the created line

Parallel

Parallel(String name,String lne,String pt)
Creates a parallel line through point pt to line lne.

 

Parameters:
name - Name of the parallel line (suggestion)
lne - Name of the line
pt - Name of the point
Returns:
Name of the parallel line

Perpendicular

Perpendicular(String name,String lne,String pt)
Creates a perpendicular line through point pt to line lne.

 

Parameters:
name - Name of the parallel line (suggestion)
lne - Name of the line
pt - Name of the point
Returns:
Name of the perpendicular line

PerpendicularBisector

PerpendicularBisector(String name, String a, String b)
Creates the perpendicular bisector between two points a and b.

 

Parameters:
name - Name of the perpendicular bisector (suggestion)
a - Name of first point
b - Name of second point
Returns:
Name of the created perpendicular bisector

AngleBisector

AngleBisector(String name, String a, String b, String c)
Creates the angle bisector between three points a, b and c.

 

Parameters:
name - Name of the angle bisector (suggestion)
a - Name of first point
b - Name of second point (=Vertex)
c - Name of third point
Returns:
Name of the created angle bisector.

Ray

Ray(String name,String a,String b)
Creates a ray from point a to point b

 

Parameters:
name - Name of the ray (suggestion)
a - Name of first point
b - Name of second point
Returns:
Name of the created ray

Vector

Vector(String name,String a,String b)
Creates a vector between two points.

 

Parameters:
name - Name of the vector (suggestion)
a - Name of origin point
b - Name of second point
Returns:
Name of the created vector

Circle

Circle(String name,String a,String b)
Creates a circle with center a to point b.

 

Parameters:
name - Name of the circle (suggestion)
a - center point
b - point of the circle
Returns:
Name of the circle

FixedCircle

FixedCircle(String name,String a,String r)
Creates a circle with center a and radius r.

 

Parameters:
name - Name of the circle (suggestion)
a - Center point
r - Radius (number or expression)
Returns:
Name of the circle

Circle3

Circle3(String name, String a, String b, String c)
Creates the circle around a with radius bc.

 

Parameters:
name - Name of the circle (suggestion)
a - Center point
b - First point of radius
c - Second point of radius
Returns:
Name of the created circle

Circle3pts

Circle3pts(String name, String a, String b, String c)
Creates the circumcircular circle between three points a, b and c.

 

Parameters:
name - Name of the circle (suggestion)
a - First point
b - Second point
c - Third point
Returns:
Name of the created circle

Arc3pts

Arc3pts(String name, String a, String b, String c)
Creates the circumcircular arc between three points a, b and c.

 

Parameters:
name - Name of the arc (suggestion)
a - First point
b - Second point
c - Third point
Returns:
Name of the created arc

Quadric

Quadric(String name,String a,String b,String c,String d,String e)
Creates a quadric defined by five points

 

Parameters:
name - Name of the quadric (suggestion)
a - Name of first point
b - Name of second point
c - Name of third point
d - Name of fourth point
e - Name of fifth point
Returns:
Name of the created quadric

Angle

Angle(String name,String a,String b,String c)
Creates an angle defined by 3 points a,b and c (b is the vertex).

 

Parameters:
name - Name of the angle (suggestion)
a - Name of first point
b - Name of the vertex
c - Name of the third point
Returns:
Name of the created angle

FixedAngle

FixedAngle(String name,String a,String b,String c)
Creates an angle defined by 2 points a and b, where b is the vertex and an expression c.

 

Parameters:
name - Name of the angle (suggestion)
a - Name of first point
b - Name of the vertex
c - Angle in degree (number or expression)
Returns:
Name of the created angle

CartesianFunction

CartesianFunction(String name,String a,String b,String fx)
Creates the graph of a cartesian function with x variable in [a,b]

 

Parameters:
name - Name of the function (suggestion)
a - Minimum (number or expression)
b - Maximum (number or expression)
fx - expression of the function (variable x)
Returns:
Name of the function

ParametricFunction

ParametricFunction(String name,String a,String b,String xt,String yt)
Creates the graph of a parmetric function with t variable in [a,b]

 

Parameters:
name - Name of the function (suggestion)
a - Minimum (number or expression)
b - Maximum (number or expression)
xt - expression of x(t) (variable t)
yt - expression of y(t) (variable t)
Returns:
Name of the function

ImplicitPlot

ImplicitPlot(String name,String f)
Creates an implicit curve as the set of zeroes of f (function of x and y).
Example : ImplicitPlot("g", "x^2+y^2-9") will create the circle centered at the origin with radius 3.

 

Parameters:
name - Name of the curve (suggestion)
f - expression (should depend on x and y)
Returns:
Name of the created function

Expression

Expression(String name,String exp,String x,String y)
Creates an expression.

 

Parameters:
name - Name of expression (suggestion)
exp - Expression
x - x-coordinate of expression (number or expression)
y - y-coordinate of expression (number or expression)
Returns:
Name of expression

Text

Text(String name, String txt, String x, String y)
Creates a text.

 

Parameters:
name - Name of a text object (suggestion)
txt - The text to display
x - x-coordinate of expression (number or expression)
y - y-coordinate of expression (number or expression)
Returns:
Name of the created text object.

Delete

Delete(String name)
                   
Delete a given object in the current CaRMetal window.

 

Parameters:
name - Name of the object you want to delete.

ExecuteMacro

ExecuteMacro(String macroname, String params)
Executes a macro-construction macroname with parameters params

 

Parameters:
macroname - Name of the macro
params - params list of objects (e.g. "A,E,F,G")
Returns:
name of the last created object or the String array with all targets names

3D

Point3D

Point3D(String name, String x, String y, String z)
                              
Create a point at given coordinates. coordinates can be defined by numerical values (e.g. Point("A",-1,5.2,3)) or using expressions (e.g. Point("C","x3D(B)+1","y3D(B)+1,z3D(B)"). If the name is not given (e.g. Point("",2,-2.5,7)),the point will be created as well.
Notice : 3D. Only for version >= version 4.0.

 

Parameters:
name - Name of the point (suggestion)
x - x-coordinate (number or expression)
y - y-coordinate (number or expression)
y - z-coordinate (number or expression)
Returns:
Name of the created point

Projection3D

Projection3D(String name, String l, String p)
Projects the point p on plane l.
Notice : 3D. Only for version >= version 4.0.

 

Parameters:
name - Name of the projected point (suggestion)
l - Plane of projection defined by a list of points. e.g. Projection3D("A,B,C","E") will create the projected point.
p - Point to project
Returns:
Name of the created point

Reflection3D

Reflection3D(String name, String l, String p)
reflects the point p through plane l.
Notice : 3D. Only for version >= version 4.0.

 

Parameters:
name - Name of the reflected point (suggestion)
l - Plane of reflection defined by a list of points. e.g. Reflection3D("A,B,C","E") will create the reflected point.
p - Point to reflect
Returns:
Name of the created point

Symmetry3D

Symmetry3D(String name, String b, String p)
creates the symmetric point of p with center b.
Notice : 3D. Only for version >= version 4.0.

 

Parameters:
name - Name of the symmetric point (suggestion)
l - center of symmetry
p - Point to get symetric of
Returns:
Name of the created point

Translation3D

Translation3D(String name, String a, String b, String p)
Translates the point p with vector ab.
Notice : 3D. Only for version >= version 4.0.

 

Parameters:
name - Name of the translated point (suggestion)
a - Origin of the vector
b - Extremity of the vector
p - Point to translate
Returns:
Name of the created point

Sphere

Sphere(String name,String a,String b)
Creates a sphere with center a to point b.
Notice : 3D. Only for version >= version 4.0.

 

Parameters:
name - Name of the sphere (suggestion)
a - center point
b - point of the sphere
Returns:
Name of the sphere

FixedSphere

FixedSphere(String name,String a,String r)
Creates a sphere with center a and radius r.
Notice : 3D. Only for version >= version 4.0.

 

Parameters:
name - Name of the sphere (suggestion)
a - Center point
r - Radius (number or expression)
Returns:
Name of the sphere

Circle3D

Circle3D(String name,String l,String b)
Creates a circle 3D with axis line l that goes through point b.
Notice : 3D. Only for version >= version 4.0.

 

Parameters:
name - Name of the circle3D (suggestion)
l - axis of the circle (= a line)
b - point of the circle
Returns:
Name of the circle 3D

FixedCircle3D

FixedCircle3D(String name,String l,String b, String r)
Creates a circle 3D with axis/direction line l, center b and radius r.
Notice : 3D. Only for version >= version 4.0.

 

Parameters:
name - Name of the circle3D (suggestion)
l - axis/direction of the circle (= a line)
b - center of the circle
r - radius of the circle (must be an expression)
Returns:
Name of the circle 3D

Circle3D3pts

Circle3D3pts(String name, String a, String b, String c)
Creates the circumcircular 3D circle between three points a, b and c.
Notice : 3D. Only for version >= version 4.0.

 

Parameters:
name - Name of the circle (suggestion)
a - First point
b - Second point
c - Third point
Returns:
Name of the created circle

turtle CaRCommands

FixTurtle

FixTurtle(String pointName)
Initiates the turtle and/or attaches it to a point.

 

Parameters:
pointName - Name of the point you want to attach the turtle to.
Returns:
name of the point if the command succeeds, else the empty string.

TurtleDown

TurtleDown()
Sets the turtle in writing mode.

 

Parameters:
none
Returns:
true

TurtleUp

TurtleUp()
Sets the turtle in flying mode.

 

Parameters:
none
Returns:
false

MoveForward

MoveForward(String l)
Moves the turte forward with a lenght l.

 

Parameters:
pointName : name of the point created (suggestion)
segmentName : name of the segment created (suggestion)
l - length (number or expression)
Returns:
the name of the new point created (where the turtle is) and the name of the last segment created in a Javascript array of length 2.
In other words, one will write :
p=MoveForward(...)[0] to get the name of the point
p=MoveForward(...)[1] to get the name of the segment

MoveBackward

MoveBackward(String l)
Moves the turte backward with a lenght l.

 

Parameters:
pointName : name of the point created (suggestion)
segmentName : name of the segment created (suggestion)
l - lenght (number or expression)
Returns:
the name of the new point created (where the turtle is) and the name of the last segment created in a Javascript array of length 2.
In other words, one will write :
p=MoveBackward(...)[0] to get the name of the point
p=MoveBackward(...)[1] to get the name of the segment

TurnLeft

TurnLeft(String a)
Turns the turtle to the left with an angle a.

 

Parameters:
a - angle (number or expression)
Returns:
nothing.

TurnRight

TurnRight(String a)
Turns the turtle to the right with an angle a.

 

Parameters:
a - angle (number or expression)
Returns:
nothing.

RollLeft

RollLeft(String a)
3D only : rolls the turtle to the left with an angle a.

 

Parameters:
a - angle (number or expression)
Returns:
nothing.

RollRight

RollRight(String a)
3D only : rolls the turtle to the right with an angle a.

 

Parameters:
a - angle (number or expression)
Returns:
nothing.

PitchUp

PitchUp(String a)
3D only : pitches the turtle up with an angle a.

 

Parameters:
a - angle (number or expression)
Returns:
nothing.

PitchDown

PitchDown(String a)
3D only : pitches the turtle down with an angle a.

 

Parameters:
a - angle (number or expression)
Returns:
nothing.

ShowTurtle

ShowTurtle()
renders the turtle visible.

 

Parameters:
none
Returns:
nothing

HideTurtle

HideTurtle()
mask the turtle.

 

Parameters:
none
Returns:
nothing

OrientateTurtle

OrientateTurtle(String a)
Orientates the turtle in a certain direction from (Ox) (in the plane (XOY) in 3D)

 

Parameters:
a - angle (number or expression)
Returns:
nothing.

OrientateTowards

OrientateTowards(String pointName)
Orientates the turtle towards a given point.

 

Parameters:
pointName - Name of the point aimed.
Returns:
nothing.

TurtleSpeed

TurtleSpeed(double speed)
Gives the turtle a certain speed.

 

Parameters:
speed - a positive number between 0 and 100
Returns:
nothing.

Informations about objects

Move

Move(String name,String i,String j)  or Move(String name,String i,String j,String k)
                 
Moves a given object to an (x;y) position in the current CaRMetal window.

 

Parameters:
name - Name of the object you want to move.
i - x-coordinate
j - y-coordinate
(k - z-coordinate)

X

X(String name)
                
Return the x-coordinate of an object. If no object is found,then it returns NaN.

 

Parameters:
name - the name of the object
Returns:
the numeric value of the x-coordinate

Y

Y(String name)
                
Return the y-coordinate of an object. If no object is found,then it returns NaN.

 

Parameters:
name - the name of the object
Returns:
the numeric value of the y-coordinate

X3D

X3D(String name)
                
Return the x3D-coordinate of an object. If no object is found,then it returns NaN.

 

Parameters:
name - the name of the object
Returns:
the numeric value of the x3D-coordinate

Y3D

Y3D(String name)
                
Return the y3D-coordinate of an object. If no object is found,then it returns NaN.

 

Parameters:
name - the name of the object
Returns:
the numeric value of the y3D-coordinate

Z3D

Z3D(String name)
                
Return the z3D-coordinate of an object. If no object is found,then it returns NaN.

 

Parameters:
name - the name of the object
Returns:
the numeric value of the z3D-coordinate

Distance

Distance(String name)
                
Return the 2D distance between two points.

 

Parameters:
name - name of the first point
name - name of the second point
Returns:
the 2D distance between the two points

Distance3D

Distance3D(String name, String name)
                
Return the 3D distance between two points.

 

Parameters:
name - name of the first point
name - name of the second point
Returns:
the 3D distance between the two points

SetExpressionValue

SetExpressionValue(String name,String value)
                               
Set the value of a given expression which is in the construction.

 

Parameters:
name - Name of an existing expression
value - Value you want to give to the expression

GetExpressionValue

GetExpressionValue(String name)
                                 
Returns the value of a given expression which is in the construction. Remember that "controls" are expressions too,so you can capture a value of a control by this way.

 

Parameters:
name - Name of an existing expression
Returns:
Expression's numeric value.

SetText

SetText(String name, String value)
Set the value of a given text object which is in the construction.

 

Parameters:
name - Name of a text object.
value - The new texte to be displayed.

GetText

GetText(String name)
                                 
Returns the text value of a text object.

 

Parameters:
name - Name of an existing text
Returns:
the content of the text object.

Show

Show(String name)
Shows an object (or multiple objects).
Example : Show("A,B,c1,l1") will show objects A,B,c1 and l1.

 

Parameters:
name - Name(s) of object(s).

Hide

Hide(String name)
Hides an object (or multiple objects).
Example : Hide("A,B,c1,l1") will hide objects A,B,c1 and l1.

 

Parameters:
name - Name(s) of object(s).

SetHide

SetHide(String name,boolean b)
Objects can be hidden or visible. This will hide or show an object (or multiple objects).
Example : SetHide("A,B,c1,l1",true) will show objects A,B,c1 and l1.

 

Parameters:
name - Name(s) of object.
bool - "true" to hide objects, and "false" to show them.

SetShowName

SetShowName(String name,boolean bool)
Shows or hide the name of an object (or multiple objects).
Example : SetShowName("A,B,c1,l1",true) will shows the names of objects A,B,c1 and l1.

 

Parameters:
name - Name(s) of object.
bool - "true" to show name,and "false" to hide it.

Shownames

Shownames()
After calling this command,names of new objects will be displayed.

Hidenames

Hidenames()
After calling this command,names of new objects will not be displayed.

SetAlias

SetAlias(String name,String alias)
Set the alias name of an object.
Note : It's possible to change this property in one step for multiple objects.
Example : SetAlias("A,B,c1,l1","My beautiful object") will give the "My beautiful object" alias name to the objects A,B,c1 and l1

 

Parameters:
name - Name of the point you want to change alias name.
alias - Alias name.

SetShowValue

SetShowValue(String name,boolean bool)
Shows or hide the value of an object (or multiple objects).
Example : SetShowValue("A,B,c1,l1",true) will shows the value of objects A,B,c1 and l1.

 

Parameters:
name - Name(s) of object.
bool - "true" to show value,and "false" to hide it.

SetColor

SetColor(String name,String col)
Set the color of an object using one of the 6 predifined colors of CaRMetal.
Note : It's possible to change this property in one step for multiple object.
Example : SetColor("A,B,c1,E1","cyan") will give the "cyan" color to the objects A,B,c1 and E1

 

Parameters:
name - Name of the object you want to change color
col - Name of the color. It can be "green","blue","brown","cyan","red" or "black".

SetRGBColor

SetRGBColor(String name,int r,int g,int b)
Set the RGB color of an object using 3 integer numbers in [0..255].
Note : It's possible to change this property in one step for multiple object.
Example : SetColor("A,B,c1",120,40,245) will give the same color to the objects A,B and c1. This color is defined by r=120,g=40 and b=245.

 

Parameters:
name - Name of the object you want to change color
r - Red value (integer in [0..255]
g - Green value (integer in [0..255]
b - Blue value (integer in [0..255]

SetPointType

SetPointType(String name,String type)
Set the shape of a point. It has no effect if the object is not a point.
Note : It's possible to change this property in one step for multiple points.
Example : SetPointType("A,B,E,F","square") will give the "square" shape to the points A,B,E and F

 

Parameters:
name - Name of the point you want to change shape
type - Name of the shape. It can be "square","circle","diamond","point","cross","dcross".

SetThickness

SetThickness(String name,String thc)
Set the thickness of an object.
Note : It's possible to change this property in one step for multiple objects.
Example : SetThickness("A,B,c1,l1","thick") will give the "thick" aspect to the objects A,B,c1 and l1

 

Parameters:
name - Name of the point you want to change shape
thc - Name of the thickness. It can be "thick","normal" and "thin".

SetMagneticRay

SetMagneticRay(String name,String ray)
Set the standard magnetic attraction lenght of a point

 

Parameters:
name - Name of a point
ray - Attraction lenght,in pixels (number or expression)
See Also:
SetMagneticObjects(String,String),AddMagneticObject(String,String)

SetMagneticObjects

SetMagneticObjects(String name,String objectlist)
Set the objects that will magnetize a given point
Example : SetMagneticObjects("P","c1,d1,A") will make the point P attracted by the objects c1,d1 and A.
It's possible to define exceptions using the ":" separator. If,for instance,objectlist contains "A,E,c1:20,l1" and the attraction field is defined by 50 pixels,objects "A","E" and "l1" have an attraction radius of 50 pixels,but the object c1 will have an attraction radius of 20 pixels.

 

Parameters:
name - Name of a point
objectlist - List of objects
See Also:
AddMagneticObject(String,String),SetMagneticRay(String,String)

AddMagneticObject

AddMagneticObject(String name,String object)
Add an object to the list of magnetic objects of a given point.

 

Parameters:
name - Name of the point
object - Object to add to the magnetic point list
See Also:
SetMagneticObjects(String,String),SetMagneticRay(String,String)

Liberate

Liberate(String name)
Unfix an object in the CaRMetal current window. A fixed object can't be moved with the mouse.
Note : It's possible to apply in one step for multiple objects.
Example : Liberate("A,B,c1,l1") will unfix the objects A,B,c1 and l1 in the CaRMetal current window.

 

Parameters:
name - Name of the object

SetFixed

SetFixed(String name,boolean bool)
Fix or unfix an object in the CaRMetal current window. A fixed object can't be moved with the mouse.
Note : It's possible to change this property in one step for multiple objects.
Example : SetFixed("A,B,c1,l1",true) will fix the objects A,B,c1 and l1 in the CaRMetal current window.

 

Parameters:
name - Name of the object
bool - "true" value to fix the object,"false" to unfix it.

SetFilled

SetFilled(String name,boolean bool)
Some objects can be filled (circles,polygons,etc...). This will fill or unfill an object (or multiple objects).
Example : SetFilled("A,B,c1,l1",true) will fill objects A,B,c1 and l1.

 

Parameters:
name - Name(s) of object.
bool - "true" to fill objects,and "false" to unfill it.

SetPartial

SetPartial(String name,boolean bool)
Some objects can be drawn partially (circles,lines). This will draw partially or not an object (or multiple objects).
Example : SetPartial("A,B,c1,l1",true) will draw partially objects A,B,c1 and l1.

 

Parameters:
name - Name(s) of object.
bool - "true" to draw partially,and "false" to draw completly.

Conditional

Conditional(String name, String TAG, String expTXT)
Creates a condition for an object or a list of objects.

 

Parameters:
name - Name(s) of object(s)
TAG - type of condition this can be equal to : solid, hidden, normal, thick, thin, black, green, blue, cyan, red, brown, showvalue, showname, background, and superhidden.
expTXT - conditional expression to be applied.

Exists

Exists(String name)
Tells if an object exists (and is finite).

 

Parameters:
name - Name of the object
Returns:
true or false depending on the object being valid.

PenDown

PenDown(String name, boolean state)
Sets the track of an object.

 

Parameters:
name - Name of the object
state - State the state of the track (true for a visible track)

ReflexAngle

ReflexAngle(String name, boolean state)
Sets angles as reflex or not.

 

Parameters:
name - Name of the object
state - "true" to set as reflex, "false" to have only angles less than 180°.

getCONSOLE

getCONSOLE()
returns the java pop up window, where outputs are done.
Notice : only for version >= 4.0

One can give a name to that window with getCONSOLE().setTitle("New title");
or change the color of the font, its size, etc.


Programming commands in Javascript

Pause

Pause(int millis)
Pause in milliseconds

 

Parameters:
pause - time,in milliseconds

Print

Print(String a)
Print a string in a console. Print calls won't generate carriage return at the end of the output. If the console is not visible,it will be bring to front automatically.

 

Parameters:
a - String to be displayed

Println

Println(String a)
Print a string in a console. Println calls will generate carriage return at the end of the output. If the console is not visible,it will be bring to front automatically.

 

Parameters:
a - String to be displayed

Input

Input(String msg)
Ask and wait for a data input. This will bring a modal dialog to front and the script will be interrupted until the user presses the ok button.

 

Parameters:
msg - Question to ask the user
Returns:
String which was typed in the box (typically : answer to the question)

InteractiveInput

InteractiveInput(String msg,String type)
                                         
This will stop the script execution until the user shows an object of a given type in the current CaRMetal window. The message msg will be displayed in the status bar (bottom of the window) and the name of the object you clicked on will be return. If the user selects a tool in the palette,the script execution will ends.

 

Parameters:
msg - Message to be displayed in the status bar
type - Type of the object. This can be : Point,Line,Segment,Circle and Expression
Returns:
Name of the selected object

Alert

Alert(String msg)
Shows an alert message. This will stop the script execution until the user presses on the ok button.

 

Parameters:
msg - Message to be displayed

Prompt

@deprecated
@see Alert

Prompt(String msg)
Shows an alert message. This will stop the script execution until the user presses on the ok button.

 

Parameters:
msg - Message to be displayed

Experts

getC

getC()
Returns the CaRMetal construction. This is a CaRMetal object.

 

Parameters:
none

getZC

getZC()
Returns the CaRMetal Canvas. This is a CaRMetal object.

 

Parameters:
none

Load

Load(String text)
Reads a file and return its content as a string.
This function will be useful in javascript context.
One will be able, for instance, to write inside a CaRScript :
eval(Load("mytools.js"));
This will behave as if the file "mytools.js" had been imported.
The objects of "mytools.js" will be accessible within the CaRScript.

 

Parameters:
text - File to be read.
Returns:
The read text

SetIconSelection

SetIconSelection(String iconName, boolean valeur)
This CaRCommand makes it possible to modify preferences (aspect by default of the different kinds of objects)
It has the same effect as a real click on the icon and returns true if the vitual click changed something.
Exemple :

SetIconSelection("area",true);
changedFilledArea = SetIconSelection("filled",true);
changedSolidArea = SetIconSelection("solid",true);

Point("A");
Point("B")
Point("C");
Polygon("A,B,C");

 

Parameters:
iconName - Name of the icon. Possible values are :
* move, point, line, segment, circle, quadric, text, angle, area
* color0, ..., color5, type0, ..., type5, thickness0, thickness1, thickness2, partial, plines, showvalue, showname, bold, large, filled, obtuse, solid
value - true to select, false in the opposite case
Returns:
true if the vitual click changed something, false otherwise.

IsIconSelected (deprececated because unuseful now)

IsIconSelected(String iconName)
This CaRCommand let you know if an icon is selected.
Exemple :

SetIconSelection("area",true);
isNormal = IsIconSelected("thickness0");
isThick = IsIconSelected("thickness1");
isThin = IsIconSelected("thickness2");
SetIconSelection("thickness1",true);  //thickness1 = thick
    ...
SetIconSelection("move",true); // consulting mode

 
See also:
SetIconSelection(String,String)

 

Parameters:
iconName - Name of the icon. Possible values are :
* move, point, line, segment, circle, quadric, text, angle, area
* color0, ..., color5, type0, ..., type5, thickness0, thickness1, thickness2, partial, plines, showvalue, showname, bold, large, filled, obtuse, solid
Retourns:
true if the icon is selected, false otherwise

Hyperbolic geometry

DPPoint

DPPoint(String name)
Creates an hyperbolic point inside the Poincaré disk.

 

Parameters:
name - Name of point (suggestion)
Returns:
Name of point object

DPLine

DPLine(String name, String a, String b)
Creates an hyperbolic line between two points.

 

Parameters:
name - Name of the line (suggestion)
a - Name of first point
b - Name of second point
Returns:
Name of the created hyperbolic line.

DPSegment

DPSegment(String name, String a, String b)
Creates an hyperbolic segment (geodesic in the Poincaré disk) between two points.

 

Parameters:
name - Name of the segment (suggestion)
a - Name of first point
b - Name of second point
Returns:
Name of the created hyperbolic segment.

DPPerpendicular

DPPerpendicular(String name, String l, String p)
Creates an hyperbolic perpendicular line through a point.

 

Parameters:
name - Name of the line (suggestion)
l - Name of first point
p - Name of second point
Returns:
Name of the created hyperbolic line.

DPPerpendicularBisector

DPPerpendicularBisector(String name, String a, String b)
Creates the perpendicular bisector of 2 points in the Poincaré disk.

 

Parameters:
name - Name of the perpendicular bisector (suggestion)
a - Name of first point
b - Name of second point
Returns:
Name of the created perpendicular bisector.

DPMidPoint

DPMidPoint(String name, String a, String b)
Creates an hyperbolic midpoint.

 

Parameters:
name - Name of point (suggestion)
a - Name of first point
b - Name of second point
Returns:
Name of the created midpoint.

DPCircle

DPCircle(String name, String a, String b)
Creates an hyperbolic circle in the Poincaré disk.

 

Parameters:
name - Name of the circle (suggestion)
a - Name of center (a point)
b - Name of a point on the circle
Returns:
Name of the created hyperbolic circle.

DPReflexion

DPReflexion(String name, String l, String p)
Creates the image of a point in an hyperbolic mirror.

 

Parameters:
name - Name of the image (suggestion)
l - Name of mirror (an hyperbolic line)
p - Name of point
Returns:
Name of the created image.

DPSymmetry

DPSymmetry(String name, String a, String b)
Creates the hyperbolic symmetric of a point behind another.

 

Parameters:
name - Name of the symmetric (suggestion)
a - Name of center (a point)
b - Name of the point
Returns:
Name of the created symetric.

DPAngleBisector

DPAngleBisector(String name, String a, String o, String b)
Creates an angular bisector in the hyperbolic Poincaré disk.

 

Parameters:
name - Name of the bisector (suggestion)
a - Name of first point
b - Name of vertex
b - Name of second point
Returns:
Name of the bisector (an hyperbolic ray)

DPCommonPerpendicular

DPCommonPerpendicular(String name, String a, String b)
Creates the hyperbolic line which cuts 2 given lines at right angle.

 

Parameters:
name - Name of the line (suggestion)
a - Name of first line
b - Name of second line
Returns:
Name of the created hyperbolic common perpendicular

DDPRay

DDPRay(String name, String a, String b)
Creates an hyperbolic ray.

 

Parameters:
name - Name of the ray (suggestion)
a - Name of vertex
b - Name of a point on the ray
Returns:
Name of the created hyperbolic ray