CADCAL
CAD
calculator AddOn to ArchTools
for BricsCAD™ (c) 2024 Tom Berger  all rights reserved 

CADCAL enables you do do very complex calculations with numbers and vectors and
to use the results of these calculations directly as input for your CAD
construction work. Just enter your mathematical formulas, and let CADCAL do
the math for you. CADCAL calculations can replace many complex and time
consuming geometrical help constructions, thus making your CAD work much more
productive. How do you find the intersection point of a 3D line and a 3D
plane today? With CADCAL’s powerful predefined functions it’s just the call
of a simple command (in this case it is ILPE) and showing two points on the
line and three points in the plane. CADCAL is intended to be fully compatible to
Autodesk’s Geomcal application for AutoCAD, but it
has a lot more predefined functions. Similar to Geomcal
CADCAL can also be called from your LISP applications. Simply use the
function CAL or the dialog driven function DDCAL and pass a string with the formula as a parameter, i.e. (CAL
“2+3”). When you have any questions about CADCAL or need
help or support, or if you have ideas for extended functionality, then please
don’t hesitate and send an email to support@archtools.de 

CADCAL Manual 

Installation
CADCAL is delivered either as a ZIP file or a
selfextracting EXE file. Extract this file to any directory and  if not
already done so  add this directory to the search path for support files
of your CAD system. Now you can use any method to load or automatically
load CADCAL as any other Lisp file (LSP, DES, VLX) 

Using CADCAL

predefined numbers 

PI 
the circular constant 3.141…., the ratio of a
circle's circumference to its diameter 

2PI 
shortcut for (2 * PI) 

PI2 
shortcut for (PI / 2) 

PI4 
shortcut for (PI / 4) 

EUL 
the Eulerian number 2.71828…., the base of the
natural logarithm (equal to ln(1)) 

GR 
the Golden Ratio 1.61803399... ) 

simple math 

+ 
addition (numbers only or vectors only) 

 
subtraction (numbers only or vectors only) 

* 
multiplication (numbers and vectors, also mixed for
scalar products like in 2*p1; p1*p2 is the scalar product) 

/ 
division (numbers and vectors, also mixed for scalar
divisions like in p1/2) 

^ 
exponentiation (numbers only) 27^(1/3) is the cubic root of 27 and returns 3 

& 
vector product (vectors only) 

= 
asigns
the result of the expression on the right side of the =sign to the variable
on the left side. myvar=sin(30) asigns
the result of the expression sin(30) to the variable myvar. 

math functions 

SQRT(x) 
returns the square root of x 

EXP(x) 
natural
exponentiation: e^x, whith
e being the Eulerian number 2.71828... 

EXP10(x) 
exponentiation to base 10: 10^x. EXP10(2) returns
100.0 

LN(x) 
the natural logarithm of x 

LOG(x) 
the decimal logarithm of x 

SIN(x) 
the
sine function. The angle x is given in degrees or decimal degrees. 

COS(x) 
the
cosine function. The angle x is given in degrees or decimal degrees. 

TANG(x) 
the
tangent function (TAN is reserved for the tangent osnap). 

ASIN(x) 
the
arcsine function, reverse function of sine. Allowed values are from 1 to 1.
Output in degrees. 

ACOS(x) 
the
arccosine function, reverse function of cosine. Allowed values are from 1 to
1. Output in degrees. 

ATAN(x) 
the
arctangent function, reverse function of tangent. All numbers allowed as
input. Output in degrees. 

ROUND(x) 
rounds x to the next integer: round(1.8) > 2 

TRUNC(x) 
returns the integer part of x: trunc(1.8)
> 1 

REM(x) 
returns the digits behind the decimal point: rem(1.8) > 0.8 

minmax functions 

MIN(n1,n2,n3, ...) 
returns
the smallest value among n1 ...nn. The number of
arguments is not limited 

MAX(n1,n2,n3, ...) 
returns
the highest value among n1 ...nn. The number of
arguments is not limited 

XMIN(p1,p2,p3, ...) 
returns the smallest Xvalue among the vectors
p1,p2,...pn 

XMAX(p1,p2,p3, ...) 
returns the highest Xvalue among the vectors
p1,p2,...pn 

YMIN(p1,p2,p3, ...) 
returns the smallest Yvalue among the vectors
p1,p2,...pn 

YMAX(p1,p2,p3, ...) 
returns the highest Yvalue among the vectors
p1,p2,...pn 

ZMIN(p1,p2,p3,
...) 
returns the smallest Zvalue among the vectors
p1,p2,...pn 

ZMAX(p1,p2,p3, ...) 
returns the highest Zvalue among the vectors
p1,p2,...pn 

XYMIN(p1,p2,p3, ...) 
returns a vector that is composed of the smallest X
and the smallest Yvalue of all vectors p1,p2,p3 ... 

XYMAX(p1,p2,p3, ...) 
returns a vector that is composed of the highest X
and the highest Yvalue of all vectors p1,p2,p3 ... 

cartesian coordinates 

[x,y,z] 
x,y,
and z are numbers. This is a vector that is x units on the Xaxis, y units on
the Yaxis, and z units on the Zaxis from the origin [0,0,0]. 

[x,y] or [x,y,] 
missing zvalue is assumed to be 0.0 

[x] or [x,] or [x,,] 
missing y and zvalues are assumed to be 0.0 

[] or [,] or [,,] 
missing x, y and zvalues are assumed to be 0.0 

[,4] [1] [,2,3] [,,1] 
missing coordinates are assumed to be 0.0 

[1+sin(45),0,0] 
you can also use mathematical expressions for x, y
and zvalues 

[0,0,sin(PI/2)] 
and you can use predefined and user defined variables 

polar coordinates 

[distance<angle] 
polar
coordinates are described by a distance and an angle. Distance and angle can
be given as positiv and negative
numbers. The distance is measured from the origin point,
the angle is measured in degrees or decimal degrees counterclockwiese
from the positive xaxis. The symbol '<' is used to mark the angle. 

[distance<angle<angle] 
polar
coordinates can also be entered as 3D vectors. A second angle is necessary to indicate the angle
out of the XYplane into the direction of the positive zaxis. 

[100<45] 
returns (70.7107 70.7107 0.0) 

[100<45<30] 
returns (61.2372 61.2372 50.0) 

cylindrical coordinates not yet supported! 

using coordinate points from the drawing 

CUR 
asks
the user to pick a coordinate point with the cursor. Current osnap settings are used and can be modified while you are
in pointing mode. The coordinates of the given point in it’s current UCS values will be used in the
mathematical expression the very same way as if it would have been entered
manually. CUR and the following osnap
variants of it will modify the LASTPOINT variable, which can be accessed with
“@”. 

END 
the same as CUR but switches the osnap
mode temporarily to ENDpoint 

INT 
the same as CUR but switches the osnap
mode temporarily to INTersection 

MID 
the same as CUR but switches the osnap
mode temporarily to MIDpoint 

INS 
the same as CUR but switches the osnap
mode temporarily to INSertion point 

CEN 
the same as CUR but switches the osnap
mode temporarily to CENter point 

NEA 
the same as CUR but switches the osnap
mode temporarily to NEArest point 

NOD 
the same as CUR but switches the osnap
mode temporarily to NODe 

QUA 
the same as CUR but switches the osnap
mode temporarily to QUAdrant 

PER 
the same as CUR but switches the osnap
mode temporarily to PERpendicular 

TAN 
the same as CUR but switches the osnap
mode temporarily to TANgent 

LASTPOINT


@ 
the
‘@’ symbol refers to the last entered point in the drawing editor. I.e. when
you created a line with the line command, @ refers to the last point of the
line. All CADCAL functions for coordinate input like CUR, END, INT etc are storing the entered
point in the variable @. CADCAL Functions like MEE, PLD etc. store their resulting
point in @. 

filtering coordinates 

RXOF(p) 
returns the Xvalue of p 

RYOF(p) 
returns the Yvalue of p 

RZOF(p) 
returns the Zvalue of p 

XOF(p) 
returns a vector that is constructed from the
Xvalue of p and 0 for Y and Z 

YOF(p) 
returns a vector that is constructed from the
Yvalue of p and 0 for X and Z 

ZOF(p) 
returns a vector that is constructed from the
Zvalue of p and 0 for X and Y 

XYOF(p) 
returns a vector that is constructed from the X and
Yvalue of p and 0 for Z 

XZOF(p) 
returns a vector that is constructed from the X and
Zvalue of p and 0 for Y 

YZOF(p) 
returns a vector that is constructed from the Y and
Zvalue of p and 0 for X 

@X 
returns the Xvalue of the last point 

@Y 
returns the Yvalue of the last point 

@Z 
returns the Zvalue of the last point 

predefined functions 

distance and length 

DIST(p1,p2) 
distance between points p1 and p2 

DPL(pt,p2,p3) 
distance between point pt
and a line through p2 and p3 

DPP(pt,p2,p3,p4) 
distance between point pt
and a plane through p2,p3 and p4 

ABS(pt) 
length of vector pt 

DEE 
shortcurt
for DIST(end,end) 

PICKLENGTH 
asks to pick an object with a length (a line, arc,
polyline, circle, ellipse, elliptic arc, spline) and returns it's length 

finding intersection points 

ILL(p1,p2,p3,p4) 
returns the intersection point between the line
through p1, p2 and the line through p3, p4 

ILP(p1,p2,p3,p4,p5) 
returns the intersection point between the line
through p1, p2, and the plane through p3, p4, p5 

ILLE 
shortcut for ILL(end,end,end,end) 

ILPE 
shortcut for ILP(end,end,end,end,end) 

calculating coordinate points 

PLD(p1,p2,distance) 
returns the coordinate point that is on the line
between p1 and p2 in the given distance from p1 

PLD(distance) 
same as PLD(end,end,distance) asks the user to show two endpoints p1 and p2 with
the cursor and returns the coordinate point that is on the line between p1
and p2 in the given distance from p1 

PLDEE(distance) 
same as PLD(distance) (for compatibility with Autodesk’s GeomCAL) 

PLT(p1,p2,fraction) 
returns
the coordinate point that is on the line between p1 and p2 and is in a
distance from p1 that is defined by the distance between p1 and p2 and the
given fraction. PLT(p1,p2,1/3) returns the point that is at 1/3 of
the distance between p1 and p2 

PLT(fraction) 
same as PLT(end,end,fraction) asks
to show two points p1 and p2 with the cursor and returns the coordinate point
that is on the line between p1 and p2 and is in a distance from p1 that is
defined by the distance between p1 and p2 and the given fraction. 

PLTEE(fraction) 
same as PLT(fraction) (only for compatiblity
with Autodesk’s GeomCAL) 

PGR(p1,p2) 
returns
the coordinate point that divides the distance between p1 and p2 in the
Golden Ratio.  
PGRE 
aks for two points and returns the coordinate point that divides the distance between in the
Golden Ratio.  
PCD(ename,distance) 
returns
he coordinate point that divides a curve in a given distance from the curve's
start point. The distance is measured along the curve. The ename parameter can be given with the PICK function. The
curve entity can be a line, a polyline, a spline, a circle, an ellipse, an
arc or an elliptic arc. 

PCD(distance) 
same
as PCD(ename,fraction), but the user is asked to
pick a curve entity. This is a shortcut for PCD(pick,distance) 

PCT(ename,fraction) 
returns
he coordinate point that divides a curve at the fraction of the curve's
length. The parameter fraction must be between 0 and 1. 0 returns the startpoint of the curve, 1 returns the endpoint of the
curve. The ename parameter can be given with the
PICK function. The curve entity can be a line, a polyline, a spline, a
circle, an ellipse, an arc or an elliptic arc. 

PCT(fraction) 
same
as PCT(ename,fraction), but the user is asked to
pick a curve entity. This is a shortcut for PCT(pick,fraction) 

PCG(p1,p2,…pn) 
returns the center of
gravity over all points in the list the number of points is not limited 

PCGE 
similar to PCG(end,end,end…end) asks
the user to show points with the cursor. The number of points is not limited.
Returns the center of gravity over all points 

PPL(pp,p1,p2) 
returns
the projection of point pp on a line between p1 and p2. The line between pp
and the projection point is perpendicular on the line between p1,p2, and the
distance between pp and the projection point is the shortest distance between
the line and pp. 

PPP(pp,p1,p2,p3) 
returns
the projection of point pp on a plane through the points p1,p2,p3. The line
between pp and the projection point is perpendicular on the plane, and the
distance between pp and the projection point is the shortest distance between
the plane and pp. 

ROT(rp,origin,angle) 
returns
the point that is the result of the 2D rotation of the point rp around the origin with the given rotation angle. The
angle is given in degrees and/or decimal degrees and is measured counterclockwise. 

ROT(rp,ax1,ax2,angle) 
returns
the point that is the result of the 3D rotation of point rp
around the axis through ax1 and ax2 with the given rotation angle. The angle is
given,in degrees and/or
decimal degrees and is measured counterclockwise. 

MEE or 2EE 
asks
the user to show two endpoints and returns the midpoint between them. MEE is
a shortcut for PLT(0.5) 

3EE 
asks
the user to show two endpoints and returns the triple point between them. 3EE
is a shortcut for PLT(1/3) 

4EE 5EE ….10EE 
similar to 3EE, but shortcut for PLT(1/4) or
PLT(1/5) …. PLT(0.1) 

selecting objects, and getting length, area and radius from objects 

PICK 
asks
the user to pick any drawing element and returns the entity name. You will
probably want to store the entity name in a variable for further use, so PICK
usually is called in a way like that: E1=PICK to store the entity name in
variable E1 

RAD 
asks
the user to pick a drawing element with a radius and returns the radius. The
user can pick circles, arcs and polylines with arc segments. 

PICKLENGTH 
asks
the user to pick a drawing element with a length and returns the length. The
user can pick lines, polylines, splines, circles, arcs, ellipses, elliptic
arcs 

AREA 
asks
the user to pick a drawing element with an area and returns the area. The
user can pick circles, closed and open polylines, closed and open splines,
ellipses, arcs, elliptic arcs, and regions. Open entities like arcs and open
polylines are considered to be closed by a straight line between their
endpoints. 

OBJRAD(ename) 
like
RAD, but you need to give an entity name as an argument. 

OBJLENGTH(ename) 
like
PICKLENGTH, but you need to give an entity name as an argument. 

OBJAREA(ename) 
like
AREA, but you need to give an entity name as an argument. You can use the PICK function to force the
user to pick en entity and store it in a variable,
like in E1=PICK 

angles 

ANG(v 
returns the angle (in degrees or decimal degrees)
between the positive Xaxis and the vector v. 

ANG(p1,p2) 
returns the angle (in degrees or decimal degrees)
between the positive Xaxis and the line through p1,p2 

ANG(apex,p1,p2) 
returns
the angle (in degrees or decimal degrees) between the lines apexp1 and
apexp2. 

vectors 

VEC(p1,p2) 
returns the vector from coordinate point p1 to p2
(same as p2p1) 

VEC1(p1,p2 
returns the normal vector from point p1 to p2 

VEE 
shortcut for vec(end,end) 

VEE1 
shortcut for vec1(end,end) 

normal vectors 

NOR(v) 
returns the normal vetcor
to the vector v 

NOR(p1,p2) 
returns the normal vector to the vector between p1
and p2 

NOR(p1,p2,p3) 
returns the normal vector to the plane through
p1,p2,p3 

NORE 
asks the user to pick an entity and returns the
normal vector to the construction plane of that entity 

NEE 
shortcut for nor(end,end) 

misc 

R2D(rad) 
converts radians to degrees 

D2R(angle) 
converts degrees to radians 

U2W(p) 
converts the point p from the current UCS to WCS 

W2U(p) 
converts the point p from WCS to the current UCS 