添加选项以选择ob
嗨,伙计们,我正在使用这个lisp:;;published by kpblc
;;http://www.arcada.com.ua/forum/viewtopic.php?t=526
(defun c:normblocks (/ adoc answer lays lock lay *error* ans0 atype cnt)
(defun *error* (msg)(princ msg)
(if lock (foreach x lock (vla-put-lock x :vlax-true)))(vl-cmdf "_.Redraw"))
(vl-load-com)(setq cnt 0)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(setq lays (vla-get-layers adoc))
(vla-startundomark adoc)
(initget "LType LWeight Color All _ T W C A")
(if (null (setq answer
(getkword "\nIn blocks to lead to norm <All> : ")))
(setq answer "A")) ;_ end of if
(initget "byLayer byBlock")
(setq atype (getkword "\nSet contents inside the block to <byBlock>:"))
(initget "Yes No")
(setq ans0 (getkword "\nChange entities layer's to 0? <No>:"))
(vlax-for item (vla-get-blocks adoc)
(if (not (wcmatch (strcase (vla-get-name item) t) "*_space*"))
(progn
(setq cnt (1+ cnt))
(grtext -1 (strcat "Modyfied " (vla-get-name item)))
(vlax-for sub_item (vla-item (vla-get-blocks adoc) (vla-get-name item))
(setq lay (vla-item lays (vla-get-layer sub_item)))
(if (= (vla-get-lock lay) :vlax-true)
(progn (vla-put-lock lay :vlax-false)(setq lock (cons lay lock))))
(if (= ans0 "Yes")(vla-put-Layer sub_item "0"))
(cond
((= answer "W")
(vla-put-LineWeight sub_item (if (= atype "byLayer") acLnWtByLayer aclnwtbyblock))
)
((= answer "T")
(vla-put-linetype sub_item (if (= atype "byLayer") "ByLayer" "ByBlock"))
)
((= answer "C")
(vla-put-color sub_item (if (= atype "byLayer") acByLayer acByBlock))
)
(t
(vla-put-LineWeight sub_item (if (= atype "byLayer") acLnWtByLayer aclnwtbyblock))
(vla-put-linetype sub_item (if (= atype "byLayer") "ByLayer" "ByBlock"))
(vla-put-color sub_item (if (= atype "byLayer") acByLayer acByBlock))
)
) ;_ end of cond
) ;_ end of vlax-for
)
) ;_ end of if
) ;_ end of vlax-for
(if lock (foreach x lock (vla-put-lock x :vlax-true)))
(vla-regen adoc acallviewports)
(vla-endundomark adoc)(vl-cmdf "_.Redraw")
(princ (strcat"\nModyfied " (itoa cnt) " blocks"))
(princ)
) ;_ end of defun
它工作得很好,但我想添加选择我想要在哪些块上使用lisp的功能。谁能帮我一下吗?
谢谢 任何人顺便问一下,我说的有意义吗? 下面只是一个猜测变化。您需要添加myblockname请求。
(if (not (wcmatch (strcase (vla-get-name block) t) "*_space*"))
to
(if (= (wcmatch (strcase (vla-get-name block) t) myblockname)) 我使用它时会出错
“错误的参数类型:VLA-OBJECT nil”
我只想修改lisp,以便能够手动选择阻碍lisp效果的因素。目前,它会处理图形中的每个块,我希望能够选择要更改的块。 您对myblockname做了什么?是“partasdf”还是使用setq设置为变量
这是一个字符串“*\u space*”任何名称中带有\u space的块如果是这样,请不要更改,您可以执行“partasdf” 对不起,我不知道你的意思。这能让我选择用光标手动更改哪些块吗?
页:
[1]