home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 15
/
BUGCD1998_06.ISO
/
aplic
/
felixcad
/
fcaddata.z
/
FLX_TABL.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1996-10-01
|
23KB
|
612 lines
;;; FLX_TABL.LSP
;;; ======================================================================
;;; (C)opyright Felix Computer Aided Technologies GmbH 1995-96
;;; Created: Dec 10, 1995 / dn
;;; Changed: Sep 30, 1996 / vp
;;; ======================================================================
;;; SYMBOL TABLES
;;; Start und end routine defined in flx_main.lsp
;;; ======================================================================
;;; LBOX_MODE : 1=Selection menu | 0=Table is displayed
;;; ======================================================================
(defun FLX_TABLES ( / POINT2S
FIND_OSMODES
DISP_VIEWPAR
TABLE_LAYER
TABLE_LTYPE
TABLE_STYLE
HPARAMETER
TABLE_DIMSTYLE
TABLE_BLOCK
DISP_REFBLOCK
TABLE_UCS
TABLE_VPORT
TABLE_VIEW
TABLE_LIST
DISP_TABLE
FIRST_LIST
DlgInit
TAB SEPARATOR prt_list s1 lst1 lst
LBOX_MODE)
;;; ----------------------------------------------------------------------
(defun POINT2S (p_list / p_list retval)
(setq retval (strcat
(rtos (nth 0 p_list))
"," (rtos (nth 1 p_list))
(if (nth 2 p_list)
(strcat "," (rtos (nth 2 p_list)))
""
)
))
)
;;;---------------------------------------------------------------------------
;;; FIND_OSMODES is used in DISP_VIEWPAR
(defun FIND_OSMODES ( / ret SnapSL SnapZL SnapML)
(setq z 0)
(setq SnapSL '())
(setq SnapZL (list 1 2 4 8 16 32 64 128 256 512 1024))
(setq SnapML (list
(nth 90 prt_list) (nth 91 prt_list) (nth 92 prt_list)
(nth 93 prt_list) (nth 94 prt_list) (nth 95 prt_list)
(nth 96 prt_list) (nth 97 prt_list) (nth 98 prt_list)
(nth 99 prt_list) " "
))
(foreach el SnapZL
(if (= (logand el (getvar "OSMODE")) el)
(setq SnapSL (append SnapSL (list (strcat "\t\t" (nth z SnapML)))))
)
(setq z (+ z 1))
)
(if (not SnapSL)
(setq ret (list (nth 12 prt_list))) ;;;@\t\t--- None ---
(setq ret SnapSL)
)
(setq ret ret)
)
;;;---------------------------------------------------------------------------
;;; TABLE Return Lists
;;;---------------------------------------------------------------------------
;;; TABLE General Settings
;;;---------------------------------------------------------------------------
(defun DISP_VIEWPAR ( / ret el OrthoA SnapA GridA GridF SnapM UC_Sym ON OFF z)
(setq SnapM (FIND_OSMODES))
(setq ON (nth 13 prt_list)) ;;;@ON
(setq OFF (nth 14 prt_list)) ;;;@OFF
(setq OrthoA (if (= (getvar "ORTHOMODE") 1) ON OFF))
(setq SnapA (if (= (getvar "SNAPMODE") 1) ON OFF))
(setq GridA (if (= (getvar "GRIDMODE") 1) ON OFF))
(setq GridF (rtos (/ (car (getvar "GRIDUNIT")) (car (getvar "SNAPUNIT")))))
(setq UC_Sym (if (= (getvar "UCSICON") 1) ON OFF))
(setq ret '())
(setq ret (append ret
(list
(strcat (nth 15 prt_list) OrthoA) ;;@ORTHO MODE:\t
(strcat (nth 16 prt_list) SnapA ) ;;@SNAP GRID:\t
(strcat (nth 17 prt_list) (rtos (car (getvar "SNAPUNIT")))) ;;@\tWidth:\t
(strcat (nth 18 prt_list) (rtos (cadr (getvar "SNAPUNIT")))) ;;@\tHeight:\t
(strcat (nth 19 prt_list) (point2s (getvar "SNAPBASE"))) ;;@\tOrigin:\t
(strcat (nth 20 prt_list) GridA) ;;@REFERENCE GRID:\t
(strcat (nth 21 prt_list) GridF) ;;@\tFactor: \t
(strcat (nth 22 prt_list) (point2s (getvar "LIMMIN"))) ;;@\tCorner 1:\t
(strcat (nth 23 prt_list) (point2s (getvar "LIMMAX"))) ;;@\tCorner 2:\t
SEPARATOR
(nth 24 prt_list) ;;@OBJECT SNAP MODES:\t
)
SNAPM
(list
SEPARATOR
(strcat (nth 25 prt_list) (rtos (getvar "ZINSCALE" ))) ;;@ZOOMIN FACTOR:\t
(strcat (nth 26 prt_list) (rtos (getvar "ZOUTSCALE"))) ;;@ZOOMOUT FACTOR:\t
(strcat (nth 27 prt_list) (rtos (getvar "PANSCALE" ))) ;;@PAN FACTOR:\t
SEPARATOR
(strcat (nth 28 prt_list) UC_Sym) ;;@COORDINATE SYMBOL:\t
)
))
(setq ret ret)
)
;;; --------------------------------------------------------------------------
;;; TABLE: LAYER (Return List)
;;; --------------------------------------------------------------------------
(defun TABLE_LAYER (l / el tstr ret layflag)
(setq ret '())
(foreach el l
(setq layflag "")
(if (= (logand 1 (cdr (assoc 70 el))) 1)
(setq layflag (strcat layflag (nth 31 prt_list))) ;;@\t*freezed*
(setq layflag (strcat layflag "\t"))
)
(if (= (logand 4 (cdr (assoc 70 el))) 4)
(setq layflag (strcat layflag (nth 32 prt_list))) ;;@\t*locked*
(setq layflag (strcat layflag "\t"))
)
(setq ret (append ret (list
(strcat
(cdr (assoc 2 el))
layflag
(nth 33 prt_list) ;;@\tCO:
(itoa (cdr (assoc 62 el)))
(nth 34 prt_list) ;;@\tLT:
(cdr (assoc 6 el))
)
)))
)
(setq ret ret)
)
;;; --------------------------------------------------------------------------
;;; TABLE: LINETYPES (Return List)
;;; --------------------------------------------------------------------------
(defun TABLE_LTYPE (l / el ret )
(setq ret '( ))
(foreach el l
(setq ret (append ret (list (strcat
(cdr (assoc 2 el))
TAB
(cdr (assoc 3 el))
))))
)
(setq ret ret)
)
;;; --------------------------------------------------------------------------
;;; TABLE: FONTS / TEXT STYLES (Return List)
;;; --------------------------------------------------------------------------
(defun TABLE_STYLE (l / el tstr ret flag)
(setq ret '())
(foreach el l
(setq flag "\t")
(if (= (logand 2 (cdr (assoc 71 el))) 2)
(setq flag (strcat flag (nth 41 prt_list))) ;;;@*backwards* \t
(setq flag (strcat flag "\t"))
)
(if (= (logand 4 (cdr (assoc 71 el))) 4)
(setq flag (strcat flag (nth 42 prt_list))) ;;;@*upside-down*\t
(setq flag (strcat flag "\t"))
)
(if (= (logand 4 (cdr (assoc 70 el))) 4) ;;; ###
(setq flag (strcat flag (nth 43 prt_list))) ;;;@*vertical*
)
(setq ret (append ret (list
(strcat
(cdr (assoc 2 el))
TAB
(cdr (assoc 3 el))
(nth 44 prt_list) ;;;@\tH:
(rtos (cdr (assoc 40 el)))
(nth 45 prt_list) ;;;@\tWF:
(symbtos (cdr (assoc 41 el)))
(nth 46 prt_list) ;;;@\tOA:
(symbtos (cdr (assoc 50 el)))
)
flag
SEPARATOR
)))
)
(setq ret ret)
)
;;; --------------------------------------------------------------------------
;;; TABLE: HATCH PARAMETERS (Return List)
;;; --------------------------------------------------------------------------
(defun HPARAMETER ( / ret)
(setq ret '())
(setq ret (append ret (list (strcat
(nth 51 prt_list) ;;;@Pattern Name:
TAB
(if (= (getvar "HPNAME") "")
(nth 52 prt_list) ;;;@NOT USED
(getvar "HPNAME")
)
))))
(setq ret (append ret (list (strcat
(nth 53 prt_list) ;;@Pattern File:
TAB
(if (= (getvar "HPFILE") "")
(nth 54 prt_list) ;;@Not specified
(getvar "HPFILE")
)
))))
(setq ret (append ret (list
(strcat
(nth 55 prt_list) ;;@Pattern Scale:
TAB (rtos (getvar "HPSCALE"))
)
(strcat
(nth 56 prt_list) ;;@Pattern Angle:
TAB (rtos (getvar "HPANG"))
)
" "
)))
(setq ret (append ret (list
(strcat
(nth 57 prt_list) ;;@Distance:
TAB (rtos (getvar "HPSPACE"))
)
(strcat
(nth 58 prt_list) ;;@Angle:
TAB (rtos (getvar "HPUSRANG"))
)
(strcat
(nth 59 prt_list) ;;@Cross Pattern:\t
(if (= (getvar "HPDOUBLE") 0)
(nth 60 prt_list) ;;@No
(nth 61 prt_list) ;;@Yes
)
)
)))
(setq ret ret)
)
;;; --------------------------------------------------------------------------
;;; TABLE: Dimension Types
;;; --------------------------------------------------------------------------
(defun TABLE_DIMSTYLE (l / el tstr ret flag)
(setq ret '())
(foreach el l (setq ret (append ret (list (cdr (assoc 2 el))) )))
(setq ret ret)
)
;;; ---------------------------------------------------------------------------
;;; TABLE: DEFINED BLOCKS (Return List)
;;; ---------------------------------------------------------------------------
(defun TABLE_BLOCK (l / el tstr ret flag xr)
(setq ret '())
(foreach el l
(setq flag "")
(if (= (logand 4 (cdr (assoc 70 el))) 4)
(progn (setq flag (strcat flag "**\t"))(setq xr (cdr (assoc 1 el))))
(progn (setq flag (strcat flag "\t")) (setq xr "" ))
)
(if (= (logand 16 (cdr (assoc 70 el))) 4)
(setq flag (strcat flag (nth 65 prt_list))) ;;@*external*\t
(setq flag (strcat flag "\t"))
)
(if (= (logand 1 (cdr (assoc 70 el))) 1)
(setq flag (strcat flag (nth 66 prt_list))) ;;@*anonymous*\t
(setq flag (strcat flag "\t"))
)
(if (= (logand 2 (cdr (assoc 70 el))) 2)
(setq flag (strcat flag (nth 67 prt_list))) ;;@*Attributes*\t
(setq flag (strcat flag "\t"))
)
(if (= (logand 64 (cdr (assoc 70 el))) 64)
(setq flag (strcat flag (nth 68 prt_list))) ;;@*referenced*\t
(setq flag (strcat flag "\t"))
)
(setq ret (append ret (list
(strcat (cdr (assoc 2 el)) xr)
flag
SEPARATOR
)))
)
(setq ret ret)
)
;;;---------------------------------------------------------------------------
;;; TABLE: REFERENCED BLOCKS
;;;---------------------------------------------------------------------------
(defun DISP_REFBLOCK ( / as i inf ret)
(setq ret '())
(if (setq as (ssget "X" '((0 . "INSERT"))))
(progn
(setq i 0)
(while (< i (sslength as))
(setq inf (entget (ssname as i)))
(setq ret (append ret (list (cdr (assoc 2 inf)))))
(setq i (+ i 1))
)
)
(setq ret (list (nth 11 prt_list))) ;;@No item in this table!"
)
(setq ret ret)
)
;;;---------------------------------------------------------------------------
;;; TABLE: VIEW (Named Views)
;;;---------------------------------------------------------------------------
(defun TABLE_VIEW (l / ret el)
(setq ret '())
(foreach el l (setq ret (append ret (list
(strcat (nth 70 prt_list) TAB (cdr (assoc 2 el)))
(strcat (nth 71 prt_list) TAB (rtos (cdr (assoc 40 el))))
(strcat (nth 72 prt_list) TAB (rtos (cdr (assoc 41 el))))
(strcat (nth 73 prt_list) TAB (point2s (cdr (assoc 10 el))))
(strcat (nth 74 prt_list) TAB (point2s (cdr (assoc 11 el))))
(strcat (nth 75 prt_list) TAB (point2s (cdr (assoc 12 el))))
;;; 50 ?
SEPARATOR
))))
(setq ret ret)
)
;;;---------------------------------------------------------------------------
;;; TABLE: Named User Coordinate Systems
;;;---------------------------------------------------------------------------
(defun TABLE_UCS (l / el tstr ret flag)
(setq ret '())
(foreach el l (setq ret (append ret (list
(strcat (nth 70 prt_list) TAB (cdr (assoc 2 el))) ;;@Name:
(strcat (nth 81 prt_list) TAB (point2s (cdr (assoc 10 el)))) ;;@Origin:
(strcat (nth 82 prt_list) TAB (point2s (cdr (assoc 11 el)))) ;;@X axis direction:
(strcat (nth 83 prt_list) TAB (point2s (cdr (assoc 12 el)))) ;;@Y axis direction:
SEPARATOR
))))
(setq ret ret)
)
;;; --------------------------------------------------------------------------
;;; TABLE: VPORT
;;; --------------------------------------------------------------------------
(defun TABLE_VPORT (l / ret el)
(setq ret '())
(foreach el l (setq ret (append ret (list
(strcat (nth 70 prt_list) TAB (symbtos (cdr (assoc 2 el)))) ;;@Name:
(strcat (nth 80 prt_list) TAB (symbtos (cdr (assoc 69 el)))) ;;@ID:
(strcat (nth 73 prt_list) TAB (point2s (cdr (assoc 12 el)))) ;;@Center point:
(strcat (nth 74 prt_list) TAB (point2s (cdr (assoc 16 el)))) ;;@View direction:
(strcat (nth 75 prt_list) TAB (point2s (cdr (assoc 17 el)))) ;;@Target point:
(strcat (nth 71 prt_list) TAB (symbtos (cdr (assoc 40 el)))) ;;@Height:
(strcat (nth 76 prt_list) TAB (symbtos (cdr (assoc 41 el)))) ;;@Aspect ratio:
(strcat (nth 77 prt_list) TAB (symbtos (cdr (assoc 51 el)))) ;;@Twist angle:
SEPARATOR
))))
(setq ret ret)
)
;;; **************************************************************************
;;; --------------------------------------------------------------------------
;;; Display selected table
;;; --------------------------------------------------------------------------
(defun DISP_TABLE (a /a el)
(setq lst '())
(if (setq s1 (tblnext a T))
(progn
(setq lst (cons s1 lst))
(while (setq s1 (tblnext a)) (setq lst (cons s1 lst)) )
(setq lst (reverse lst))
(cond
((= a "LAYER") (setq lst (TABLE_LAYER lst)))
((= a "LTYPE") (setq lst (TABLE_LTYPE lst)))
((= a "STYLE") (setq lst (TABLE_STYLE lst)))
((= a "BLOCK") (setq lst (TABLE_BLOCK lst)))
((= a "UCS") (setq lst (TABLE_UCS lst)))
((= a "DIMSTYLE") (setq lst (TABLE_DIMSTYLE lst)))
((= a "VPORT") (setq lst (TABLE_VPORT lst)))
((= a "VIEW") (setq lst (TABLE_VIEW lst)))
(T (foreach el lst (setq lst (subst (symbtos el) el lst))))
)
) ;;; progn
(setq lst (list (nth 11 prt_list))) ;;@No item in this table!
) ;;; if
)
;;; ----------------------------------------------------------------------------
;;; Selection Menu in List Box
;;; ----------------------------------------------------------------------------
(defun TABLE_LIST (a / a)
(if (= LBOX_MODE 1) (progn
(Dlg_ListSetTabstops "ListBox1" "8 10 15 20 25 30 35 40 45 50 55 60 65 70")
(cond
((= a "0")
(Dlg_ListSetTabstops "ListBox1" "5 15")
(setq lst (DISP_VIEWPAR))
)
((= a "1")
(Dlg_ListSetTabstops "ListBox1" "12 20")
(setq lst (DISP_TABLE "LAYER"))
)
((= a "2")
(Dlg_ListSetTabstops "ListBox1" "8 10 15 20 25 30 35 40 45 50 55 60 65 70")
(setq lst (DISP_TABLE "LTYPE"))
)
((= a "3")
(setq lst (DISP_TABLE "STYLE"))
)
((= a "4")
(setq lst (DISP_TABLE "BLOCK"))
)
((= a "5")
(setq lst (DISP_REFBLOCK))
)
((= a "6")
(setq lst (DISP_TABLE "DIMSTYLE"))
)
((= a "7")
(setq lst (HPARAMETER))
(Dlg_ListSetTabstops "ListBox1" "10")
)
((= a "8")
(setq lst (DISP_TABLE "VIEW"))
(Dlg_ListSetTabstops "ListBox1" "10")
)
((= a "9")
(setq lst (DISP_TABLE "UCS"))
(Dlg_ListSetTabstops "ListBox1" "10")
)
(T
(setq lst '("- - - - -"))
)
)
(Dlg_ListStart "ListBox1")(mapcar 'Dlg_ListAdd lst)(Dlg_ListEnd)
(Dlg_TileSet "info" (nth (atoi a) lst1))
(Dlg_TileMode "selection" 0)
(setq LBOX_MODE 0)
))
)
;;;---------------------------------------------------------------------------
;;; Startup List
;;;---------------------------------------------------------------------------
(defun FIRST_LIST ()
(Dlg_ListSetTabstops "ListBox1" "5 10 15 20 25 30 35 40 45 50 55 60 65 70")
(Dlg_ListStart "ListBox1")(mapcar 'DLG_ListAdd lst1)(DLG_ListEnd)
(Dlg_TileSet "info" (nth 10 prt_list)) ;;;@Choose table ...
(Dlg_TileMode "selection" 1)
(setq LBOX_MODE 1)
)
;;;---------------------------------------------------------------------------
;;; Dialog Initialization Function
;;;---------------------------------------------------------------------------
(defun DlgInit ()
(if FLX$WIN95
(progn
(foreach n
'("IDCANCEL" "IDOK" "IDHELP" "copyclip" "info" "ListBox1" "selection")
(Dlg_TileSetFont n 2)
)
(Dlg_ListSetTabstops "ListBox1" "20 25 30")
)
;;; else:
(Dlg_ListSetTabstops "ListBox1" "15 18 20")
)
(Dlg_TileAction "IDOK" "(Dlg_DialogDone)")
(Dlg_TileAction "selection" "(FIRST_LIST)")
(Dlg_TileAction "copyclip" "(COPYCLIPBOARD)")
(Dlg_TileAction "ListBox1" "(TABLE_LIST (Dlg_TileGet $key))")
(FIRST_LIST)
)
;;;---------------------------------------------------------------------------
;;; MAIN
;;;---------------------------------------------------------------------------
(setq TAB "\t")
(setq SEPARATOR (strcat
"----------------------------------------------------------------------------"
"----------------------------------------------------------------------------"
))
(setq prt_list (list
;;; Selection Menu -----------------
"Draw and Display Parameters" ;; 0
"Layer" ;; 1
"Line Types" ;; 2
"Fonts" ;; 3
"Part Definitions" ;; 4
"Referenced Parts" ;; 5
"Dimension Types" ;; 6
"Hatch Parameters" ;; 7
"Named Views" ;; 8
"User Coordinate Systems" ;; 9
;;; Dialog Box Control ----------
"Choose table ..." ;; 10
"No item in this table!" ;; 11
;;; General Settings ------------
"\t\t--- None ---" ;; 12
"ON" ;; 13
"OFF" ;; 14
"ORTHO MODE:\t" ;; 15
"SNAP GRID:\t" ;; 16
"\tWidth: \t" ;; 17
"\tHeight:\t" ;; 18
"\tOrigin:\t" ;; 19
"REFERENCE GRID:\t" ;; 20
"\tFactor: \t" ;; 21
"\tCorner 1:\t" ;; 22
"\tCorner 2:\t" ;; 23
"OBJECT SNAP MODES:\t" ;; 24
"ZOOMIN FACTOR:\t" ;; 25
"ZOOMOUT FACTOR:\t" ;; 26
"PAN FACTOR:\t" ;; 27
"COORDINATE SYMBOL:\t" ;; 28
"" ;; 29
;;; Layer -----------------------
"" ;; 30
"\t*freezed*" ;; 31
"\t*locked*" ;; 32
"\tCO: " ;; 33
"\tLT: " ;; 34
"" ;; 35
;;; Linetypes -------------------
"" ;; 36
"" ;; 37
"" ;; 38
"" ;; 39
;;; Fonts -----------------------
"" ;; 40
"*backwards* \t" ;; 41
"*upside-down*\t" ;; 42
"*vertical*" ;; 43
"\tH: " ;; 44
"\tWF: " ;; 45
"\tOA: " ;; 46
"" ;; 47
"" ;; 48
"" ;; 49
;;; Hatch -----------------------
"" ;; 50
"Pattern Name:" ;; 51
"Not used" ;; 52
"Pattern File: " ;; 53
"Not specified" ;; 54
"Pattern Scale: " ;; 55
"Pattern Angle: " ;; 56
"Distance: " ;; 57
"Angle: " ;; 58
"Cross Pattern:\t" ;; 59
"No" ;; 60
"Yes" ;; 61
"" ;; 62
"" ;; 63
"" ;; 64
;;; Block Definitions -----------
"*external*\t" ;; 65
"*anonymous*\t" ;; 66
"*Teil hat Attribute*\t" ;; 67
"*referenced*\t" ;; 68
"" ;; 69
"Name: " ;; 70
;;; View Table ------------------
"Height: " ;; 71
"Width: " ;; 72
"Center point: " ;; 73
"View direction: " ;; 74
"Target point: " ;; 75
"Aspect ratio: " ;; 76
"Twist angle: " ;; 77
"" ;; 78
"" ;; 79
"ID: " ;; 80
;;; User Coord. Systems ---------
"Origin: " ;; 81
"X axis direction: " ;; 82
"Y axis direction: " ;; 83
"" ;; 84
"" ;; 85
"" ;; 86
"" ;; 87
"" ;; 88
"" ;; 89
;;; Object Snap Modes -----
;;; ...used in SnapML
"END POINT" ;; 90
"MID POINT" ;; 91
"CENTER" ;; 92
"POINT" ;; 93
"QUADRANT" ;; 94
"INTERSECTION" ;; 95
"INSERTION POINT" ;; 96
"PERPENDICULAR" ;; 97
"TANGENT" ;; 98
"CLOSEST" ;; 99
))
(if FLX_XLANGUAGE (FLX_XLANGUAGE "_tabl" nil))
;;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(FLX_FUNC_INIT)
(setq lst1 (list
(nth 0 prt_list) (nth 1 prt_list) (nth 2 prt_list)
(nth 3 prt_list) (nth 4 prt_list) (nth 5 prt_list)
(nth 6 prt_list) (nth 7 prt_list) (nth 8 prt_list)
(nth 9 prt_list)
))
(if (FLX_DLGDSP "flx_dlg" "TABLES" "(princ)" "(DlgInit)") (princ)(exit))
(FLX_FUNC_EXIT)
(princ)
)
; ========================================================================
(princ)