Next: Formulae Up: Functions Previous: SISCAD-P Functions

### User Defined Functions

You may also define your own functions within SISCAD-P.
These functions are, like the variables, also CAD objects and are processed with the commands CREATE FUNCTION and/or DELETE FUNCTION. During the creation process the characterization is decisive for the type of the function, i.e. whether the result of the function is a number, a text, a co-ordinate.
The expected value for the function is a formula which at least has one free parameter. The parameter is defined with the character '@' that is followed by the consecutive parameter number.
3 examples:

1. Example (number function): With the command

   > CREATE FUNCTION N NUMB=2#TEX2HTML_WRAP785#@1;NA=TWICE!

   a function TWICE is defined, which multiplies an entered number by 2. This function can be used for all number parameters.

2. Example (co-ordinate function): A function SPECIAL shall be created, with the help of which a point is created the Y co-ordinate of which is twice as much as the given X value.
   By using the number function TWICE (see the first example) the command then reads

   > CREATE FUNCTION C COORD=@1,TWICE(@1);NA=SPECIAL!

   With the following command

   > CREATE LINE PP PNT1=SPECIAL(100);PNT2=SPECIAL(150)!

   a line between the points (100,200) and (150,300) is then created.
3. Example (text function): A function INFOTXT shall be created which creates the text "length: ..." after entering a line. For ... the length of the line shall be inserted automatically.
   The following proceedings are possible:

   > CREATE FUNCTION T TXT=TCAT(;TEX2HTML_HTML_SPECIAL_MARK_QUOT;length: ;TEX2HTML_HTML_SPECIAL_MARK_QUOT;;CONVN2T(LINLEN(@1);2));NA=INFOTXT!
   > CREATE TEXT L PNT=<pos>; TXT=INFOTXT(<id>)!

   After calling the function INFOTXT an existent line has to be identified. The length of this line is calculated within SISCAD-P and then inserted into the text to be put out.