CAD拼图程序lisp程序

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

(defunc:pintu(/s1fns2ddnanalpt1pt2)(setvarblipmode0)(setvarcmdecho0)(get_rowandcolumn)(setqp1(getpoint\n输入起始点:))(setqp0p1)(setqpa0'(0-10000))(setqpa1(list(carpa0)(-(cadrpa0)2000)))(setqpa2(list(+(carpa1)2000)(cadrpa1)))(setqpa3(list(carpa2)(-(cadrpa2)2000)))(setqpa4(list(+(carpa3)2000)(cadrpa3)))(setqp0p1)(setqv1(getvarosmode))(setvarosmode0)(commandzoome)(setqnuma21)(setqnuma31)(setqi0)(while(im)(setqj0);列清零(while(jn)(setqs1(ssgetWp1(list(+(carp1)1190)(+(cadrp1)845))))(whiles1(commandcopys1p1'(00))(getboundingbox)(commandzoome)(setqs2(ssgetW'(-5-5)'(1190850)))(cond((and(=dd1195)(=dd1185))(progn(commandmoves2'(00)pa0)(setqpa0(list(+(carpa0)1500)(cadrpa0)))))((and(=dd845)(=dd835))(progn(commandmoves2'(00)pa1)(setqpa1(list(carpa1)(-(cadrpa1)614)))))((and(=dd600)(=dd590))(progn(commandmoves2'(00)pa2)(setqnuma2(1+numa2))(if(=(remnuma22)0)(setqpa2(list(carpa2)(-(cadrpa2)440)))(setqpa2(list(+(carpa2)614)(+(cadrpa2)440))))))((and(=dd425)(=dd415))(progn(commandmoves2'(00)pa3)(setqnuma3(1+numa3))(if(=(remnuma32)0)(setqpa3(list(+(carpa3)440)(cadrpa3)))(setqpa3(list(-(carpa3)440)(-(cadrpa3)317))))))((and(=dd215)(=dd205))(progn(commandmoves2'(00)pa4)(setqpa4(list(+(carpa4)310)(cadrpa4)))));;;(t(setqfn(strcatf:/a4/tuhaoA4.dwg))))(setqs1nil))(setqp1(list(+(carp1)1500)(cadrp1)))(setqj(1+j)))(setqp0(list(carp0)(-(cadrp0)1500)))(setqp1p0)(setqi(1+i)))(setvarosmodev1);;;(setvarosmode16383)(princ));;;-------取得图幅幅面宽度以便判断图幅大小(defungetboundingbox(/sspt2ipt_listpt10pt11enendatamin_xmax_xmin_x_pt_listmax_x_pt_listmin_x_ptmax_x_pt)(setqpt2(list(+(carp1)1195)(+(cadrp1)850)))(setqss(ssgetWp1pt2'((0.LINE))))(setqi0)(setqpt_listnil);;;获取所有直线端点并赋值给pt_list(repeat(sslengthss)(setqen(ssnamessi))(setqendata(entgeten))(setqpt10(cdr(assoc10endata)))(setqpt_list(conspt10pt_list))(setqpt11(cdr(assoc11endata)))(setqpt_list(conspt11pt_list))(setqi(1+i)));;;获取最小点和最大点(setqpt_list(vl-sortpt_list(function(lambda(e1e2)((care1)(care2))))))(setqmin_x(car(carpt_list)))(setqpt_list(reversept_list))(setqmax_x(car(carpt_list)))(setqmin_x_pt_listnil)(setqmax_x_pt_listnil)(foreachvalpt_list(if(=(carval)min_x)(setqmin_x_pt_list(consvalmin_x_pt_list)))(if(=(carval)max_x)(setqmax_x_pt_list(consvalmax_x_pt_list))))(setqmin_x_pt_list(vl-sortmin_x_pt_list(function(lambda(e1e2)((cadre1)(cadre2))))))(setqmin_x_pt(carmin_x_pt_list))(setqmax_x_pt_list(vl-sortmax_x_pt_list(function(lambda(e1e2)((cadre1)(cadre2))))))(setqmax_x_pt(carmax_x_pt_list));;;(prin1min_x_pt);;;(prin1max_x_pt)(setqdd(-max_xmin_x))(setqdd(fixdd));;;(prin1dd));;;;;;;;不同图幅图纸,图号字符提取;;;;;;------------A0----------------------;;;(defuna0_tufu(/sss0enendata);;;(commandzoomW(list(-114425)(-605))(list(+114425)(+605)));;;(setqsss0(ssgetW(list(-114425)(-605))(list(+114425)(+605))'((0.TEXT))));;;(setqen(ssnamesss00));;;(setqendata(entgeten));;;(setqtuhao(cdr(assoc1endata)));;;);;;;;;------------A1----------------------;;;;;;(defuna1_tufu(/sss1enendata);;;(commandzoomW(list(-79625)(-605))(list(+79625)(+605)));;;(setqsss1(ssgetW(list(-79625)(-605))(list(+79625)(+605))'((0.TEXT))));;;(setqen(ssnamesss10));;;(setqendata(entgeten));;;(setqtuhao(cdr(assoc1endata)));;;);;;;;;;;;;;;------------A2----------------------;;;(defuna2_tufu(/sss2enendata);;;(commandzoomW(list(-54925)(-605))(list(+54925)(+605)));;;(setqsss2(ssgetW(list(-54925)(-605))(list(+54925)(+605))'((0.TEXT))));;;(setqen(ssnamesss20));;;(setqendata(entgeten));;;(setqtuhao(cdr(assoc1endata)));;;);;;;;;;;;------------A3----------------------;;;(defuna3_tufu(/sss3enendata);;;(commandzoomW(list(-38025)(-555))(list(+38025)(+555)));;;(setqsss3(ssgetW(list(-38025)(-555))(list(+38025)(+555))'((0.TEXT))));;;(setqen(ssnamesss30));;;(setqendata(entgeten));;;(setqtuhao(cdr(assoc1endata)));;;);;;;;;;;;------------A4----------------------;;;(defuna4_tufu(/sss4enendata);;;(commandzoomW(list(-17025)(-555))(list(+17025)(+555)));;;(setqsss4(ssgetW(list(-17025)(-555))(list(+17025)(+555))'((0.TEXT))));;;(setqen(ssnamesss40));;;(setqendata(entgeten));;;(setqtuhao(cdr(assoc1endata)));;;)(defunget_rowandcolumn(/pt3pt4ss_rowss_column)(setqpt3(getpoint\n输入第一角点:))(setqpt4(getcornerpt3\n输入第二角点:))(setqss_row(ssgetCpt3(list(carpt3)(cadrpt4))'((0.LINE))))(setqm(sslengthss_row));计算横行数(setqss_column(ssgetCpt3(list(carpt4)(cadrpt3))'((0.LINE))))(setqn(sslengthss_column));计算列数(alert(strcat共有(itoam)行,(itoan)列在界面上!)))(prompt\n=====out======)(prin1);;;(1144,60);;;(796,60);;;(549,60);;;(380,55);;;(170,55)

1 / 5
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功