:请教我用lsp文件做一个命令,按所选颜色来移动对象,我的意思是说在同一个图层里有多种颜色的情况下,请尽量用简单的程序,详细的说明,谢谢,还有能不能告诉我一个自学auto lisp 语言的网站,
:请教我用lsp文件做一个命令,按所选颜色来移动对象,我的意思是说在同一个图层里有多种颜色的情况下,请尽量用简单的程序,详细的说明,谢谢,还有能不能告诉我一个自学auto lisp 语言的网站,
2楼
不知道符合你的要求不 ?
http://www.pianyiba.com/product/697654/
回复
3楼
auto cad 中加载的lisp程序怎么改小数点后的位数呢?
有一个标坐标值(x,y)的lisp程序,但是小数点后小数位数是4位,怎样改成2位呢?多谢指教。请直接把源代码写下来哦,并表明更改的位置。
(DEFUN WIDSET()
(INITGET 1 "Y N")
(SETQ IDSET1 (GETKWORD "\n是否标注编号? <Y or N>"))
(INITGET 1 "Y N")
(setq idset2 (getkword "\n是否标竖向?<Y or N>"))
(INITGET 1 "Y N")
(setq idset3 (getkword "\n是否固定标注线角度?<Y or N>"))
(INITGET 1 "Y N")
(setq bname (strcat "xy" idset1 idset2))
(setq b (getint "\n图纸比例?"))
(setq w (getreal "\n标注框的宽度<cm>?"))
(setq sca (/ (* w b ) 1000))
(if (= idset1 "Y")
(setq bh00 (getstring "\n第一交*点的编号"))
)
(PRINC)
)
(DEFUN C:WID()
(if (null sca)
(WIDSET)
(princ "\n欢迎使用道路坐标自动标注系统")
)
(setvar "cmdecho" 0)
(SETQ IDP(GETPOINT "\n选择标注点"))
(setq oooo (getvar "osmode"))
(setvar "osmode" 0)
(SETQ PPP(GETPOINT "\n选择标注位置"))
(setvar "osmode" oooo)
(if (= idset1 "Y")
(progn
(princ "\n 请输入交*点编号:<")
(princ bh00)
(princ ">")
(setq bh01 (getstring))
(IF (/= bh01 "")
(setq bh00 bh01)
)
)
(princ)
)
(SETQ A(*(/(ANGLE IDP PPP)PI)2))
(SETQ C(FIX A))
(SETQ ANG(*( (* 2 C)1)(/ pi 4.0)))
(if (= idset3 "N")
(setq dimp ppp)
(SETQ DIMP(POLAR IDP ANG(DISTANCE IDP PPP)))
)
(SETQ high (COND((= bname "xyNN")1.6)
( (= bname "xyYY")3.3)
( (= bname "xyNY")2.5)
( (= bname "xyYN")2.5)
)
)
(setq dimpx (car dimp))
(setq dimpy (cadr dimp))
(if (or (= c 3) (= c 0) )
(setq INSPx ( dimpx (* sca 5)))
(setq INSPx (- dimpx (* sca 5)))
)
(if (or (= c 0) (= c 1))
(setq INSPy ( dimpy (* sca high )))
(setq INSPy (- dimpy (* sca high)))
)
(setq INSP (LIST INSPx INSPy))
(SETQ M(CAR(TRANS IDP 1 0)))
(SETQ N(CADR(TRANS IDP 1 0)))
(SETQ X(RTOS M 2))
(SETQ Y(RTOS N 2))
(if (= idset2 "Y")
(setq z (getstring "\输入标高"))
(princ)
)
(COMMAND"LINE""none"IDP"none"DIMP"")
(cond ((= bname "xyNN")(COMMAND"INSERT" bname "none" INSP sca"""" Y X ))
((= bname "xyYN")(COMMAND"INSERT" bname "none" INSP sca"""" bh00 Y X ))
((= bname "xyNY")(COMMAND"INSERT" bname "none" INSP sca"""" Y X Z))
((= bname "xyYY")(COMMAND"INSERT" bname "none" INSP sca"""" bh00 Y X Z))
)
(if (= idset1 "Y")
(progn
(setq bhlen (strlen bh00))
(if (wcmatch bh00 "*##")
(setq bh00 (strcat (substr bh00 1 (- bhlen 2)) (itoa ( 1 (atoi (substr bh00 (- bhlen 1) ))))))
(setq bh00 (strcat (substr bh00 1 (- bhlen 1)) (chr( 1 (ascii(substr bh00 bhlen 1))))))
)
)
)
(setvar "cmdecho" 1)
(PRINC)
)
回复