CAD画缓和曲线lisp程序

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

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

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

资源描述

CAD中画缓和曲线,首先复制本文☆后面的源程序保存至cad安装目录的SUPPORT文件夹,保存类型为.lsp可以随便复制一个SUPPORT文件夹内的lsp文件,然后替换本文的程序。打开CAD后,输入appload回车,找到你保存的缓和曲线lsp程序,点击加载,然后就可以画缓和曲线了。首先,要画出缓和曲线的两条直线,然后输入HH回车,按提示完成缓和曲线。注:本程序,缓和曲线段拟合长度为0.4m,如需更改拟合长度,将程序的第8行(repeat(FIX(/Ls0.4))及9行(setql(+l(/Ls(FIX(/Ls0.4))))中的0.4修改即可。☆;;多义线摹拟缓和曲线。;;输入起止直线、半径、缓和曲线长或设计车速。;;命令:HH(defuncom_p()(setql0)(commanducso(list(-0x1)00))(commandpline(list000)w0(repeat(FIX(/Ls0.4))(setql(+l(/Ls(FIX(/Ls0.4))))x(+(-l(/(*lllll)40CC))(/(*lllllllll)3456CCCC))y(*id__(+(-(/(*lll)6C)(/(*lllllll)336CCC))(/(*lllllllllll)42240CCCCC))));setq(command(listxy0)));repaet);command(setqpt5(trans(listxy0)10)));com_p(defunll_v()(setqV(getreal\nGiveVelocity:)Ls1(*V0.85)Ls2(/(*0.0357VVV)R)Ls(maxLs1Ls2(/R9))Ls(*(fix(/Ls10))10.0));setq(if(LsR)(setqLsR))(ll_d));ll_v(defunll_d()(setqos(getvarosmode))(setvarosmode0)(setqC(*LsR)q(-(+(-(/Ls2)(/(*LsLsLs)240RR))(/(*LsLsLsLsLs)34560RRRR))(/(*LsLsLsLsLsLsLs)8386560RRRRRR))pt1(cdr(assoc10(entget(carp1))))pt2(cdr(assoc11(entget(carp1))))pt10(polarpt1(anglept1pt2)(/(distancept1pt2)2))pt3(cdr(assoc10(entget(carp2))))pt4(cdr(assoc11(entget(carp2))))pt20(polarpt3(anglept3pt4)(/(distancept3pt4)2))p(+(-(/(*LsLs)24R)(/(*LsLsLsLs)2688RRR))(/(*LsLsLsLsLsLs)506880RRRRR))jd(interspt1pt2pt3pt4nil)alf1(anglept10jd)alf2(anglept20jd)alf(-(anglejdpt20)alf1));setq(if(or(alfpi)(and(alf0)(alf(-0pi))))(progn(setqid__-1)(if(alfpi)(setqalf(-(+pipi)alf))(setqalf(absalf))));progn(progn(setqid__1)(if(=alf(-0pi))(setqalf(+pipialf))));progn);if(setqx0(/(*(+pR)(sin(/alf2.0)))(cos(/alf2.0)))x1(+x0q)Cl(+(*alfR)Ls)E(-(/(+Rp)(cos(/alf2)))R));setq(commanducsojd)(commanducsz(/(*180alf1)pi))(com_p)(setqpt6pt5)(setqppt1(listx100))(commanducs)(commanducsojd)(commanducsz(/(*180alf2)pi))(setqid__(-0id__))(com_p)(setqppt2(listx100))(commanducs)(if((abs(distancejdpt1))(abs(distancejdpt2)))(setqptt1pt1)(setqptt1pt2));if(setqptt2(polarjdalf1(-0x1)))(thhp1ptt110)(thhp1ptt211)(if((abs(distancejdpt3))(abs(distancejdpt4)))(setqptt3pt3)(setqptt3pt4));if(setqptt4(polarjdalf2(-0x1)))(thhp2ptt310)(thhp2ptt411)(if(=id__1)(commandarcpt5ept6rR)(commandarcpt6ept5rR))(setqalfd(angfalf))(setvarosmodeos)(commandcmdecho1)(commandtextpausepause(strcat偏角=alfd))(commandcmdecho0)(commandtext(strcat半径=(rtosR22)))(commandtext(strcat切线长=(rtosx122)))(commandtext(strcat曲线长=(rtosCl22)))(commandtext(strcat外距=(rtosE22)))(commandtext(strcat缓曲长=(rtosLs22))));ll_d(defunangf(alf)(setqalff(angtosalf14)n1kk(strlenalff))(repeatkk(setqalfn(substralffn1))(if(=alfnd)(setqnnn));if(setqn(+n1)));repeat(strcat(substralff1(-nn1))%%(substralffnn)));angf(defunc:hh(/p1p2pt1pt2pt3pt4pt5pt6pt10pt20id__RVLsEp3r1xylx0x1Cjdalfalf1alf2qpClLs1Ls2)(commanducs)(setqp1nilp2nil)(while(=p1nil)(setqp1(entsel\n拾取第一条直线:)))(redraw(carp1)3)(while(=p2nil)(setqp2(entsel\n拾取第二条直线:)))(redraw(carp2)3)(initget1)(setqR(getdist\n请输入圆曲线半径R:))(initget1LsV)(setqp3(getdist\n输入缓和曲线长度(Ls)或[设计速度(V)]:))(if(=p3V)(ll_v)(progn(setqlsp3)(ll_d)))(princ));eline(defunthh(lenpth)(setqen_data(entget(carlen))old_data(assochen_data)new_data(conshpt)en(substnew_dataold_dataen_data));setq(entmoden));thh

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

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

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

×
保存成功