图层打开/关闭,需要修改
如果层太多(>40),它将无法显示,伙计们,帮我修改它。可能需要添加“Page up”和“Page down”??
(defun c:tt (/ all_tc k2 key kwstr n)
(cxsta)
(SETQ kwstr "\nSelect the layer for display,[ALL(x)")
(setq n 0)
(setq all_tc (CX-ALL-LAY))
(foreach x all_tc
(setq kwstr (strcat kwstr "/" x "(" (itoa n) ")"))
(setq n (1+ n))
)
(setq kwstr (strcat kwstr "]"))
(initget 128 "")
(SETQ KEY (atoi (setq k2(GETKWORD kwstr))))
(if (>= key 0)
(command "_.-LAYER" "OFF" "*" "Y" "ON" (nth key all_tc) "")
)
(if (= k2 "x")
(command "_.-LAYER" "ON" "*" "")
)
(cxend)
)
(defun CX-ALL-LAY (/ I LAY)
(vlax-for I (vla-get-layers
(vla-get-activedocument (vlax-get-acad-object)))
(setq LAY (cons (vla-get-name I) LAY)))
(setq LAY (vl-sort LAY '<))
)
(defun cxsta ()
(setvar "cmdecho" 0)
(setq $orr *error*)
(setq *error* #err2)
(command ".UNDO" "BE")
)
(defun cxend ()
(command ".UNDO" "E")
(setq *error* $orr)
;(setvar "osmode" 15359)
(prompt "finishing")
(princ)
)
为什么?我也用2007年。 我的意思是2007年的同一期,所以试试动态模式。
我没办法,因为我不知道该控制哪一个动态模式大小/页面
我认为李·麦克波斯特#3是解决方案
-图层
既然我帮不上忙dynmode,
或者通过在屏幕上显示层名称来尝试替代方法?
然后使用本机acad命令layiso
(setvar 'dynmode 0)
(textpage)
(vl-load-com)(defun SS_ARRAY (/ i j k doc lst x ss vp rc)
;hanhphuc 09/12/14
(setq doc (vlax-get-acad-object))
(vlax-for lay (foreach x '(ActiveDocument Layers) (setq doc (vlax-get doc x)))
(setq lst (cons (vla-get-name lay) lst))
) ;_ end of vlax-for
(if (< (length lst) 20 ); min=2, you adjust here , example using lst < 20
(c:tt) ; use your code if <20
(progn
(if (setq ss (ssget "X"))
(while (/= (sslength ss) 0) (redraw (setq en (ssname ss 0)) 2) (setq ss (ssdel en ss)))
) ;_ end of if
(setq j (length lst)
k ((lambda (n / i a b)
(if (not (zerop n))
(progn (setq i (fix (sqrt n)))
(mapcar 'set '(a b) (list i (1+ i)))
(cond ((= n (* a a)) (list a a))
((<= (* a a) n (* a b)) (list a b))
((> n (* a b)) (list b b))
) ;_ end of cond
) ;_ end of progn
) ;_ end of if
) ;_ end of lambda
j
)
rc (last (if (not (zerop j))
(cons j (list (rem (apply '* k) j) k))
) ;_ end of if
) ;_ end of last
vp ((lambda (% / dv vH vW lst) ; v1.1
(setq vH (getvar "viewsize")
vW (* vH
(/ 1.
(apply
'/
(cdr
(reverse
(apply 'mapcar
(cons '- (cdr (setq dv (mapcar ''((x) (trans (getvar x) 0 1))
'(viewctr vsmin vsmax)))))
) ;_ end of apply
) ;_ end of reverse
) ;_ end of cdr
) ;_ end of apply
) ;_ end of /
) ;_ end of *
) ;_ end of setq
(foreach x '(+ -)
(setq lst (cons (mapcar ''((i j) ((eval x) (i (car dv)) (* (* j 0.5) (/ % 100.))))
(list car cadr)
(list vW vH)
) ;_ end of mapcar
lst
) ;_ end of cons
) ;_ end of setq
) ;_ end of foreach
) ;_ end of lambda
80.
)
) ;_ end of setq
(vla-arrayrectangular
(vlax-ename->vla-object
(entmakex (vl-list* '(0 . "TEXT")
'(1 . "*")
'(72 . 4)
(cons 40 (* (/ (getvar 'viewsize) (cadr (getvar 'screensize))) 7.))
(mapcar ''((x) (cons x (car vp))) '(10 11))
) ;_ end of list
) ;_ end of entmakex
) ;_ end of vlax-ename->vla-object
(car rc) ;row
(cadr rc) ;col
1
(/ (- (cadadr vp) (cadar vp)) (- (car rc) 1.))
(/ (- (caadr vp) (caar vp)) (- (cadr rc) 1.))
1.
) ;_ end of vla-arrayrectangular
(setq ss (ssget "X" (list (cons 0 "TEXT"))))
(if (> (setq c (- (setq x (sslength ss)) (length lst))) 0)
(repeat c (entdel (setq e (ssname ss (setq x (1- x))))) (ssdel e ss))
) ;_ end of if
(repeat (setq i (sslength ss))
(setq i (1- i))
(mapcar ''((x) (vlax-put (vlax-ename->vla-object (ssname ss i)) x (nth i (acad_strlsort lst))))
'(Layer TextString)
) ;_ end of mapcar
) ;_ end of repeat
) ;_end of progn
)
(terpri)
ss
) ;_ end of defun
v2007确实有dynmode,但唯一的问题是有限的显示取决于屏幕大小。
通过键控,你的(c:tt)更快,所以我固定了一点为单隔离。职位#9
我认为使用数据链路连接器比这种方法更好。因为,字体太小了。 i mean 2007 same issue, so try off the dynmode.
i can't help because i don't know which to control dynmode size/ page
i think Lee Mac post#3 is the solution
-layer
since i can't help with dynmode,
or try alternative by displaying layer name on the screen?
then use native acad command layiso
(vl-load-com)(defun SS_ARRAY (/ i j k doc lst x ss vp rc) ;hanhphuc 09/12/14 (setq doc (vlax-get-acad-object)) (vlax-for lay (foreach x '(ActiveDocument Layers) (setq doc (vlax-get doc x))) (setq lst (cons (vla-get-name lay) lst)) ) ;_ end of vlax-for (if (< (length lst) 20 ); min=2, you adjust here , example using lst < 20 (c:tt) ; use your code if vla-object (entmakex (vl-list* '(0 . "TEXT") '(1 . "*") '(72 . 4) (cons 40 (* (/ (getvar 'viewsize) (cadr (getvar 'screensize))) 7.)) (mapcar ''((x) (cons x (car vp))) '(10 11)) ) ;_ end of list ) ;_ end of entmakex ) ;_ end of vlax-ename->vla-object (car rc) ;row (cadr rc) ;col 1 (/ (- (cadadr vp) (cadar vp)) (- (car rc) 1.)) (/ (- (caadr vp) (caar vp)) (- (cadr rc) 1.)) 1. ) ;_ end of vla-arrayrectangular (setq ss (ssget "X" (list (cons 0 "TEXT")))) (if (> (setq c (- (setq x (sslength ss)) (length lst))) 0) (repeat c (entdel (setq e (ssname ss (setq x (1- x))))) (ssdel e ss)) ) ;_ end of if (repeat (setq i (sslength ss)) (setq i (1- i)) (mapcar ''((x) (vlax-put (vlax-ename->vla-object (ssname ss i)) x (nth i (acad_strlsort lst)))) '(Layer TextString) ) ;_ end of mapcar ) ;_ end of repeat) ;_end of progn) (terpri) ss ) ;_ end of defun
(defun c:test (/ *error* ss e on) (defun *error* (msg) (if on (command "layerp") ) ;_ end of if (if ss (command "_erase" ss "") ) ;_ end of if (if (> (getvar "cmdactive") 0) (princ) ) ;_ end of if (command "regen") (if (not (wcmatch (strcase msg) "*CANCEL*,*EXIT*")) (princ (strcat "\n*error : " msg)) ) ;_ end of if ) ;_ end of defun(command "_layer" "U" "*" "") (setq on (vl-cmdf "_layer" "on" "*" "") ss (SS_ARRAY)) (if (and ss (setq s (ssget "_+.:S:E:L")) ;
Thanks my dear friend , why you can't use DYN (dynmode) mode ? A2007 can do this .
Thank you for your efforts, but this method is not fast.
页:
[1]
2