CADCAL: final beta version before release

CADCAL now has all the planned functionality, and according to first tests it works fine. More testing is necessary, and I will use the next weeks to write a documentation/manual and set up a web site. The current version "1.0 beta" is attatched to this post and is downloadable for free from www.cadcal.de/cadcal.zip.

Installation is simple: just extract the ZIP to any directory and add this directory to the search path for support files of AutoCAD or BricsCAD. When you already have an acaddoc.lsp (AutoCAD) or an on_doc_load.lsp (BricsCAD) in use, then you need to merge your existing acaddoc.lsp/on_doc_load.lsp with the corresponding file in your CADCAL installation directory.

You can play around with the dwg files and scripts in the ./demo subdirectory of the CADCAL installation directory, and of course you can create your own scripts and CALScript objects and use that for your daily work. See the ./demo/bookcase.scr for a rather complex CALScript object, which - besides the cc-import declaration - also uses a cc-overwrite declaration, which overwrites the objects properties in case of object communication by the corresponding master's properties, and which uses the cc-export declaration to export a material list for the manufacturerer of that bookcase. Use (xdata-get (car (entsel)) "CALSCRIPT") to see the selected object's properties and the export data.

A very simple sample shows you how you can use your existing Lisp functions and make them smarter by wrapping them into a CADCAL script. Most AutoCAD/BricsCAD users propably have many Lisp tools similar to the following to make their drafting work easier. Any function that can be called from Lisp or as a CAD command can be used. Here is a small sample that takes the arguments insertion point, width, depth and height, and creates the 2D representation of a bookcase with that values:

  1. (defun simple (p1 wd dp ht / p1 p2 p3 p4 txtpt)
  2.   (setq p2 (list (+ (car p1) wd) (cadr p1))
  3.         p3 (list (car p2) (+ (cadr p2) dp))
  4.         p4 (list (car p1) (+ (cadr p1) dp))
  5.                 txtpt (list (+ (car p1) 10) (+ (cadr p1) 10))
  6.   )
  7.   (command "._pline" p1 p2 p3 p4 "_cl")
  8.   (command "._line" p1 p3 "")
  9.   (command "._line" p2 p4 "")
  10.   (command "._text" txtpt 50 0 (vl-prin1-to-string ht))


This simple code (or any other really very complex function) can very easily be wrapped in a CALScript object. Just create a script file with that content:

  1. cc-import width,800,depth,320,height,2020
  2. (simple origin width depth height)

And really: his is all you need to do! The CC-IMPORT declaration is used to give the script file the arguments it needs. The ./demo/simplesample.scr script just has a line "(if (not simple) (load "./demo/simple.lsp"))" to ensure that the simple.lsp is loaded, and has a cc-overwrite declaration to show the effect  of object communication.

Now just let CADCAL execute this script using the CALSCRIPT command. You will be asked for intertion point, rotation, and the arguments defined by the CC-IMPORT declaration, and the CALScript object will be created. But other with the drawing created from the pure Lisp, the CALScript object will be editable afterwards. Use the CC-MODIFY command and select this object. Even copies of that object will remain editable, and of course you can move, rotate, copy, mirror, scale this objects, and they will remain editable. You even can give a dwg file containing CALscript objects, and the receiver can also modify these, when he has the free
CADCAL installed.

These objects can also use inter-object communication. See the ./demo/switch-and-lamp.dwg and ./demo/nickshouse-comm.dwg to see how CALScript objects can interact by communication, which simply is created with the CC-CONNECT command. In the ./demo/nickshouse-comm.dwg you can see how the CALSCript reactor let's the CALScript objects react on CAD commands like MOVE, ROTATE etc ...

Executing a CALScript script is a completely

different thing from executing a standard CAD script. The CALSCRIPT command first translates the script into a full working Lisp, and then executes this Lisp, and stores this with the created object. This means that CALScript scripts even can process functions which require user input, what the standard SCRIPT command can't do. And when a CALScript object is modified, it executes this Lisp again and doesn't need the script file anymore. Test this:
(setq myfun (C:CALSCRIPT->LISP))
This translates the script file to a Lisp function, which can be used in your own applications. Just see the ./demo/nickshouse.lsp how this can be done.

Play a little with the demo files, have fun, and let me know what you think of this app. And please report any problems whith this final beta version.