home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 15
/
BUGCD1998_06.ISO
/
aplic
/
felixcad
/
fcaddata.z
/
FLX_EINF.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1997-12-01
|
15KB
|
354 lines
;;; FLX_EINF.LSP
;;; ======================================================================
;;; (C)opyright Felix Computer Aided Technologies GmbH 1996-97
;;; Sept 30, 1996 / dn,vp
;;; Dec. 01, 1997 / modified vp
;;; ======================================================================
;;; ENTITY INFO
;;; ======================================================================
(defun FLX_EINFO ( / dialog_title prt_list point2s
MELIST GET_VERTEX GET_ATTRIB LENGTH_of_LINE LENGTH_of_ARC
DlgInit SEPARATOR ew el n p1 ent_list lst flag tmp as i
as_length)
;;; Error Handler
(FLX_FUNC_INIT)
;;; Dialog Title and Prompt List
(setq dialog_title "ENTITY INFORMATION")
(setq prt_list (list
"Type: \t"
"Layer: \t"
"Line type: \t"
"Layer's line type"
"Color: \t"
"Layer's color"
"Part definition color"
"Layer's color"
"Handle ID: \t"
"Start point: \t"
"End point: \t"
"Length: \t"
"Center: \t"
"Radius: \t"
"Start angle: \t"
"End angle: \t"
"Arc length: \t"
"Coordinates:\t"
"Corner 1: \t"
"Corner 2: \t"
"Corner 3: \t"
"Corner 4: \t"
"Invisible: \t"
"Polyline flag: \t"
"Start width (default): \t"
"End width (default): \t"
"Curve type: \t"
"Definition point: \t"
"Start width (0=default): \t"
"End width (0=default): \t"
"Bulge (0=default): \t"
"Vertex flag: \t"
"Curve fit tangent direction:\t"
"Part name: \t"
"Insertion point: \t"
"Rotation angle: \t"
"X scale factor: \t"
"Y scale factor: \t"
"Z scale factor: \t"
"Attributes follow flag: \t"
"Dimension type: \t"
"Dim Type Name: \t"
"Name: \t"
"Definition point: \t"
"Center pt. dim text: \t"
"Insertion point: \t"
"Def. point (13): \t"
"Def.point (14): \t"
"Def.point (15): \t"
"Def.point (16): \t"
"Leader length: \t"
"Angle of rotated, horiz. or vert. linear dim's: \t"
"Horizontal direction: \t"
"Extension line angle (oblique dim's): \t"
"Rotation angle of dim text: \t"
"Text string: \t"
"Tag: \t"
"Request: \t"
"Default value: \t"
"Attribute flag: \t"
"Attribute value: \t"
"Attribute tag: \t"
"Attribute flag: \t"
"Insertion point: \t"
"Rotation angle: \t"
"Font: \t"
"Text height: \t"
"X scale factor: \t"
"Oblique angle: \t"
"Text generation flag: \t"
"Horizontal justification flag: \t"
"Vertical alignment flag: \t"
"Alignment point: \t"
))
(if FLX_XLANGUAGE (FLX_XLANGUAGE "_einf" nil))
;;; --------------------------------------------------------------------------------
(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)))
""
)
))
)
;;; --------------------------------------------------------------------------------
(defun MELIST (l / ret entype tmp1)
(setq ret (list
(strcat (nth 0 prt_list) (cdr (assoc 0 l))) ;;;@"Type: \t\t"
(strcat (nth 1 prt_list) (cdr (assoc 8 l))) ;;;@"Layer: \t\t"
(strcat (nth 2 prt_list) ;;;@"Line type: \t"
(if (setq entype (cdr (assoc 6 l))) entype (nth 3 prt_list)) ;;;@"Layer's line type"
)
(strcat (nth 4 prt_list) ;;;@"Color: \t\t"
(cond
((NULL (cdr (assoc 62 l))) (nth 5 prt_list)) ;;;@"Layer's color"
((= (cdr (assoc 62 l)) 0) (nth 6 prt_list)) ;;;@"Part definition color"
((= (cdr (assoc 62 l)) 256) (nth 7 prt_list)) ;;;@"Layer's color"
((symbtos (cdr (assoc 62 l))))
)
)
(strcat (nth 8 prt_list) (symbtos (cdr (assoc 5 l)))) ;;;@"Handle ID: \t"
))
(setq entype (cdr (assoc 0 l)))
(cond
((= entype "LINE") (setq ret (append ret (list
(strcat (nth 9 prt_list) (point2s (cdr (assoc 10 l)))) ;;;@"Start point: \t"
(strcat (nth 10 prt_list) (point2s (cdr (assoc 11 l)))) ;;;@"End point: \t"
(strcat (nth 11 prt_list) ;;;@"Length: \t"
(rtos (LENGTH_OF_LINE (cdr (assoc 11 l))(cdr (assoc 10 l))))
)
))))
((= entype "CIRCLE") (setq ret (append ret (list
(strcat (nth 12 prt_list) (point2s (cdr (assoc 10 l)))) ;;;@"Center: \t"
(strcat (nth 13 prt_list) (rtos (cdr (assoc 40 l)))) ;;;@"Radius: \t"
))))
((= entype "ARC") (setq ret (append ret (list
(strcat (nth 12 prt_list) (point2s (cdr (assoc 10 l)))) ;;;"Center: \t"
(strcat (nth 13 prt_list) (rtos (cdr (assoc 40 l)))) ;;;"Radius: \t"
(strcat (nth 14 prt_list) (angtos (cdr (assoc 50 l)))) ;;;@"Start angle: \t"
(strcat (nth 15 prt_list) (angtos (cdr (assoc 51 l)))) ;;;@"End angle: \t"
(strcat (nth 16 prt_list) (rtos (LENGTH_OF_ARC l))) ;;;@"Arc length: \t"
))))
((= entype "POINT") (setq ret (append ret (list
(strcat (nth 17 prt_list) (point2s (cdr (assoc 10 l)))) ;;;@"Coordinates:\t\t"
))))
((= entype "SOLID") (setq ret (append ret (list
(strcat (nth 18 prt_list) (point2s (cdr (assoc 10 l)))) ;;;@"Corner 1: \t"
(strcat (nth 19 prt_list) (point2s (cdr (assoc 11 l)))) ;;;@"Corner 2: \t"
(strcat (nth 20 prt_list) (point2s (cdr (assoc 12 l)))) ;;;@"Corner 3: \t"
(strcat (nth 21 prt_list) (point2s (cdr (assoc 13 l)))) ;;;@"Corner 4: \t"
))))
((= entype "3DFACE") (setq ret (append ret (list
(strcat (nth 18 prt_list) (point2s (cdr (assoc 10 l)))) ;;;"Corner 1: \t"
(strcat (nth 19 prt_list) (point2s (cdr (assoc 11 l)))) ;;;"Corner 2: \t"
(strcat (nth 20 prt_list) (point2s (cdr (assoc 12 l)))) ;;;"Corner 3: \t"
(strcat (nth 21 prt_list) (point2s (cdr (assoc 13 l)))) ;;;"Corner 4: \t"
(strcat (nth 22 prt_list) (symbtos (cdr (assoc 70 l)))) ;;;@"Invisible: \t"
))))
((= entype "POLYLINE")(setq ret (append ret (list
(strcat (nth 23 prt_list) (symbtos (cdr (assoc 70 l)))) ;;;@"Polyline flag: \t"
(strcat (nth 26 prt_list) (symbtos (cdr (assoc 75 l)))) ;;;@"Curve type: \t"
(strcat (nth 24 prt_list) (rtos (cdr (assoc 40 l)))) ;;;@"Start width (default): \t"
(strcat (nth 25 prt_list) (rtos (cdr (assoc 41 l)))) ;;;@"End width (default): \t"
))))
((= entype "VERTEX") (setq ret (append ret (list
(strcat (nth 27 prt_list) (point2s (cdr (assoc 10 l)))) ;;;@"Definition point: \t"
(strcat (nth 28 prt_list) (symbtos (cdr (assoc 40 l)))) ;;;@"Start width (0=default): \t"
(strcat (nth 29 prt_list) (symbtos (cdr (assoc 41 l)))) ;;;@"End width (0=default): \t"
(strcat (nth 30 prt_list) (symbtos (cdr (assoc 42 l)))) ;;;@"Bulge (0=default): \t"
(strcat (nth 31 prt_list) (symbtos (cdr (assoc 70 l)))) ;;;@"Vertex flag: \t"
;;; (strcat (nth 32 prt_list) (symbtos (cdr (assoc 50 l)))) ;;;@"Curve fit tangent direction:\t"
))))
((= entype "INSERT") (setq ret (append ret (list
(strcat (nth 33 prt_list) (cdr (assoc 2 l))) ;;;@"Part name: \t"
(strcat (nth 34 prt_list) (point2s (cdr (assoc 10 l)))) ;;;@"Insertion point: \t"
(strcat (nth 35 prt_list) (angtos (cdr (assoc 50 l)))) ;;;@"Rotation angle: \t"
(strcat (nth 36 prt_list) (rtos (cdr (assoc 41 l)))) ;;;@"X scale factor: \t"
(strcat (nth 37 prt_list) (rtos (cdr (assoc 42 l)))) ;;;@"Y scale factor: \t"
(strcat (nth 38 prt_list) (rtos (cdr (assoc 43 l)))) ;;;@"Z scale factor: \t"
(strcat (nth 39 prt_list) (symbtos (cdr (assoc 66 l)))) ;;;@"Attributes follow flag: \t"
))))
((= entype "DIMENSION")(setq ret (append ret (list
(strcat (nth 40 prt_list) (symbtos (cdr (assoc 70 l)))) ;;;@"Dimension type: \t"
(strcat (nth 41 prt_list) (symbtos (cdr (assoc 3 l)))) ;;;@"Dim Type Name: \t"
(strcat (nth 42 prt_list) (symbtos (cdr (assoc 2 l)))) ;;;@"Name: \t"
(strcat (nth 43 prt_list) (symbtos (cdr (assoc 10 l)))) ;;;@"Definition point: \t"
(strcat (nth 44 prt_list) (symbtos (cdr (assoc 11 l)))) ;;;@"Center pt. dim text: \t"
(strcat (nth 45 prt_list) (symbtos (cdr (assoc 12 l)))) ;;;@"Insertion point: \t"
(strcat (nth 46 prt_list) (symbtos (cdr (assoc 13 l)))) ;;;@"Def. point (13): \t"
(strcat (nth 47 prt_list) (symbtos (cdr (assoc 14 l)))) ;;;@"Def.point (14): \t"
(strcat (nth 48 prt_list) (symbtos (cdr (assoc 15 l)))) ;;;@"Def.point (15): \t"
(strcat (nth 49 prt_list) (symbtos (cdr (assoc 16 l)))) ;;;@"Def.point (16): \t"
(strcat (nth 50 prt_list) (symbtos (cdr (assoc 40 l)))) ;;;@"Leader length: \t" ;;;### ???
(strcat (nth 51 prt_list) (symbtos (cdr (assoc 50 l)))) ;;;@"Angle of rotated, horiz. or vert. linear dim's: \t"
(strcat (nth 52 prt_list) (symbtos (cdr (assoc 51 l)))) ;;;@"Horizontal direction: \t"
(strcat (nth 53 prt_list) (symbtos (cdr (assoc 52 l)))) ;;;@"Extension line angle (oblique dim's): \t"
(strcat (nth 54 prt_list) (symbtos (cdr (assoc 53 l)))) ;;;@"Rotation angle of dim text: \t"
))))
((= entype "TEXT") (setq ret (append ret (list
(strcat (nth 55 prt_list) (cdr (assoc 1 l))) ;;;@"Text string: \t"
))))
((= entype "ATTDEF") (setq ret (append ret (list
(strcat (nth 56 prt_list) (cdr (assoc 2 l))) ;;;@"Tag: \t"
(strcat (nth 57 prt_list) (cdr (assoc 3 l))) ;;;@"Request: \t"
(strcat (nth 58 prt_list) (cdr (assoc 1 l))) ;;;@"Default value: \t"
(strcat (nth 59 prt_list) (symbtos (cdr (assoc 70 l)))) ;;;@"Attribute flag: \t"
))))
((= entype "ATTRIB") (setq ret (append ret (list
(strcat (nth 60 prt_list) (cdr (assoc 1 l))) ;;;@"Attribute value: \t"
(strcat (nth 61 prt_list) (cdr (assoc 2 l))) ;;;@"Attribute tag: \t"
(strcat (nth 62 prt_list) (symbtos (cdr (assoc 70 l)))) ;;;@"Attribute flag: \t"
))))
) ; cond
(if (or (= entype "TEXT") (= entype "ATTRIB") (= entype "ATTDEF"))
(setq ret (append ret (list
(strcat (nth 63 prt_list) (point2s (cdr (assoc 10 l)))) ;;;@"Insertion point: \t"
(strcat (nth 72 prt_list) (point2s (cdr (assoc 11 l)))) ;;;@"Alignment point: \t"
(strcat (nth 64 prt_list) (angtos (cdr (assoc 50 l)))) ;;;@"Rotation angle: \t"
(strcat (nth 65 prt_list) (cdr (assoc 7 l))) ;;;@"Font: \t"
(strcat (nth 66 prt_list) (rtos (cdr (assoc 40 l)))) ;;;@"Text height: \t"
(strcat (nth 67 prt_list) (symbtos (cdr (assoc 41 l)))) ;;;@"X scale factor: \t"
(strcat (nth 68 prt_list) (symbtos (cdr (assoc 51 l)))) ;;;@"Oblique angle: \t"
(strcat (nth 70 prt_list) (symbtos (cdr (assoc 72 l)))) ;;;@"Horizontal justification flag: \t"
(strcat (nth 69 prt_list) (symbtos (cdr (assoc 71 l)))) ;;;@"Text generation flag: \t"
(strcat (nth 71 prt_list) (symbtos (cdr (assoc 73 l)))) ;;;@"Vertical alignment flag: \t"
))))
(setq ret (append ret (list SEPARATOR)))
(setq ret ret)
)
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(defun GET_VERTEX(en / ret tmp)
(setq ret '())
(while (AND (setq en (entnext en))
(= (cdr (assoc 0 (entget en))) "VERTEX")
)
(setq ret (append ret (list (entget en))))
)
(setq ret ret)
)
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(defun GET_ATTRIB(en / ret tmp)
(setq ret '())
(while (AND (setq en (entnext en))
(= (cdr (assoc 0 (entget en))) "ATTRIB")
)
(setq ret (append ret (list (entget en))))
)
(setq ret ret)
)
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(defun LENGTH_of_LINE(a b)
(sqrt (+ (expt (- (car a) (car b)) 2)
(expt (- (cadr a) (cadr b)) 2)
(expt (- (last a) (last b)) 2)
)
)
)
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(defun LENGTH_of_ARC(el1 / e1 el1 start_ang end_ang radius b_length)
(setq radius (cdr (assoc 40 el1)))
(setq start_ang (cdr (assoc 50 el1)))
(setq end_ang (cdr (assoc 51 el1)))
(setq b_length (* radius (- end_ang start_ang)))
(if (< (abs b_length) 0.00000001)
(setq b_length (abs b_length))
)
(if (/= (abs b_length) b_length)
(setq b_length (+ (* 2.0 pi radius) b_length))
(setq b_length b_length)
)
)
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(defun DlgInit ()
(Dlg_ListSetTabstops "ListBox1" "15 18 20")
(if FLX$WIN95
(progn
(foreach n
'("IDCANCEL" "IDOK" "IDHELP" "copyclip" "info" "ListBox1" "selection")
(Dlg_TileSetFont n 2)
)
(Dlg_ListSetTabstops "ListBox1" "20 25 30")
)
(Dlg_ListSetTabstops "ListBox1" "15 18 20")
)
(Dlg_TileAction "copyclip" "(COPYCLIPBOARD)")
(Dlg_TileAction "IDOK" "(Dlg_DialogDone)")
(Dlg_TileSet "selection" "")
(Dlg_TileSet "info" dialog_title) ;;;ENTITY INFORMATION
(Dlg_ListStart "ListBox1")
(mapcar 'Dlg_ListAdd lst)
(Dlg_ListEnd)
)
(setq SEPARATOR (strcat
"--------------------------------------------------------------------------"
"--------------------------------------------------------------------------"
))
(setq ent_list '()) ;;; empty list
(setq as (ssget)) ;;; object selection
(setq i 0) ;;;
(setq flag T) ;;;
(if as (progn
(setq as_length (sslength as))
(while (and flag (< i as_length))
(setq el (entget (ssname as i)))
(if el
(progn
(setq ent_list (append ent_list (MELIST el)))
(if (= (cdr (assoc 0 el)) "POLYLINE")
(if (setq tmp (GET_VERTEX (cdr (assoc -1 el))))
(foreach el tmp (setq ent_list (append ent_list (MELIST el))))
)
)
(if (AND (= (cdr (assoc 0 el)) "INSERT")
(= (cdr (assoc 66 el)) 1)
)
(if (setq tmp (GET_ATTRIB (cdr (assoc -1 el))))
(foreach el tmp (setq ent_list (append ent_list (MELIST el))))
)
)
(if (> (length ent_list) 1000) (progn
(setq flag nil)
(setq ent_list (append ent_list
(list
""
"********** Text buffer to big!"
"********** Entity Information List truncated!"
)
))
))
) ; progn
(setq flag nil) ; else [eigentlich ueberfluessig!]
) ; if
(setq i (+ i 1))
) ; while
)) ; if as
(setq lst ent_list)
(if lst
(if (FLX_DLGDSP "flx_dlg" "TABLES" "(princ)" "(DlgInit)") (princ)(exit))
)
(FLX_FUNC_EXIT)
(princ)
)
;;; ===========================================================================
(princ)