我也很开心:
- (defun C:test ( / tgassoc *error* dcl des dch dcf v c vx SS )
-
- ; Toggle associator - connect toggle value (0 or 1) with symbol value (nil or T):
- ; (setq tgval (tgassoc (get_tile "tg")))
- ; (set_tile "tg" (tgassoc tgval))
- (defun tgassoc ( keyorval ) (cadr (assoc keyorval '((nil "0")(T "1")("0" nil)("1" T)))) )
-
- (vl-every 'eval
- '(
- (cond ( (not vlax-get-acad-object) (vl-load-com) (princ) vlax-get-acad-object) (vlax-get-acad-object) ( (alert "\nVisual lisp extensions not loaded.") ) )
- (setq *error*
- (lambda ( msg )
- (and (< 0 dch) (unload_dialog dch))
- (and (eq 'FILE (type des)) (close des))
- (and (eq 'STR (type dcl)) (findfile dcl) (vl-file-delete dcl))
- (and msg (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\nError: " msg)))) (princ)
- ); lambda
- ); setq *error*
- (setq dcl (vl-filename-mktemp nil nil ".dcl"))
- (setq des (open dcl "w"))
- (foreach x
- '((116 101 115 116 32 58 32 100 105 97 108 111 103)
- (123 32 108 97 98 101 108 32 61 32 34 83 101 108 101 99 116 32 98 121 32 116 101 120 116 32 99 111 110 116 101 110 116 34 59)
- (32 32 58 32 98 111 120 101 100 95 99 111 108 117 109 110)
- (32 32 123 32 99 104 105 108 100 114 101 110 95 97 108 105 103 110 109 101 110 116 32 61 32 99 101 110 116 101 114 101 100 59)
- (32 32 32 32 58 32 116 101 120 116 32 123 32 118 97 108 117 101 32 61 32 34 83 101 97 114 99 104 32 112 97 116 116 101 114 110
- 58 32 34 59 32 105 115 95 100 101 102 97 117 108 116 32 61 32 116 114 117 101 59 32 125
- )
- (32 32 32 32 58 32 101 100 105 116 95 98 111 120 32 123 32 107 101 121 32 61 32 34 101 98 34 59 32 101 100 105 116 95 119 105
- 100 116 104 32 61 32 50 54 59 32 125
- )
- (32 32 32 32 58 32 116 111 103 103 108 101 32 123 32 107 101 121 32 61 32 34 99 34 59 32 108 97 98 101 108 32 61 32 34 73 103
- 110 111 114 101 32 99 97 115 101 34 59 32 97 108 105 103 110 109 101 110 116 32 61 32 99 101 110 116 101 114 101 100 59 32 118
- 97 108 117 101 32 61 32 49 59 32 109 110 101 109 111 110 105 99 32 61 32 34 99 34 59 32 125 32
- )
- (32 32 32 32 115 112 97 99 101 114 59)
- (32 32 125)
- (32 32 58 32 98 117 116 116 111 110 32 123 32 107 101 121 32 61 32 34 115 34 59 32 108 97 98 101 108 32 61 32 34 83 101 108 101
- 99 116 32 62 62 34 59 32 102 105 120 101 100 95 119 105 100 116 104 32 61 32 116 114 117 101 59 32 104 101 105 103 104 116 32
- 61 32 50 59 32 97 108 105 103 110 109 101 110 116 32 61 32 99 101 110 116 101 114 101 100 59 32 125
- )
- (32 32 115 112 97 99 101 114 59 32 58 32 98 117 116 116 111 110 32 123 32 108 97 98 101 108 32 61 32 34 68 111 110 101 34 59
- 32 105 115 95 99 97 110 99 101 108 32 61 32 116 114 117 101 59 32 102 105 120 101 100 95 119 105 100 116 104 32 61 32 116 114
- 117 101 59 32 97 108 105 103 110 109 101 110 116 32 61 32 99 101 110 116 101 114 101 100 59 32 125 32 58 32 116 101 120 116 32
- 123 32 107 101 121 32 61 32 34 101 114 114 111 114 34 59 32 118 97 108 117 101 32 61 32 34 67 114 101 100 105 116 115 32 116
- 111 58 32 76 101 101 32 77 97 99 34 59 125
- )
- (125)
- )
- (princ (apply 'strcat (mapcar 'chr x)) des)
- ); foreach
- (not (setq des (close des)))
- (< 0 (setq dch (load_dialog dcl)))
- (new_dialog "test" dch)
- (mapcar '(lambda (a b) (action_tile a (apply 'strcat (mapcar 'chr b))))
- '("c" "eb" "s")
- '(
- (40 105 102 32 40 115 101 116 113 32 99 32 40 116 103 97 115 115 111 99 32 36
- 118 97 108 117 101 41 41 32 40 115 101 116 95 116 105 108 101 32 34 101 98 34
- 32 40 115 101 116 113 32 118 32 40 115 116 114 99 97 115 101 32 40 103 101 116
- 95 116 105 108 101 32 34 101 98 34 41 41 41 41 41
- )
- (40 115 101 116 95 116 105 108 101 32 34 101 114 114 111
- 114 34 32 34 34 41 32 40 115 101 116 113 32 118 32 36 118 97 108 117 101 41
- )
- (40 67 79 78 68 32 40 40 79 82 32 40 78 79 84 32 86 41 32 40 61
- 32 86 32 34 34 41 41 32 40 83 69 84 95 84 73 76 69 32 34 101 114
- 114 111 114 34 32 34 83 112 101 99 105 102 121 32 115 101 97 114
- 99 104 32 112 97 116 116 101 114 110 33 34 41 32 40 77 79 68 69
- 95 84 73 76 69 32 34 101 98 34 32 50 41 41 32 40 84 32 40 73 70
- 32 67 32 40 83 69 84 81 32 86 32 40 83 84 82 67 65 83 69 32 86 41
- 41 41 32 40 68 79 78 69 95 68 73 65 76 79 71 32 49 41 41 41
- )
- )
- )
- (= 1 (setq dcf (start_dialog)))
- (progn
- (setq SS (ssadd))
- (vlax-for o (vla-get-Block (vla-get-ActiveLayout (vla-get-ActiveDocument (vlax-get-acad-object))))
- (and
- (vlax-property-available-p o 'TextString)
- (setq vx (vla-get-TextString o))
- (wcmatch (cond (c (strcase vx)) (vx)) v)
- (ssadd (vlax-vla-object->ename o) SS)
- )
- )
- (sssetfirst nil SS)
- )
- )
- ); and
-
- (*error* nil) (princ)
- ); defun C:test
- (vl-load-com) (princ)
|