Author Topic: CADCAL vs GeomCAL - the extras: parameters and Lisp-translation  (Read 407 times)

0 Members and 1 Guest are viewing this topic.

berger@archtools.de

  • Mosquito
  • Posts: 12
A new beta version of CADCAL is available . Free download from http://www.archtools.de/cadcal.zip. Installation is simple: extract the zip to any directory, and - if not already done - add this directory to the BricsCAD search path for support files.

Besides full compatibility with GeomCAL CADCAL has some interesting additional CAL functions like PCD(), PCT() for finding points on any curve at a distance from the startpoint or at a defined ratio of the length of the curve, or PGR() for finding the point that divides the distance between two points in the golden ratio. See http://www.archtools.de/cadcal.html for more info.

But now for the really interesting part: CADCAL enables the creation of parametrically defined parts, similar as dynamic blocks, but much easier and straightforward. The DDCAL command stores a history of the CAL calls to calculate the geometry of a drawing part. Open the file NICKSHOUSE-DEF.DWG in the DEMO directory of your CADCAL installation, load CADCAL, and call the command DDCAL, to see, how this ist done. You can export the history to a simple script file, which can be called by the standard SCRIPT command of BricsCAD, or by the CALSCRIPT command. If you use the CALSCRIPT command, then the drawing which is created by the script is parametrical. You can use the CC-MODIFY command to modify the properties. You can move, rotate or copy the CALSCRIPT object, and it still can be modified. See the file HOUSE-DEMO.dwg and play a little with it. Use the CALSCRIPT command to create CASCRIPT objects from scripts.

For programmers: when a CALSCRIPT object ist modified, it keeps its entity name and refhandle, and so it keeps all user defined modifications like layer, color, linetype, UCS, and even XDATA and XDICTIONARIES.

And then you can translate a script to Lisp, which allows you to build applications from CALSCRIPT objects. Use the CALSCRIPT->LISP command to get the resulting Lisp function at the command prompt (for copy&paste to BLADE) or the COMPILESCRIPT command to create a Lisp file. See the NICKSHOUSE.LSP, load it into BricsCAD, and call the NICKSHOUSE command.

Any script file can be translated to Lisp, but the parameters must be defined in the IMPORT() function call. See how this is done in the NICKSHOUSE.SCR. The script file can contain standard script commands like

._LINE !p1 !p2

(please note the empty space after !p2). These standard script commands must be written completely within one line. And of course the script file can contain calls to CAL like in

CAL p1=ORIGIN+[width,height]

And the script can contain Lisp functions like that

(if (< 100 width) (setq rad1 10) (setq rad1 5))

CAL IMPORT(width,100,height,100) has the same result like
CAL WIDTH=100
CAL HEIGHT=100
but CADCAL then knows that WIDTH and HEIGHT are the parameters of the resulting CALSCRIPT object. At the moment the beta version can only use numbers as parameters.