怎样用lisp编写程序控制cad

2024-12-29 04:52:00
推荐回答(1个)
回答1:

(defunc:n3()(vl-load-com)(setqcm(getvar"cmdecho")os(getvar"osmode"))(setvar"cmdecho"0)(command"_undo""be")(setqpdbznil)(vlax-forobj(vla-get-Linetypes(vla-get-ActiveDocument(vlax-get-acad-object)))(if(=(vla-get-nameobj)"ACAD_ISO04W100")(setqpdbzt)))(if(=pdbznil)(command"_linetype""l""ACAD_ISO04W100"""""))(while(and(setvar"osmode"33)(setqpt1(getpoint"\n请指定PT1:")))(setvar"orthomode"1)(if(and(setqpt2(getpointpt1"\n请指定PT2:"))(setqd(getreal"\n请输入d值:"))(setqw(getreal"\n请输入w值:")))(progn(setvar"orthomode"0)(setvar"osmode"0)(setqp1(mapcar'+pt2(list(*0.5d)0.0))p6(mapcar'+pt2(list(*-0.5d)0.0))p3(mapcar'+pt1(list(*0.5w)0.0))p4(mapcar'+pt1(list(*-0.5w)0.0))p7(mapcar'+pt1(list0.0(*-0.5w)))p8(mapcar'+pt1(list(*0.5d)0.0))p9(mapcar'+pt1(list(*-0.5d)0.0))p2(intersp1p8p3p7)p5(intersp6p9p4p7))(entmake(list'(0."LWPOLYLINE")'(100."AcDbEntity")'(100."AcDbPolyline")'(62.4)'(90.4)'(70.1)(cons10p1)(cons10p2)(cons10p5)(cons10p6)))(entmake(list'(0."LWPOLYLINE")'(100."AcDbEntity")'(100."AcDbPolyline")'(62.4)'(90.4)'(70.1)(cons10p2)(cons10p3)(cons10p4)(cons10p5)))(entmake(list'(0."LINE")'(100."AcDbEntity")'(100."AcDbLine")'(62.1)'(6."ACAD_ISO04W100")'(48.0.01)(cons10(mapcar'+pt1'(03.0)))(cons11(mapcar'+pt2'(0-3.0))))))))(command"_undo""e")(setvar"osmode"os)(setvar"cmdecho"cm)(princ))