Back HomeBack to DocumentsBack to D-I-E-S-E-LYou are here
DIESEL Reference


DIESEL Reference

VG-Wort Access-ZählmarkeHere is a reference to all DIESEL functions:

Math

+
$(+,1,1) ==> 2
allows between 2 and 9 arguments to add
-
$(-,3,1) ==> 2
allows between 1 and 8 numbers to subtract from the first argument
*
$(*,2,2) ==> 4
allows between 2 and 9 arguments to multiply
/
$(/,8,2) ==> 4
divides the first number by the second to ninth argument

Comparision

All logical functions return 1 for true and 0 for false.

if
$(if,predicate,
  then,else)
 ==> then
returns then if first argument evaluates to anything not equal to 0, otherwise returns optional else argument
=
$(=,1,1) ==> 1
numerical comparision
eq
$(eq,this,that)
 ==> 0
string comparision
!=
$(!=,8,2) ==> 1
numerical not-equal
>
<
>=
<=
$(>=,3,1) ==> 1
numerical comparision
and
or
xor
$(and,1,0) ==> 0
logical concatenation, each function allows up to nine arguments

Conversion

angtos
$(angtos,1,1,2)
 ==> 57d18'
converts a real number (angle in radians) to a string (angle display format).
First argument: angle, second (optional) argument: display format (0: decimal degrees, 1: degrees/minutes/seconds, 2: grads, 3: radians, 4: surveyor), third (optional) argument: precision (number of decimals where appropriate, include minutes/seconds else)
fix
$(fix,1.3) ==> 1
converts real number to integer by omitting decimals
rtos
$(rtos,2,1,2)
 ==> 2.00E+00
converts a real number to its display format.
First argument: number, second (optional) argument: display format (1: exponential, 2: decimal, 3: engineering, 4: architectural, 5: fractional), third (optional) argument: precision (number of decimals or lowest denominator)
upper
$(upper,hello)
 ==> HELLO
converts lower case letters to upper case
edtime
$(edtime,
  2452000.0,
  D.M.YYYY)
 ==> 31.3.2001
converts a real number to a date-formatted string.
First argument: number representing a Julian date in AutoCAD, e.g. as returned by $(getvar,DATE), or a UNIX date in the original source. If zero, uses the time/date the macro was started.
Second argument: sequence of formatting codes ex (D: day, DD: day with leading zero, DDD: day of week short, DDDD: day of week long, M: month, MO: month with leading zero, MON: month name short, MONTH: month name long, YY: year two places, YYYY: year four places, H: hour, HH: hour with leading zero, MM: minutes, SS: seconds, MSEC: milliseconds, AM/PM: upper case AM or PM;, am/pm: lower case am or pm, A/P: upper case A or P, a/p: lower case a or p)

Indexing

These two functions allow you to select a choice depending on an index number.

nth
$(nth,1,a,b)
 ==> b
returns the nth element. The second argument is element 0, the third is element 1, a.s.o. Up to eight elements are allowed.
index
$(index,1,"a,b")
 ==> b
like nth, but here the elements are in a single string and separated by commas.

String processing

strlen
$(strlen,Hi) ==> 2
returns the number of characters in the string
substr
$(substr,Hi,2)
 ==> i
returns the substring starting with the character position given in the second argument. The first character has position 1. An optional third argument defines the number of characters to return.
strfill
$(strfill,Hi,5)
 ==> HiHiHiHiHi
creates a string of <second argument> copies of <first argument>. (Original source only)

Inquiry functions

getenv
$(getenv,Test)
 ==> Testvalue
returns a value set by SETENV
getvar
$(getvar,MACROTRACE)
 ==> 0
returns the current value of a system variable
linelen
$(linelen) ==> 240
returns the maximum number of characters DIESEL can display from the MODEMACRO command
getprop
$(getprop,subject)
 ==> DIESEL Demo
returns the value of a drawing property as set by File>Drawing Properties. Properties to be retrieved are: Title, Subject, Author, Comments, Keywords, LastSavedBy, and Revno. To retrieve a property from the Custom tab, write % followed by the name of the custom property. (RText only)
xrefs
$(xrefs) ==> none
returns a string concatenated from the descriptions of all xrefs in the drawing. The optional second argument is written in front of, the optional third argument (default: new line) is appended to the xref description. The xref description is created from the xref file name and block name depending on the value of the optional first argument, which is the sum of (1: display file name, 2: display block name, 4: no extension, 8: no path, 16: display nesting). Default is 1. (RText only)
images
$(images) ==> none
returns the corresponding string for image files. The second and third argement are like with $(xrefs), the first argument is just the sum of the codes 8 and 16 above. (RText only)
getrec
$(getrec,DWGPROPS,2)
 ==> Title
returns a field from an extension record attached to an object in the named object dictionary. (RText only)
time
$(time)
 ==> 123456.78
returns the current date and time in UNIX fashion, i.e. by the number of seconds since beginning of 1970. (Original source only)

DIESEL evaluation

eval
$(eval,"$(+,1,1)")
 ==> 2
evaluates the DIESEL expression passed as the argument. Needed if you retrieve a DIESEL expression from $(getenv and want it interpreted.

This is a shareware document. What is a shareware document? Did this article help you earn some money? Then give something back! Help creating shareware documents by donating something to the author:


Contact CR/LF GmbH

© 1999-2011 by CR/LF GmbH, Essen/Germany. All rights reserved.
No part of this document may be reproduced or published without written consent by CR/LF GmbH.
Last modification: 01.04.2011