-
- ;;; Table.lsp
- ;;;
- ;;; Permission to use, copy, modify, and distribute this software and its
- ;;; documentation for any purpose and without fee is hereby granted.
- ;;;
- ;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
- ;;; ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
- ;;; MERCHANTABILITY ARE HEREBY DISCLAIMED.
- ;;;
- ;;; Copyright© Roy Everitt
- ;;; February, 2000
- ;;;
- ;;; Note: Older versions of Autocad will not recognize the *error* function. You will
- ;;; need to replace the (defun-q *error* (msg) statement with (defun *error* (msg).
- ;;;
- ;;; Generate a Table or Chart using a combination of the "dimtxt" and "dimscale"
- ;;; settings from the Autocad drawing to determine the appropriate table text sizes.
- ;;; The only known limitations for the size of table (I.E. number of rows and
- ;;; number of columns) is the input dialogs. Generally, depending on the size of
- ;;; your monitor and the screen resolution settings, a 10 X 10 matrix, (default) will not
- ;;; exceed Autocad's ability to build the edit box dialogs and display them for input.
- ;;; Keep this in mind if you get any dialog errors. Try smaller row and column input
- ;;; combinations, until you can determine what your system's display limitation is.
- ;;; The 10 X 10 matrix limit established from the popup list can be increased to whatever
- ;;; your preferences might be, by adjusting the popup list values in the "set_row" &
- ;;; "set_col" functions.
- ;;; The edit_box defaults for row and column inputs have been set to an edit_width of
- ;;; (7) and an edit_limit of (20). You can adjust these settings to enhance the dialog
- ;;; input capabilities for various screen size and resolution limitations as well.
- ;;; The program gives you the ability to input the (body) of matrix text, by using the
- ;;; tab key, (by default), to step through row and column input.
- ;;; For those who prefer to input the (body) of matrix text, by columns, the program will
- ;;; also allow you to step through input by columns. Place the cursor at the top of each
- ;;; column, then use the return (enter) key to move down to the next row for input.
- ;;;
- ;;; The program also generates a custom DCL file (temp.dcl) that is re-written each
- ;;; time it is executed. The code may be changed so that temp.dcl is written to, and
- ;;; found in any user preferred folder, as long as that folder is in the Support Files
- ;;; Search Path.
- ;;; Note: By default, it will be written in your Autocad Working Directory, (wherever
- ;;; your shortcut or "Start In" Icon is set up to work).
- ;;; Example: Look for the code: (setq fd (open "temp.dcl" "w"))
- ;;; Change it to: (setq fd (open "c:\\myfolder\\temp.dcl" "w"))
- ;;; Look for the code: (close (open "temp.dcl" "w") )
- ;;; Change it to: (close (open "c:\\myfolder\\temp.dcl" "w") )
- ;;; Look for the code: (if (< (setq *Tableid* (load_dialog "temp.dcl")) 0)
- ;;; Change it to: (if (< (setq *Tableid* (load_dialog "c:\\myfolder\\temp.dcl")) 0)
- ;;; (Where "myfolder" is your designated folder name)
- ;;;=================================================================================
- (princ "\Table program loading...")
- (defun
- C:TABLE (/ CR DLG_CLOSE DLG_HEADER DLG_DIALOG DLG_ITEM DLG_PROTO
- DLG_ATT SYMTOS DCL_TEMP DCL_MATRIX DCL_MATRIX_HED SET_COL
- GET_COL SET_ROW GET_ROW GET_QTY CHECK_NEXT
- SET_NEXT_MATRIX_ITEM TOGG_ASSOC OL OS OC DLG_MAIN
- DELETE_TEMP_DCL DLG_MATRIX DLG_MATRIX_HEAD GET_MATRIX
- GET_MATRIX_HEAD DRAW_TABLE DRAW_TABLE_HEAD *TABLEID* FD
- ROW_NDX COL_NDX COL_QTY COL_NUM COL_INPUT NO_OF_COLS ROW_QTY
- ROW_NUM ROW_INPUT NO_OF_ROWS FLAG NEXT_MATRIX TOG_VALUE INCL
- DCL_ID TITLE DS OSMODE CECOLOR CLAYER SCALE SIZE HALFSIZE
- TITLESIZE SP CNT TOTAL_WIDTH TOTAL_HEIGHT
- )
- ;;;;;Main dialog control functions;;;;
- (defun CR () (princ "\n" FD))
- (defun DLG_CLOSE () (princ "}" FD) (CR))
- (defun
- DLG_HEADER (AUDIT)
- (princ "dcl_settings : default_dcl_settings {" FD)
- (CR)
- (princ (strcat " audit_level = " (itoa AUDIT) "; }") FD)
- (CR)
- ) ;_ end of defun
- (defun DLG_DIALOG (NAME) (princ (strcat NAME " : dialog {") FD) (CR))
- (defun DLG_ITEM (ITEM) (princ (strcat ": " ITEM "{") FD) (CR))
- (defun DLG_PROTO (type) (princ (strcat type ";") FD) (CR))
- (defun
- DLG_ATT (ATT VAL)
- (cond
- ((= (type VAL) 'INT)
- (princ (strcat ATT "=" (itoa VAL) ";") FD)
- (CR)
- )
- ((= (type VAL) 'REAL)
- (princ (strcat ATT "=" (rtos VAL) ";") FD)
- (CR)
- )
- ((= (type VAL) 'STR)
- (princ (strcat ATT "="" VAL "";") FD)
- (CR)
- )
- ((= (type VAL) 'SYM)
- (princ (strcat ATT "=" (SYMTOS VAL) ";") FD)
- (CR)
- )
- ) ;_ end of cond
- ) ;_ end of defun
- (defun
- SYMTOS (SYM / FD)
- (setq FD (open "symtos.txt" "w"))
- (princ SYM FD)
- (close FD)
- (setq
- FD (open "symtos.txt" "r")
- SYM (strcase (read-line FD) t)
- ) ;_ end of setq
- (close FD)
- SYM
- ) ;_ end of defun
- (defun
- DCL_TEMP (/ FD)
- (setq FD (open "temp.dcl" "w"))
- (DLG_HEADER 0)
- ;;;Define Main Dialog;;;
- (DLG_DIALOG "dlg_main")
- (DLG_ATT "label" "Table Matrix Selection")
- (DLG_ITEM "text_part")
|