1个回答
展开全部
试试这个吧:
(defun c:asd()
(setq cmd (getvar "cmdecho")
osm (getvar "osmode")
)
(setvar "cmdecho" 0)
(setvar "osmode" 33)
(command "_undo" "be")
(if (setq bp (getpoint "\n请指定正方形中心点:"))
(if (setq h (getreal "\n请输入正方形边长:"))
(if (setq h1 (getreal "\n请输入往内偏移的距离:"))
(if (> h h1)
(progn
(setvar "osmode" 0)
(while (> h 0.0)
(setq p1 (mapcar '+ bp (list (* -0.5 h) (* -0.5 h)))
p2 (mapcar '+ bp (list (* 0.5 h) (* 0.5 h)))
)
(command "_rectang" p1 p2)
(setq h (- h h1))
)
)
(alert (strcat "正方形边为" (rtos h) "小于偏移距离" (rtos h1) "!"))
)
)
)
)
(command "_undo" "e")
(setvar "osmode" osm)
(setvar "cmdecho" cmd)
(princ)
)
(defun c:asd()
(setq cmd (getvar "cmdecho")
osm (getvar "osmode")
)
(setvar "cmdecho" 0)
(setvar "osmode" 33)
(command "_undo" "be")
(if (setq bp (getpoint "\n请指定正方形中心点:"))
(if (setq h (getreal "\n请输入正方形边长:"))
(if (setq h1 (getreal "\n请输入往内偏移的距离:"))
(if (> h h1)
(progn
(setvar "osmode" 0)
(while (> h 0.0)
(setq p1 (mapcar '+ bp (list (* -0.5 h) (* -0.5 h)))
p2 (mapcar '+ bp (list (* 0.5 h) (* 0.5 h)))
)
(command "_rectang" p1 p2)
(setq h (- h h1))
)
)
(alert (strcat "正方形边为" (rtos h) "小于偏移距离" (rtos h1) "!"))
)
)
)
)
(command "_undo" "e")
(setvar "osmode" osm)
(setvar "cmdecho" cmd)
(princ)
)
追问
万分感谢!!!!!另外再麻烦你一下~~~~偏移一层要改图层~~~麻烦只要指出改图层的语句插在哪里就行了!!!非常感谢!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
追答
(command "_rectang" p1 p2)
(command "_chprop" (entlast) "" "la" 层名 "")
(setq h (- h h1))
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询