Create own commands, is that possible?

scampsd shared this question 3 years ago
Answered

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

Comments (7)

photo
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)

photo
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.


If you need more information, just ask.


Simon


The added tool makes a rectangle from two points

https://ggbm.at/2418067

photo
1

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

photo
2

A command-creating command, such as

Tool(toolname,inputlist,outputlist)

would be very useful.

photo
1

It's possible to use a "parametric Execute"

on a "macro string list":

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

photo
1

Hi,

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

photo
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 :-)

photo
© 2019 International GeoGebra Institute