答疑
答疑,哪位前辈能否帮忙看下,手绘命令调用有问题,不知道怎么调。<img src="http://bbs.mjtd.com/static/image/smiley/qq/em84.gif" border="0" smilieid="492" alt="">;;; ======================================================================
(defun c:sx ( / )
(setvar "cmdecho"0)
(vl-load-com)
(command "_layer" "m" "DGWT-REV" "c" "4" "" "" "")
(command "_sketch""""T" "p" "I" "1""")
(while (not (zerop (getvar "cmdactive")))(command pause))
(Vlax-Put (Vlax-Ename->Vla-Object(entlast)) 'ConstantWidth 20);一个个来改属性
(Vla-Put-color(Vlax-Ename->Vla-Object(entlast)) 181)
(Vla-Put-layer(Vlax-Ename->Vla-Object(entlast))"DGWT-REV")
;;; (COMMAND "CHANGE"(entlast)"" "PROPERTIES" "la" "DGWT-REV""c""181" "lw""4" "") ;非全局宽度,显示可观
(princ)
)
ferious 发表于 2024-1-8 13:42
多谢,是草图,sketch。能帮忙再看下吗?
(command "_sketch""""T" "p" "I" "1""")
下次用下边的回复 我能更快的看到(defun c:sx (/ bjty lm-entmake-layer make-ssadd obj ss ss-enlst)
(defun make-ssadd (en / lst)
(if en
(progn
(while (setq en (entnext en))
(if (not (member (cdr (assoc 0 (entget en)))
'("ATTRIB" "VERTEX" "SEQEND")
)
)
(setq LST (cons en LST))
)
)
(ss-enlst (reverse LST))
)
(ssget "X")
)
)
(defun ss-enlst (ss / enlst)
(cond
((= (type ss) 'PICKSET)
(vl-remove-if-not '(lambda (x) (= (type x) 'ENAME)) (mapcar 'cadr (ssnamex SS)))
)
((= (type ss) 'LIST)
(setq enlst (ssadd))
(last (mapcar '(lambda (x) (ssadd x enlst)) ss))
)
)
)
(setvar "cmdecho" 0)
(vl-load-com)
(if(null(tblsearch "layer" "DGWT-REV"))
(command "_layer" "n" "DGWT-REV" "c" "4" "DGWT-REV" "")
)
(setq bjty (entlast))
(command "_sketch" "" "p")
(setq ss (make-ssadd bjty))
(foreach ty (ss-enlst ss)
(setq obj (vlax-ename->vla-object ty))
(vla-put-color obj 181)
(vla-put-layer obj "DGWT-REV" )
)
(princ)
)
本帖最后由 飞雪神光 于 2024-1-8 12:30 编辑
(defun c:sx (/ lm-entmake-layer obj)
(setvar "cmdecho" 0)
(vl-load-com)
(defun lm-entmake-layer(datalst)
(mapcar'set '(tc co) datalst)
(or co (setq co 256))
(or tc (setq tc (getvar "clayer")))
(entmake (list '(0 . "LAYER")'(100 . "AcDbSymbolTableRecord")'(100 . "AcDbLayerTableRecord")(cons 2 tc)(cons 62 co)'(70 . 0)'(6 . "CONTINUOUS")))
)
(if(null(tblsearch "layer" "DGWT-REV"))
(lm-entmake-layer (list "DGWT-REV" 4))
)
(command "pline" )
(while (not (zerop (getvar "cmdactive"))) (command pause))
(setq obj (Vlax-Ename->Vla-Object(entlast)))
(vla-put-constantwidth obj 20)
(vla-put-color obj 181 )
(vla-put-layer obj "DGWT-REV" )
(princ)
)
(defun c:sx (/ lm-entmake-layer obj)
(setvar "cmdecho" 0)
(vl-load-com)
(if(null(tblsearch "layer" "DGWT-REV"))
(command "_layer" "n" "DGWT-REV" "c" "4" "DGWT-REV" "")
)
(command "pline")
(while (not (zerop (getvar "cmdactive"))) (command pause))
(setq obj (Vlax-Ename->Vla-Object(entlast)))
(vla-put-constantwidth obj 20)
(vla-put-color obj 181 )
(vla-put-layer obj "DGWT-REV" )
(princ)
)
多谢,是草图,sketch。能帮忙再看下吗?
(command "_sketch""""T" "p" "I" "1""")
感谢前辈,手绘线ok
前辈,好像不对,画出的是直线,不是pl?能帮忙再看下那个Sk语句?
还有能不能增加,鼠标左键点击后开始画线,完事直接空格退出的功能 ferious 发表于 2024-1-10 09:06
还有能不能增加,鼠标左键点击后开始画线,完事直接空格退出的功能
下次点这里 ↓ 回复我 要不我看不到 我第一次给你的就是pl线 你要用草图画 就再合并一下生成的直线 点击后开始画线 就自己加个getpoint
↓
↓
↓
↓
↓
↓
↓
↓ 飞雪神光 发表于 2024-1-10 11:41
下次点这里 ↓ 回复我 要不我看不到 我第一次给你的就是pl线 你要用草图画 就再合并一下生成的直线 点 ...
嗯,好的。sk命令有一个多段线模式,不是直接pl命令或者entmake生成多段线()。但是这个sk命令的command语句我写总是出错,问题在这里,能帮忙解绝下吗?
ferious 发表于 2024-1-10 12:01
嗯,好的。sk命令有一个多段线模式,不是直接pl命令或者entmake生成多段线()。但是这个sk命令的command ...
按命令流多试试 我07的 命令流和你的不一样
页:
[1]
2