autolisp编程
发布网友
发布时间:2022-05-23 04:27
我来回答
共2个回答
热心网友
时间:2023-10-13 03:01
方法一:这是 Vlisp语句的
(Defun C:Test (/ curModel)
(vl-load-com)
(setq curModel (vla-get-modelSpace (vla-get-activeDocument (vlax-get-acad-object))))
(vlax-for objcurModel
(if(equal (vla-get-objectname obj) "AcDbBlockReference")
(progn
(vla-put-layer obj "0")
)
)
)
(prin1)
)
方法二:用AutoLisp语句的
思路,先用ssget取得当前所有块,然后再将其属性中的图块改为“0”追问那怎么全选图中非打印的图元呢,可能有非打印的图层,就是为了避免把需要的东西放到非打印图层里面去了!?
追答ssget函数中有很多参数呀,你打开帮助看一下就知道了
例如:(setq ss(ssget '((0 . "INSERT")(8 . "非打印的图层"))))
其中 (0 . "INSERT") 表示只选图块
(8 . "非打印的图层")表示只选指定图层
还有很多别的参数,功能很强大,你好好学一下,很简单的。
热心网友
时间:2023-10-13 03:01
(defun c:tiqu(/ a b c)
(setq c(getstring"输入点号:"))
(setq a(getpoint"\n选取点:"))
(terpri)(terpri)
(setq b(open "C:\\Documents and Settings\\Administrator\\桌面\\坐标.txt" "a"))
(print (list c a) b)
(close b)
(princ)
(c:tiqu)
)
好,我就再帮你一次吧,看看是不是这个效果?
(defun c:tiqu(/ a b i)
(setq i (uint 1 "" "\n起始编号:" 1))
(while
(setq a(getpoint"\n选取点:"))
(terpri)
(setq b(open "C:\\Documents and Settings\\Administrator\\桌面\\坐标.txt" "a"))
(print (list i a) b)
(close b)
(setq i (+ 1 i))
(princ)))
(defun ureal (bit kwd msg def / inp)
(if def
(setq msg (strcat "\n" msg "<" (rtos def 2) ">: ")
bit (* 2 (fix (/ bit 2))) )
(setq msg (strcat "\n" msg ": ")) )
(initget bit kwd)
(setq inp (getreal msg))
(if inp
inp
def ) )
(defun uint (bit kwd msg def / inp)
(if def
(setq msg (strcat "\n" msg "<" (itoa def) ">: ")
bit (* 2 (fix (/ bit 2))) )
(setq msg (strcat "\n" msg ": ")) )
(initget bit kwd)
(setq inp (getint msg))
(if inp
inp
def ))
请采纳答案,支持我一下。