v7.0 CSV.lsp — Main Application Entry Point¶
File: src/x86/v7.0(patch)/csv.lsp
Size: 10,384 bytes (281 lines)
Purpose: Main command entry point and application initialization (v7.0 rewrite)
AutoCAD Command: CSV (launches ConstructiVision)
Warning
Major Rewrite from v3.60
This is a complete rewrite with fundamentally different architecture:
? Registration system removed (no licensing enforcement)
? Error handler removed (no work recovery)
? System variables hardcoded (40+ vars, not preserved)
? Module auto-loading (70+ modules via csvlst)
? Functions embedded (pj_name, project now inline)
? Dictionary-based project detection
See: v3.60 vs v7.0 Comparison for detailed differences.
Key Architectural Changes¶
Size & Scope¶
File size: 10,384 bytes (2x larger than v3.60’s 5,186 bytes)
Lines of code: 281 (vs v3.60’s 195)
Complexity: Higher (more embedded logic, hardcoded settings)
Philosophy Shift¶
v3.60: Commercial product, protected VLX, modular, user-friendly
v7.0: Internal/patch version, plain LSP, monolithic, developer-focused
Command Definition¶
C:CSV - Main Application Command¶
Function Signature:
(defun c:csv ()
; Commented out date-based kill switch (circa 1999)
;;(if (>= (getvar "cdate") 19990601)
;; (alert "FATAL ERROR\n\nThe program has been disabled...")
;; (set 'ok "t"))
; Actual initialization...
)
Note: First 7 lines are commented-out date-based expiration check (likely for beta testing).
Initialization Sequence¶
1. System Variable Hardcoding (40+ Variables)¶
v7.0 sets 40+ system variables directly (vs v3.60’s 7-11 preserved variables):
(setvar "lispinit" 0)
(setvar "cmdecho" 0)
(setvar "angbase" 1.5708) ; 90 degrees (North is up)
(setvar "angdir" 1) ; Clockwise angles
(setvar "auprec" 4) ; Angular precision
(setvar "blipmode" 0) ; Disable blip marks
(setvar "celtscale" 1) ; Current entity linetype scale
(setvar "elevation" 0) ; Current elevation
(setvar "expert" 5) ; Suppress all prompts
(setvar "explmode" 1) ; Allow explode
(setvar "facetratio" 1) ; Face mesh density
(setvar "facetres" 5) ; Face resolution
(setvar "filedia" 1) ; Enable file dialogs
(setvar "fillmode" 1) ; Fill polygons
(setvar "grips" 0) ; Disable grips
(setvar "hideprecision" 1) ; Hide precision
(setvar "highlight" 0) ; Disable selection highlighting
(setvar "hpbound" 1) ; Hatch boundary retention
(setvar "isolines" 4) ; Number of isolines
(setvar "lunits" 4) ; Architectural units
(setvar "luprec" 4) ; Linear precision
(setvar "orthomode" 0) ; Ortho off
(setvar "osmode" 0) ; Object snap off
(setvar "pickbox" 0) ; Pickbox size 0
(setvar "regenmode" 0) ; Manual regen
(setvar "shadedge" 1) ; Shade edges
(setvar "shadedif" 10) ; Shade diffuse
(setvar "snapmode" 0) ; Snap off
(setvar "textstyle" "standard")
(setvar "thickness" 0)
(setvar "ucsfollow" 0) ; Don't follow UCS
(setvar "ucsicon" 0) ; Hide UCS icon
(setvar "visretain" 1) ; Retain xref visibility
(setvar "xrefctl" 0) ; External reference control
; Dimension variables
(setvar "dimzin" 3) ; Zero suppression
(setvar "dimunit" 6) ; Architectural units
(setvar "dimaltu" 6) ; Alt units architectural
(setvar "dimse1" 0) ; Suppress extension line 1
(setvar "dimse2" 0) ; Suppress extension line 2
(setvar "dimsd1" 0) ; Suppress dimension line 1
(setvar "dimsd2" 0) ; Suppress dimension line 2
(setvar "dimtad" 0) ; Text above dimension line
(setvar "dimtvp" 0) ; Text vertical position
(setvar "dimtih" 0) ; Text inside horizontal
(setvar "dimtix" 1) ; Text inside extensions
(setvar "dimjust" 0) ; Dimension justify
(setvar "dimtofl" 1) ; Dimension line inside
(setvar "dimfit" 5) ; Text/arrow fit
(setvar "dimsoxd" 0) ; Suppress outside extension
(setvar "dimtoh" 0) ; Text outside horizontal
(setvar "dimdli" 0) ; Dimension line increment
(command "osnap" "off") ; Turn off object snaps
Impact:
?? User preferences NOT preserved (vs v3.60’s preservation)
?? No restoration on exit (vs v3.60’s error handler)
? Ensures consistent ConstructiVision environment
? User must manually restore their settings
2. Embedded Function: pj_name() (40 lines)¶
Extracts project name from directory path:
(defun pj_name ()
; Extract project name from curdir path
(set 'n (1- (strlen curdir)))
(while (/= (substr curdir n 1) "\\") (set 'n (1- n)))
(set 'pjname (substr curdir (1+ n) (- (strlen curdir) n 1)))
; Filter out special characters from panel name
(set 'n (strlen pjname))
(set 'x "")
(set 'pnlname (substr pjname 1 1))
(while (> n 0)
(set 'n (1- n))
(set 'x (substr pjname (- (strlen pjname) n) 1))
(if (= x " ")
(progn
(set 'x (substr pjname (- (strlen pjname) n -1) 1))
; Check if next char is valid (not [ ] { } * ^ % # ` @ / \ & ' > < | ! ~ ( ) +)
(if (not (or (= x "[") (= x "]") (= x "{") (= x "}")
(= x "*") (= x "^") (= x "%") (= x "#")
(= x "`") (= x "@") (= x "/") (= x "\\")
(= x "&") (= x "\" ") (= x "'") (= x ">")
(= x "<") (= x "|") (= x "!") (= x "~")
(= x "(") (= x ")") (= x "+")))
(set 'pnlname (strcat pnlname x))))))
; Ensure panel name is 3-5 characters
(if (< (strlen pnlname) 3)
(set 'pnlname (substr pjname 1 5)))
(if (> (strlen pnlname) 5)
(set 'pnlname (substr pjname 1 5)))
)
Purpose:
Creates short panel prefix from directory name
Filters invalid characters (AutoCAD block name restrictions)
Ensures 3-5 character length
Example: “My Project Files” ? “MPF” or “MProj”
v3.60 Difference: This was an external file (PJ_NAME.lsp), now embedded.
3. Embedded Function: project() (30 lines)¶
Project selection dialog:
(defun project ()
(set 'dcl_id27 (load_dialog "project.dcl"))
(if (not (new_dialog "project" dcl_id27))
(exit))
(action_tile "help" "(help \"csv.hlp\" \"Project\")")
(start_dialog)
(unload_dialog dcl_id27)
; Handle user selection
(cond
((= pnl "old")
(while (or (= acaddir curdir) (= curdir ""))
(set 'curdir
(getfiled "Double click the location of your Existing Project, then click SAVE."
"new panel" " " 1))
(if curdir
(progn
; Extract directory from selected file
(set 'n (strlen curdir))
(while (/= (substr curdir n 1) "\\") (set 'n (1- n)))
(set 'curdir (substr curdir 1 n))
(dirchk) ; Check if valid directory
(if x
(progn
(alert
(strcat "\n" curdir
"\nis an AutoCAD program directory.\n\n
If you have already put your Project Files here,\n
please move them to a new directory,\n
otherwise select a different directory."))
(set 'curdir "")))))))
((= pnl "new") (new)))
)
Purpose:
Loads project.dcl dialog
User selects existing project or creates new
Validates directory (can’t be AutoCAD install dir)
Calls
dirchk()to verify
v3.60 Difference: This was an external file (PROJECT.lsp), now embedded.
4. Module List Definition (70+ Modules)¶
Complete module list defined inline:
(set 'csvlst '("bp_dlg" "bpauto" "brace" "btch" "btch_dlg" "calc_dlg"
"centgrav" "ch_dlg" "chamfer" "chrchk" "convert" "dbchk"
"dirchk" "dl_dlg" "donerev" "dowels" "dr_dlg" "drawdim"
"drawpan" "dwgnew" "dwgold" "enable" "err" "feature"
"fenable" "fh_dlg" "finpan" "fpage" "fs_dlg" "fv_dlg"
"green" "grid_dlg" "inspanel" "invar" "layout" "lb_dlg"
"let_dlg" "ll_dlg" "matl_dlg" "md_dlg" "miter" "mkblk"
"mp_dlg" "new" "newlist" "num_dlg" "opening" "panatt"
"panel" "pdisable" "pick" "pl_dlg" "plt" "points" "pp_dlg"
"ppauto" "ppcent" "rangchck" "rb_dlg" "renpan" "revision"
"rndblock" "ro_dlg" "savelay" "sb_dlg" "sbenable" "scr"
"sd_dlg" "sdwg_dlg" "site_dlg" "slide" "ss_dlg" "strlsort"
"thick" "tiltup" "tp_dlg" "ts_dlg" "updvar" "warning"
"wc_dlg" "wc_edit" "wcenable" "wclist" "wcpage" "wd_dlg"
"wdenable" "wdpage" "weldconn" "wall_dlg" "slab_dlg"
"footing" "column" "weld"))
Purpose:
70+ module names explicitly listed
Used for auto-loading (see below)
Used for ARX function export (see below)
Provides complete module inventory
v3.60 Difference: No explicit module list (VLX LOAD directive handles it).
5. Mass Function Export (70+ Functions)¶
Export ALL functions to ARX namespace:
(set 'ok nil)
(foreach a (arx)
(if (or (wcmatch a "*vlide*") (wcmatch a "*csv*"))
(set 'ok "t")))
(if ok
(progn
(vl-acad-defun 'wall_dlg)
(vl-acad-defun 'slab_dlg)
(vl-acad-defun 'footing)
(vl-acad-defun 'column)
(vl-acad-defun 'weld)
; ... 70+ more vl-acad-defun calls ...
(vl-acad-defun 'weldconn)
)
; If no ARX/VLISP environment, auto-load all modules
(if (not panatt)
(foreach a csvlst (load a)))
)
Purpose:
Checks if VLISP/ARX environment available (
vlideorcsvARX loaded)If yes: Export all 70+ functions to ARX namespace
If no: Auto-load all modules from csvlst
Allows ARX modules to call any LISP function
v3.60 Difference: Only 6 functions exported (minimal ARX interop).
6. Simplified Batch File Creation¶
v7.0 batch files simpler (no date stamp):
; cv.bat - directory creation
(if (not (findfile (strcat acaddir "cv.bat")))
(progn
(set 'f (open (strcat acaddir "cv.bat") "w"))
(princ "@echo off\n" f)
(princ "cd\\\n" f)
(princ ":crd\n" f)
(princ "if %1 == \"end\" goto end\n" f)
(princ "if not exist %1\\nul md %1\n" f)
(princ "cd %1\n" f)
(princ "shift\n" f)
(princ "goto crd\n" f)
(princ ":end\n" f)
(close f)))
; cvplst.bat - panel list generation
(if (not (findfile (strcat acaddir "cvplst.bat")))
(progn
(set 'f (open (strcat acaddir "cvplst.bat") "w"))
(princ "@echo off\n" f)
(princ "cd %1\n" f)
(princ "dir %2 /-p/od/-v > pnllist.txt\n" f)
(princ "dir pnllist.txt /-p/-v\n" f)
(close f)))
v3.60 Difference:
? No date stamp in cv.bat (no trial period tracking)
? No version check (no recreation if format changes)
? Simpler logic (just check if file exists)
7. Dictionary-Based Project Detection¶
v7.0 uses AutoCAD named object dictionary:
(set 'curdir (getvar "dwgprefix"))
(if (= (getvar "dwgname") "Drawing.dwg")
(set 'olddwg nil)
(set 'olddwg (getvar "dwgname")))
; Check for project directory
(if (or (= acaddir curdir) (= olddwg nil))
(project))
; Check dictionary for existing project data
(if (and (/= pnl "autonew") (/= pnl "autoold") (/= xx "new"))
(cond
((dictsearch (namedobjdict) "panel_list")
(pj_name) (md_dlg)) ; Panel project found
((dictsearch (namedobjdict) "site_list")
(pj_name) (site_dlg)) ; Site project found
(t (pj_name) (md_dlg))) ; No project, show main dialog
(set 'ld "pt"))
Purpose:
Checks AutoCAD’s named object dictionary for project metadata
panel_listentry = panel projectsite_listentry = site projectMore robust than file-based detection
v3.60 Difference: File-based detection (checks dwgname only).
8. Simplified Launch Logic¶
v7.0 launch sequence:
; Handle auto modes
(cond
((= pnl "autonew") (set 'pnl "new"))
((= pnl "autoold") (set 'pnl "old")))
; Launch appropriate dialog
(cond
((= ld "pt") (pj_name) (panel)) ; Panel template
((= ld "ps") (scr "panel")) ; Panel script
((= ld "st") (pj_name) (sdwg_dlg)) ; Site template
((= ld "ss") (scr "site")) ; Site script
((and (not ld) (/= pnl "autoold") (/= pnl "autonew"))
(set 'pnl nil)))
(setvar "pickbox" 5) ; Restore pickbox size
(princ)
v3.60 Difference:
? No error recovery check (panelvar/sitevar)
? No recovery dialogs
? Simpler conditional logic
? Dictionary-based routing
What’s Missing from v7.0¶
1. No Error Handler¶
; v3.60 had:
(defun *error* (msg)
; ... work recovery, variable restoration ...
)
; v7.0: NONE - crashes lose all unsaved work
2. No Registration/Licensing¶
; v3.60 had:
(arxload "pcms2")
(CheckPanelCredit)
; ... trial period, wincss.exe launcher ...
; v7.0: COMPLETELY REMOVED - free to use
3. No System Variable Preservation¶
; v3.60 had:
(set 'sysvarlist (list original values))
; ... restore in *error* handler ...
; v7.0: Just sets them, never restores
Module Organization¶
v7.0 Module Loading Strategy¶
Conditional Loading:
(if ok ; ok = ARX environment detected
; Export all functions to ARX
(progn (vl-acad-defun 'wall_dlg) ...)
; Else: Auto-load all modules
(if (not panatt)
(foreach a csvlst (load a))))
Modules by Category:
Dialog Boxes (40+):
bp_dlg, btch_dlg, calc_dlg, ch_dlg, dl_dlg, dr_dlg, fh_dlg, fs_dlg, fv_dlg
grid_dlg, lb_dlg, let_dlg, ll_dlg, matl_dlg, md_dlg, mp_dlg, num_dlg
pl_dlg, pp_dlg, rb_dlg, ro_dlg, sb_dlg, sd_dlg, sdwg_dlg, site_dlg
ss_dlg, tp_dlg, ts_dlg, wc_dlg, wd_dlg, wall_dlg, slab_dlg
Automation:
bpauto, ppauto, ppcent
Drawing Operations:
drawdim, drawpan, inspanel, layout, mkblk, slide
Features:
brace, chamfer, column, dowels, footing, miter, opening, weld, weldconn
Utilities:
chrchk, convert, dbchk, dirchk, rangchck, strlsort, pick, points, thick
Project Management:
dwgnew, dwgold, finpan, new, newlist, panel, panatt, renpan, revision
Enable/Disable:
enable, fenable, sbenable, wcenable, wdenable, pdisable
Lists:
wclist, wcpage
Editing:
wc_edit
Output:
plt, scr
System:
err, feature, green, invar, savelay, tiltup, updvar, warning
Modernization Implications¶
Why v7.0 is Better for P3/P4¶
No Registration Complexity
No ARX dependencies for licensing
No wincss.exe launcher
Simpler deployment
Plain LSP Source
Easier to modify than VLX
Can diff/merge changes
Better for version control
Module Inventory
csvlst provides complete module list
Easier to audit what needs migration
Clear dependency map
Dictionary-Based Detection
More robust than file-based
Works with modern AutoCAD
Cloud-compatible approach
What to Restore from v3.60¶
Error Handler
Work recovery critical
System variable restoration
User experience essential
Variable Preservation
Don’t hardcode 40+ variables
Preserve user preferences
Restore on exit
Modern Licensing
Cloud-based token validation
No local ARX dependencies
Online activation
Document Metadata¶
Created: 2025
Version: v7.0 (patch version)
File Size: 10,384 bytes (281 lines)
Complexity: Very High (embedded functions, mass exports, hardcoded settings)
Completeness: 100%
Key Insight: v7.0 is a developer-focused rewrite that removes commercial features (registration, error recovery) in favor of simplicity and openness. Better for modernization but needs best practices restored from v3.60.
End of Document