;|下面看格式刷
'_matchprop
Select source object:
Select destination object(s) or [Settings]:
最后一行时,我们可以直接选取目标,也可以输入"S"来进行设置,这就是特别之处。ll_j为我指点了一下,
说飞诗的[带关键字的ssget]http://bbs.mjtd.com/thread-71545-1-1.html是他见过的最好的。昨天静心研
读了一下,希望站在巨人的肩上看得更远,结果未如愿,看下面的程序Myssget,比较接近matchprop的用法了
。Myssget可以输入一次S来进行设置,而matchprop可以任何时候输入S进行设置
initget之后,只有entsel起作用,ssget不起作用,飞诗还是开始打的entsel的主意
.各位有没有更好的办法呢?
|;
- ;;带关键字的ssget
- ;;(sslength(Myssget "\n 选择目标对象或 [设置(S)]:" "S " '((0 . "line"))))
- (defun Myssget (Msg Kwd Fil)
- ;;带过滤器的entsel
- (defun MyEntsel (msg fil / ENP)
- (princ "\n")
- (setq enp (entsel msg))
- (cond ((equal (type enp) 'STR) (DoSth enp))
- (T (and enp (ssget (cadr enp) fil)))
- )
- enp
- )
- ;;initget时do
- (defun DoSth (enp)
- (princ enp)
- )
- ;;点化字串
- (defun Pt2Str (pt)
- (strcat (rtos (car pt) 2 3)
- ","
- (rtos (cadr pt) 2 3)
- ","
- (rtos (caddr pt) 2 3)
- "\n"
- )
- )
- (or *DOC*
- (setq *DOC* (vla-get-ActiveDocument (vlax-get-acad-object)))
- )
- (cond ((cadr (ssgetfirst)) (ssget "_P" fil))
- (t
- (initget Kwd) ;随后调用entsel时
- (cond ((and (listp (MyEntsel Msg Fil))
- (/= 52 (getvar "errno"))
- )
- (vla-sendcommand *doc* (Pt2Str (cadr (grread t))))
- (ssget Fil)
- )
- (T (ssget Fil))
- )
- )
- )
- )
- ;;调用系统格式刷,主要是显示那把刷子,do nothing
- (defun C:test (/ E)
- (setq e (car (entsel)))
- (COMMAND "MATCHPROP" E)
- (sslength
- (Myssget "\n 选择目标对象或 [设置(S)]:" "S " '((0 . "line")))
- )
- (while (not (equal (getvar "cmdnames") "")) (command nil))
- )
|