# Create own commands, is that possible?

scampsd shared this question 3 years ago

Good morning,

I'm working on a computer program, which can easily give output about the rectangles which are used. This output is given in the form of (bottom, left, top, right), which can ealisy be converted into the format (bottom, left)->(top, right). I would like to create a Geogebra command "Rectangle", using the mentioned points. My intention is to put this command in the "Input" box.

I could write a script for that, but it seems that using a script function in the "input" box is not possible (or at least I don't know how to do it).

For your understanding, the script function would look like:

function Rectangle (b, l, t, r)

{

Polygon[(b,l), (b,t), (r,t), (r,b)];

}

Does anybody know how to do this?

Thanks

1

(Sorry, I have made one error in my description : the points, defining the rectangle, are of the form (left, bottom), and (right, top). (I've been mixing up X- and Y- coordinates)

1

Hi,

You can create your own tool http://www.geogebra.org/wiki/en/Tools_Menu. Once you have created your tool "Rectangle" its name can then be used as a command, as long as the tool is available in that ggb file.

Simon

The added tool makes a rectangle from two points

https://ggbm.at/2418067

1

Thanks a lot, this was exactly what I was looking for.

2

A command-creating command, such as

Tool(toolname,inputlist,outputlist)

would be very useful.

1

It's possible to use a "parametric Execute"

on a "macro string list":

An example: ▶ http://tinyurl.com/exepar

1

Hi,

Thanks. Very interesting! Please give a simple example of implementation in a ggB file.

1

In ggb files "custom tools" are well indeed available;

it doesn't make so much sense to show the use of "webbed forks"

where spoons have been provided with the soups :-)