搜集整理CAD的lisp合集标注偏移文字复制等很多扩展功能非常全面_第1页
搜集整理CAD的lisp合集标注偏移文字复制等很多扩展功能非常全面_第2页
搜集整理CAD的lisp合集标注偏移文字复制等很多扩展功能非常全面_第3页
搜集整理CAD的lisp合集标注偏移文字复制等很多扩展功能非常全面_第4页
搜集整理CAD的lisp合集标注偏移文字复制等很多扩展功能非常全面_第5页
已阅读5页,还剩90页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

日常使用收集整理的几十个非常常用的一些lisp,全都是源码,加载就能用,用好了画图速度提升百分之五十以上,超级全超级好用的,共同学习,一起进步!!;;;;根据出图比例打断交叉线输入WS设置比例(defunc:vr()(progn(setqxxx1)(setqmyosmode(getvar"osmode"))(setqs(getvar"userr1"))(whilexxx(setqp0(getpoint"\n选择交叉点:"))(if(nullp0)(progn(setqxxxnil))(progn(setqsetline(entsel"\n选择一条直线"))(if(nullsetline)(setvar"osmode"myosmode)(progn(setqp01(cdr(assoc10(entget(carsetline)));;;获得所选直线的端点))(setqan1(anglep0p01))(setqan2(anglep01p0))(setqp1(polarp0an1(*2s))p2(polarp0an2(*2s)));;;这里的2可以修改成你需要的数值(setvar"osmode"0)(command"break"setline"f"p1p2)(setvar"osmode"myosmode))))))(prin1)));;;;统计多个多段线长度和(defunC:cd(/ssvlens)(vl-load-com)(if(ssget'((0."*LINE,ARC,CIRCLE,ELLIPSE")))(progn(setqssv (vla-get-activeselectionset (vla-get-activedocument(vlax-get-acad-object)) ) ;获得vla形式的当前选择集 lens0 ;总长初值)(vlax-forobjssv;obj为形参 (setqlens(+lens(vlax-curve-getdistatparamobj(vlax-curve-getendparamobj)))) )(princ(strcat"\n共有"(itoa(vla-get-countssv))"条线段,总长度为"(rtoslens26)"\r"))(alert(strcat"共有"(itoa(vla-get-countssv))"条线段,\n\n总长度为"(rtoslens26)"\r"))(vla-deletessv)(vlax-release-objectssv)))(princ));;;;Z轴归零很多时候对象Z坐标不为零造成无法捕捉交点(defunC:zzgl(/recobj);这个程序会将所有对象全部压扁到xy平面内,成为一张“相片”,包括三维对象---------------------(vl-load-com)(setqsys(vlax-get-or-create-object"WScript.Shell"))(setqres(vlax-invoke-methodsys'popup"此命令将把本图形中所有对象的Z坐标改为0,\n\n要继续吗?"0"Z坐标改为零"(+323)))(if(=res6)(progn(setvar"cmdecho"0)(command"undo""be")(setqrecobj(vlr-reactors:VLR-Object-reactor));列出图档中所有对象反应器(ifrecobj(vlr-remove-all:VLR-Object-reactor));如有对象反应器,则全部禁用(command"_.UCS""")(command"_.move""_all"""'(001e99)"" "_.move""_p"""'(00-1e99)"")(ifrecobj (mapcar'vlr-add(cdarrecobj));启用全部对象反应器 )(command"undo""e")(SETVAR"cmdecho"1)))(princ));;;;用以查找包含特定字符串的字符串没啥用(defunc:cz()(vl-load-com)(princ"\n输入包含的字符\n")(setqa1(getstring))(princ"\n确定查找范围\n")(setqss1(ssget))(setqn1(sslengthss1))(setqss2(ssadd))(setqn20)(while(<n2n1)(setqa2(ssnamess1n2))(setqa3(entgeta2))(if(="TEXT"(cdr(assoc0a3)))(progn (setqa4(cdr(assoc1a3))) (setqa5(vl-string-searcha1a4)) (if(/=a5nil) (ssadda2ss2) );ifend );prognend);ifend(setqn2(+n21)));whileend(sssetfirstnilss2)(princ));;;;设置出图比例作为其它命令的参数(defunc:ws()(setqoldr(getvar"userr1"))(setqn(getint(strcat"\n输入新比例<"(rtosoldr21)">:")))(setvar"userr1"n)(princ))(defunc:ce()(setqoldr(getvar"celtscale"))(setqn(getreal(strcat"\n输入当前对象线型缩放比例<"(rtosoldr21)">:")))(setvar"celtscale"n)(princ));;;;编号自动加n(defunc:zz()(vl-load-com)(princ"\n编号自动加1")(setqa(ssget))(princ"\n输入增量:(默认为1)")(setqn5(getint))(if(=nuln5)(setqn41)(setqn4n5))(setqn2(sslengtha))(setqn30)(while(<n3n2)(setqa1(ssnamean3))(setqb(entgeta1))(setqj(cdr(assoc0b)))(setqs(cdr(assoc1b)))(cond((and(="TEXT"j)(/=nil(vl-string-position(ascii"-")s)))(progn(setqn(strlens))(setqn1(vl-string-position(ascii"-")s))(setqg(substrs1(+1n1)))(setqd(substrs(+n12)))(setqe(+(atoid)n4))(setqf(rtose20))(setqh(strcatgf))(setqi(subst(cons1h)(assoc1b)b))(entmodi));prognend );first((and(="TEXT"j)(/=nil(vl-string-position(ascii"A")s)))(progn(setqn(strlens))(setqn1(vl-string-position(ascii"A")s))(setqg(substrs1(+1n1)))(setqd(substrs(+n12)))(setqe(+(atoid)n4))(setqf(rtose20))(setqh(strcatgf))(setqi(subst(cons1h)(assoc1b)b))(entmodi));prognend );first((and(="TEXT"j)(/=nil(vl-string-position(ascii"B")s)))(progn(setqn(strlens))(setqn1(vl-string-position(ascii"B")s))(setqg(substrs1(+1n1)))(setqd(substrs(+n12)))(setqe(+(atoid)n4))(setqf(rtose20))(setqh(strcatgf))(setqi(subst(cons1h)(assoc1b)b))(entmodi));prognend );first((and(="TEXT"j)(=(atofs)(reads)(fix(atofs))))(progn (setqa2(atois)) (setqa3(+a2n4)) (setqa4(itoaa3)) (setqa5(subst(cons1a4)(assoc1b)b))(entmoda5)));second((and(="TEXT"j)(/=nil(vl-string-position(ascii".")s)))(progn(setqa2(atofs)) (setqa3(+a2n4)) (setqa4(rtosa323)) (setqa5(subst(cons1a4)(assoc1b)b))(entmoda5));prognend );third(tnil );fourth);condend(setqn3(+1n3)));whileend(princ));;;;编号自动减n(defunc:ee()(vl-load-com)(princ"\n编号自动减1")(setqa(ssget))(princ"\n输入减量:(默认为1)")(setqn5(getint))(if(=nuln5)(setqn41)(setqn4n5))(setqn2(sslengtha))(setqn30)(while(<n3n2)(setqa1(ssnamean3))(setqb(entgeta1))(setqj(cdr(assoc0b)))(setqs(cdr(assoc1b)))(cond((and(="TEXT"j)(/=nil(vl-string-position(ascii"-")s)))(progn(setqn(strlens))(setqn1(vl-string-position(ascii"-")s))(setqg(substrs1(+1n1)))(setqd(substrs(+n12)))(setqe(-(atoid)n4))(setqf(itoae))(setqh(strcatgf))(setqi(subst(cons1h)(assoc1b)b))(entmodi));prognend );first((and(="TEXT"j)(=(atofs)(reads)(fix(atofs))))(progn (setqa2(atois)) (setqa3(-a2n4)) (setqa4(itoaa3)) (setqa5(subst(cons1a4)(assoc1b)b))(entmoda5)));second(tnil );third);condend(setqn3(+1n3)));whileend(princ));;;;统一文字内容(defunc:rr()(princ"\n本函数用于两文字内容统一")(setqss1(car(entsel"\n选择源文字")))(princ"选择目标文字")(setqss2(ssget))(setqent1(entgetss1))(setqwz1(assoc1ent1))(setqn1(sslengthss2))(setqn20)(while(<n2n1)(setqnm(ssnamess2n2))(setqa1(entgetnm))(setqa2(assoc1a1))(setqa3(substwz1a2a1))(entmoda3)(setqn2(+n21)))(princ));;;;两文字内容对换(defunc:hh()(princ"\n本函数用于两文字内容交换")(setqss1(car(entsel"\n选择文字1")))(setqss2(car(entsel"\n选择文字2")))(setqent1(entgetss1))(setqent2(entgetss2))(setqwz1(assoc1ent1))(setqwz2(assoc1ent2))(setqent3(substwz1(assoc1ent2)ent2))(setqent4(substwz2(assoc1ent1)ent1))(entmodent3)(entmodent4)(princ));;;;;画线打断所有相交线(defunc:dz(/ssbrk_objentsssobjscmdobj_eraseonlockedlayerssget->vla-listlist->3pair)(vl-load-com)(princ"\n画线打断所有交线")(defunonlockedlayer(ename/entlst)(setqentlst(tblsearch"LAYER"(cdr(assoc8(entgetename)))))(=4(logand4(cdr(assoc70entlst)))))(defunssget->vla-list(ssent/ienamelst)(setqi-1)(while(setqename(ssnamess(setqi(1+i))));;checkforlockedlayer,donotuseifonlockedlayer(if(and(not(onlockedlayerename))(not(equalenameent)));excludebreakobject(setqlst(cons(vlax-ename->vla-objectename)lst))))lst)(defunlist->3pair(old/new)(while(setqnew(cons(list(carold)(cadrold)(caddrold))new)old(cdddrold)))(reversenew))(setqcmd(getvar"CMDECHO"))(setvar"CMDECHO"0)(command".undo""begin");;getbreaklineorobject(if(and(progn(prompt"\nSelectobjectstobreak:")(setqss(ssget'((0."LINE,ARC,SPLINE,LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE")))))(setqp1(getpoint"\nDrawBreakinglineorpressENTERtoselect:"))(setqp2(getpointp1"\nPickendofline.")))(progn;gotpointsforaline(vl-cmdf"._line"p1p2"")(setqent(entlast)obj_eraset;removeitwhendone))(ifss(while(progn(setqent(car(entsel"\nSelectbreakentity,Noblocks.")))(cond((nullent)nil)((member(cdr(assoc0(entgetent)))'("LINE""ARC""SPLINE""LWPOLYLINE""POLYLINE""CIRCLE""ELLIPSE"))nil)(t(prompt"\n***Wrongobjecttype,Tryagain.")t))))))(if(andssent(setqssobjs(ssget->vla-listssent)))(progn(setqbrk_obj(vlax-ename->vla-objectent))(mapcar'(lambda(obj2Break/iplistbrkobjlstlastent);loopthroughlistofobjectstobebroken;getlistofintersectpoints(setqiplist(vl-catch-all-apply'vlax-safearray->list(list(vlax-variant-value(vla-intersectwithbrk_objobj2Breakacextendnone)))))(setqbrkobjlst(consobj2Breakbrkobjlst));collecttheoriginalobjecttobebroken(if(not(vl-catch-all-error-piplist));errorifnointersection(mapcar;loopthroughintersectpoints'(lambda(pt/cenelstmaxparamminparamp1p2p1paramp2param);;getlastentitycreatedviabreakincasemultiplebreaks(if(andlastent(not(equallastent(vlax-vla-object->enamebrk_obj))));ignorethebreakobject(progn;newobjectcreatedviabreak,putinlist(setqbrkobjlst(cons(vlax-ename->vla-object(entlast))brkobjlst));;ifptnotonobjectx,switchobjects(if(not(vlax-curve-getdistatpointobj2Breakpt))(foreachobjbrkobjlst;findtheonethatptison(if(vlax-curve-getdistatpointobjpt)(setqobj2Breakobj);switchobjects)))));;HandleanyobjectsthatcannotbeusewiththeBreakCommand;;usingonepoint(cond((and(="AcDbSpline"(vla-get-objectnameobj2Break));onlyclosedsplines(vlax-curve-isClosedobj2Break))(setqp1param(vlax-curve-getparamatpointobj2Breakpt)p2param(+p1param0.000001)p2(vlax-curve-getPointAtParamobj2Breakp2param))(command"._break"(vlax-vla-object->enameobj2Break)"non"(transpt01)"non"(transp201)))((="AcDbCircle"(vla-get-objectnameobj2Break));breakthecircle(setqp1param(vlax-curve-getparamatpointobj2Breakpt)p2param(+p1param0.000001)p2(vlax-curve-getPointAtParamobj2Breakp2param))(command"._break"(vlax-vla-object->enameobj2Break)"non"(transpt01)"non"(transp201))(setqen(entlast)))((and(="AcDbEllipse"(vla-get-objectnameobj2Break));onlyclosedellipse(vlax-curve-isClosedobj2Break));;Breaktheellipse,codeborrowedfromJoeBurke6/6/2005(setqp1param(vlax-curve-getparamatpointobj2Breakpt)p2param(+p1param0.000001);(vlax-curve-getparamatpointobjp2)minparam(minp1paramp2param)maxparam(maxp1paramp2param))(vlax-putobj2Break'startparametermaxparam)(vlax-putobj2Break'endparameter(+minparam(*pi2))));;==================================;;Objectsthatcanbebroken;;==================================(t;;(command"point""non"(transpt01));;(command"._break"(vlax-vla-object->enameobj2Break)"non"(transpt01)"@")(command"._break"(vlax-vla-object->enameobj2Break)"non"(transpt01)"non"(transpt01));;couldnotgetvl-cmdf"._break"tobehave(setqlastent(entlast)))))(list->3pairiplist))))ssobjs);;removethebreakline,ifcurrentlayerisnotlocked(ifobj_erase(vl-catch-all-apply'vla-delete(listbrk_obj)))))(setvar"CMDECHO"cmd)(not(command".undo""end"))(princ));;;单纯调整行距(defunc:tz(/AALLBCLMNPh1h2VALtempXXYZ_NEWYY0Z)(princ"\n单纯调整行距")(vl-load-com)(setqcmdold(getvar"cmdecho") osmold(getvar"osmode") bliold(getvar"blipmode") dimz(getvar"dimzin") );setqend(setvar"cmdecho"0)(setvar"osmode"0)(setvar"blipmode"0)(defun*error*(msg) (setvar"cmdecho"cmdold) (setvar"osmode"osmold) (setvar"blipmode"bliold) (setvar"dimzin"dimz) (setq*error*nil) (princ) )(setqa(ssget(list(cons0"text"))))(setqn(sslengtha))(setqallnil)(setqm0)(while(<mn)(setqall(appendall(list(entget(ssnameam)))))(setqm(1+m)))(setql0)(setqm1)(while(<ln)(setqb(nthlall))(while(<mn)(setqc(nthmall))(if(>(nth2(assoc'10c))(nth2(assoc'10b))) (progn (setqall(subst'aa(nthlall)all)) (setqall(subst'bb(nthmall)all)) (setqall(substc'aaall)) (setqall(substb'bball)) (setqbc) ))(setqm(1+m)))(setql(1+l))(setqm(1+l)))(setqb(nth0all))(setqh1(assoc'40b))(setqh2(cdrh1))(setqtmp(getreal(strcat"\n行距:字高<1.62>:")))(if(/=tmpnil)(setqvaltmp)(setqval1.62))(setqval(*h2val))(setqy0(nth2(assoc'10b)))(setqm0)(while(<mn)(setqb(nthmall))(setqy(-y0(*mval)))(setqx(nth1(assoc'10b)))(setqz(nth3(assoc'10b)))(setqxyz_new(list'10xyz))(setqb(subst(cons'720)(assoc'72b)b))(setqb(subst(cons'730)(assoc'73b)b))(setqb(substxyz_new(assoc'10b)b))(entmodb)(setqm(1+m)))(*error*""));;;按层操作(DefunC:fc(/enplastrp1p2ss1doc)(setvar"cmdecho"0)(command"_.undo""be")(prompt"\n选择要筛选图层上的对象:")(graphscr)(setqstr"" enp1)(while(/=enp"")(initget"")(setqenp(entsel))(if(andenp(/=enp""))(progn (setqla(cdr(assoc8(entget(carenp))))) (if(null(vl-string-search(strcatla",")str)) (setqstr(strcatla","str)) ))))(if(/=str"")(progn(setqstr(vl-string-right-trim","str))(setqp1(getpoint"\n确定区域第一角点:"))(setqp2(getcornerp1"\n窗口第二点:"))(setqss1(ssget"W"p1p2(list(cons8str))))(sssetfirstnilss1)))(princ));;;局部重画(defunc:rew(/ENTILENGSSET)(princ"\n请选择需要重画的对象") (setqsset(ssget) leng(sslengthsset) ) (setqi0) (while(<ileng) (setqent(ssnamesseti)) (entmod(entgetent)) (setqi(+i1)) ));;文字或箭头与直线平行(defunc:wx(/cmdoldosmoldblioldwzzxent1ent2wzjdp1p2x1x2y1y2xlent3)(vl-load-com)(setqcmdold(getvar"cmdecho") osmold(getvar"osmode") bliold(getvar"blipmode") dimz(getvar"dimzin") );setqend(setvar"cmdecho"0)(setvar"osmode"0)(setvar"blipmode"0)(defun*error*(msg) (setvar"cmdecho"cmdold) (setvar"osmode"osmold) (setvar"blipmode"bliold) (setvar"dimzin"dimz) (setq*error*nil) (princ) )(setqwz(entsel"\n选择文字或箭头"));选文字(setqzx(entsel"\n选择直线"));选直线(setqent1(entget(carwz)))(setqent2(entget(carzx)))(setqwzjd(cdr(assoc50ent2)))(setqp1(cdr(assoc10ent2)))(if(="LINE"(cdr(assoc0ent2)))(setqp2(cdr(assoc11ent2)))(foreachttent2(if(=10(cartt))(setqp2(cdrtt)) )))(setqx1(nth0p1))(setqy1(nth1p1))(setqx2(nth0p2))(setqy2(nth1p2))(if(/=x1x2)(progn(setqxl(/(-y1y2)(-x1x2))) (setqwzjd(atanxl)));prognend(setqwzjd(/pi2)));ifend(setqent3(subst(cons50wzjd)(assoc50ent1)ent1))(entmodent3)(setvar"cmdecho"cmdold)(setvar"osmode"osmold)(setvar"blipmode"bliold)(princ)(*error*""));defunend;;;一键打开关闭属性对话框(DEFUNC:sx()(IF(=(GETVAR"opmstate")1)(COMMAND"propertiesclose")(COMMAND"properties")));;;一键打开关闭对象捕捉(DEFUNC:dv()(IF(=(GETVAR"osmode")0)(setvar"osmode"4791)(setvar"osmode"0)));;;;直接打断(defunc:t()(command"trim"""));;;;直接延长(defunc:ex()(command"extend"""));;;;画多段线自动确定线宽用WS设置比例1:100时-GPS-PS层线宽50其它为40(defunc:q()(princ"\n请先设置系统变量userr1,如50,100,150")(princ"\n指定多段线起点")(setqus(getvar"userr1"))(setqlw1(*0.4us))(setqlw2(*0.5us))(if(=(getvar"clayer")"-bj-PS")(command"pline"pause"w"lw2"")(command"pline"pause"w"lw1""))(princ));;;;;;;镜像默认删除源(defunc:g(/k)(setqk(ssget))(command"mirror"k""pausepause"y"));;;;;;;镜像默认删除源(defunc:gx(/k)(setqk(ssget))(command"mirror"k""pausepause"n"));;;;;复制一次(defunc:c()(command"copy"));;;旋转并复制所选择的物体(defunc:XF(/a1p1)(setqa1(ssget))(command"copy"a1"""0,0,0""0,0,0""rotate"a1""));;;;改成虚线-------------------------------XX(defunc:XX(/ent)(setqent(ssget))(command"change"ent"""p""lt""DASH"""));;;;;改成虚线成直线-------------------------------zx(defunc:zx(/ent)(setqent(ssget))(command"change"ent"""p""lt""continuous"""));;;;;打断到线(defunC:Tf()(command"TRIM"));;;;;;延长到线(defunC:ef()(command"extend"));;;;;;;批量修改文字内容(defun*error*(st)(princ(strcat"Error:"st))(princ))(defunC:wz();;; /testsslennen1aoldrnewrentnn)(setvar"CMDECHO"0)(setqtestTnn0)(whiletest(setqss(ssadd))(setqss(ssget))(if(=nilss)(setqtestnil)(progn (setqlen(sslengthss)) (setqn1s1) (while(<=nlen) (setqen1(ssnamess(1-n))) (setqa(entgeten1)) (if(="TEXT"(cdr(assoc0a))) (progn (if(=s1) (progn (setqoldr(cdr(assoc1a))) (setqnewr(getstring"\n输入新文本:\n")) (if(=newrnil)(setqnewroldr)) (setqsnil) ) ) (setqent(subst(cons1newr)(assoc1a)a)) (entmodent)(setqnn(1+nn)) ) ) (setqn(1+n)) ))))(princ(strcat(itoann)"changed!"))(princ));;;;;;修改文字的宽度比例(defun*error*(st)(princ(strcat"Error:"st))(princ))(defunC:gb(/testsslennen1aoldrnewrentnn)(setvar"CMDECHO"0)(setqtestTnn0)(whiletest(setqss(ssadd))(setqss(ssget))(if(=nilss)(setqtestnil)(progn (setqlen(sslengthss)) (setqn1s1) (while(<=nlen) (setqen1(ssnamess(1-n))) (setqa(entgeten1)) (if(="TEXT"(cdr(assoc0a))) (progn (if(=s1) (progn (setqoldr(cdr(assoc41a))) (setqnewr(getreal(strcat"\nNewscale<"(rtosoldr21)">:"))) (if(=newrnil)(setqnewroldr)) (setqsnil) ) ) (setqent(subst(cons41newr)(assoc41a)a)) (entmodent)(setqnn(1+nn)) ) ) (setqn(1+n)) ))))(princ(strcat(itoann)"changed!"))(princ));=======================================;|修改文字的高度|;|Ver:1.0作者:迟俊岭|;=======================================(defun*error*(st)(princ(strcat"Error:"st))(princ))(defunC:gd(/testsslennen1aoldrnewrentnn)(setvar"CMDECHO"0)(setqtestTnn0)(whiletest(setqss(ssadd))(setqss(ssget))(if(=nilss)(setqtestnil)(progn (setqlen(sslengthss)) (setqn1s1) (while(<=nlen) (setqen1(ssnamess(1-n))) (setqa(entgeten1)) (if(="TEXT"(cdr(assoc0a))) (progn (if(=s1) (progn (setqoldr(cdr(assoc40a))) (setqnewr(getreal(strcat"\nNewhigh<"(rtosoldr21)">:"))) (if(=newrnil)(setqnewroldr)) (setqsnil) ) ) (setqent(subst(cons40newr)(assoc40a)a)) (entmodent)(setqnn(1+nn)) ) ) (setqn(1+n)) ))))(princ(strcat(itoann)"changed!"))(princ));;;打开所有的图层(DefunC:FD()(PROMPT"打开所有的图层")(terpri)(command"-LAYER""on""*"""));;;打开防火分区层(DefunC:D()(PROMPT"打开防火分区图层")(terpri)(command"-LAYER""on""防火分区"""));;;关闭除所选择物体图层以外其他所有的图层;;;(DefunC:FB(/abcd);;(PROMPT"关闭除所选择物体图层以外其他所有的图层")(terpri);;(graphscr);;(setqa(entsel));;(setqb(entget(cara)));;(setqc(assoc8b));;(setqd(cdrc));;(command"-LAYER""s"d"OFF""*""n"""));;;关闭选择物体所在的图层(DefunC:GZ(/abcd)(PROMPT"关闭所选择物体所在的图层")(terpri)(graphscr)(setqa(entsel))(setqb(entget(cara)))(setqc(assoc8b))(setqd(cdrc))(command"-LAYER""off"d""));;;冻结选择物体所在的图层(DefunC:dj(/abcd)(PROMPT"冻结所选择物体所在的图层")(terpri)(graphscr)(setqa(entsel))(setqb(entget(cara)))(setqc(assoc8b))(setqd(cdrc))(command"-LAYER""F"d""));;;解冻所有的图层(DefunC:JD()(PROMPT"解冻所有的图层")(terpri)(command"-LAYER""T""*"""));;;锁定选择物体所在的图层(DefunC:SD(/abcd)(PROMPT"锁定所选择物体所在的图层")(terpri)(graphscr)(setqa(entsel))(setqb(entget(cara)))(setqc(assoc8b))(setqd(cdrc))(command"-LAYER""LO"d""));;;解锁选择物体所在的图层(DefunC:JS(/abcd)(PROMPT"解锁所选择物体所在的图层")(terpri)(graphscr)(setqa(entsel))(setqb(entget(cara)))(setqc(assoc8b))(setqd(cdrc))(command"-LAYER""U"d""));;;解锁所有图层(DefunC:jq()(PROMPT"解锁所有图层")(terpri)(command"-LAYER""u""*"""));;;改变所选线的线形为"dashed"(DEFUNC:dashed()(PROMPT"改变所选线的线形为DASHED")(terpri)(SETQTEX(SSGET))(COMMAND"CHPROP"TEX"""LT""DASHED"""));;;改变所选线的线形为"hidden"(DEFUNC:hidden()(PROMPT"改变所选线的线形为HIDDEN")(terpri)(SETQTEX(SSGET))(COMMAND"CHPROP"TEX"""LT""hidden"""));;;改变所选线的线形为"hidden2"(DEFUNC:hidden2()(PROMPT"改变所选线的线形为HIDDEN2")(terpri)(SETQTEX(SSGET))(COMMAND"CHPROP"TEX"""LT""hidden2"""));---------------CHANGETOCURRENTLAYERFUNCTION---------------;Changesthelayerofselectedobject(s)tothecurrentlayer;改变对象到当前图层(DefunC:GC(/SSCNTLAY);;;(if(not(setqSS(ssget"i")));;;(progn;;;(prompt"\nSelectobjectstobeCHANGEDtothecurrentlayer:");;;(setqSS(ssget));;;);;;)(setqSS(ssget))(ifSS(progn(setqCNT(sslengthSS))(princ(strcat"\n"(itoaCNT)"found."));Reportnumberofitemsfound(command"_.move"SS"");filteroutobjectsonlockedlayers(if(>(getvar"cmdactive")0);iftherearestillobjectsleft(progn(command"0,0""0,0")(setqSS(ssget"p")CNT(-CNT(sslengthSS));countthem))(setqSSnil);elseabortoperation)(if(>CNT0);ifitemswherefilteredout(if(=CNT1)(princ(strcat"\n"(itoaCNT)"wasonalockedlayer."));reportit.(princ(strcat"\n"(itoaCNT)"wereonalockedlayer."))))))(ifSS(progn(setqLAY(getvar"CLAYER"))(command"_.change"SS"""_p""_la"LAY"")(if(=(sslengthSS)1)(prompt(strcat"\nOneobjectchangedtolayer"LAY"(thecurrentlayer)."))(prompt(strcat"\n"(itoa(sslengthSS))"objectschangedtolayer"LAY"(thecurrentlayer).")))))(princ));;;宽度格式刷(defunfe_s()(setqwd1"\n当前匹配属性:"wd0"不匹配属性:")(if(=fe_color1)(setqwd1(strcatwd1"颜色"))(setqwd0(strcatwd0"颜色")))(if(=fe_layer1)(setqwd1(strcatwd1"图层"))(setqwd0(strcatwd0"图层")))(if(=fe_ltype1)(setqwd1(strcatwd1"线形"))(setqwd0(strcatwd0"线形")))(if(=fe_ltsca1)(setqwd1(strcatwd1"线形比例"))(setqwd0(strcatwd0"线形比例")))(if(=fe_asywh1)(setqwd1(strcatwd1"变宽线形"))(setqwd0(strcatwd0"变宽线形")))(if(=wd1"\n当前匹配属性:")(setqwd1"\n当前匹配属性:宽度")(setqwd1(strcatwd1"。")))(if(=wd0"不匹配属性:")(setqwd0"")(setqwd0(strcatwd0"。")))(princ(strcat"\n***"wd1wd0))(initget"12345")(setqsetk(getkword"\n改变:颜色1/图层2/线形3/线形比例4/变宽线形5/<确认>:"))(cond((=setk"1")(if(=fe_color1)(setqfe_color0)(setqfe_color1))(fe_s))((=setk"2")(if(=fe_layer1)(setqfe_layer0)(setqfe_layer1))(fe_s))((=setk"3")(if(=fe_ltype1)(setqfe_ltype0)(setqfe_ltype1))(fe_s))((=setk"4")(if(=fe_ltsca1)(setqfe_ltsca0)(setqfe_ltsca1))(fe_s))((=setk"5")(if(=fe_asywh1)(setqfe_asywh0)(setqfe_asywh1))(fe_s))(tnil)))(defunfe_b(numenumum/jb0bj)(if(and(assocnumei)enum)(setqei(substenum(assocnumei)ei))(ifenum(setqei(reverse(consenum(reverseei))))(if(assocnumei)(progn(setqj-1b0nil)(repeat(lengthei)(setqj(1+j)bj(nthjei))(if(/=bj(assocnumei))(setqb0(consbjb0))(ifum(setqb0(cons(consnumum)b0)))))(setqei(reverseb0)))))))(defunfe_main()(setqlen(sslengthss1)i-1ent0(entget(carent1))e62(assoc62ent0)e8(assoc8ent0)e6(assoc6ent0)e48(assoc48ent0)e43(assoc43ent0)e90(cdr(assoc90ent0)))(if(>=e903)(progn(repeat3(setqent

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论