明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1871|回复: 6

谁帮我写一个AUTOlisp程序

[复制链接]
发表于 2003-1-21 12:02:00 | 显示全部楼层 |阅读模式
本人因为工作关系经常要计算一个值很是浪费时间,谁帮我写一个谢谢!!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2003-1-21 12:47:00 | 显示全部楼层

好吧...

(Defun CL ()
       (SetQ l1 (GetDist "\nL1=")
             l2 (GetDist "\nL2=")
             w1 (GetDist "\nW1=")
             w2 (GetDist "\nW2=")
              s (+ (/ l1 w1)(/ l2 w2))
       )
       (SetQ p0 (GetPoint "\nBase point: "))
       (Command "pline" p0
                        (Polar (GetVar "Lastpoint") 0 l2)
                        (Polar (GetVar "Lastpoint") (* 0.5 Pi) w2)
                        (Polar (GetVar "Lastpoint") (- Pi)(+ l2 w1))
                        (Polar (GetVar "Lastpoint") (- (* 0.5 Pi))(+ l1 w2))
                        (Polar (GetVar "LastPoint") 0 w1)
                 "cl"
       )
       (Command "extrude" (EntLast) "" s "")
       (PrinC)
)
 楼主| 发表于 2003-1-21 14:14:00 | 显示全部楼层

还是谢谢你,我的意思是....

首先谢谢你的热心帮助!!

我的意思不是用这个程序去画图,而是用这个程序

去算这个S值,即加载这个程序后,然后选择要计算

的图案,最后自动算出S
发表于 2008-10-28 14:00:00 | 显示全部楼层
wer
发表于 2008-10-28 14:39:00 | 显示全部楼层
(defun c:ll ()

graphscr
(setq p1 (getpoint "\n选取第一点")

  p2 (getpoint "\n选取第二点")

      p3 (getpoint "\n选取第三点")

      p4 (getpoint "\n选取第四点")

      p5 (getpoint "\n选取第五点")

   (setq dx1 (- car(p3) car(p2))

            dy1 (- cadr(p3) cadr(p2))

            dx2 (- car(p2) car(p1))

            dy2 (- cadr(p2) cadr(p1))

            dx3 (- car(p4) car(p3))

            dy3 (- cadr(p4) cadr(p3))

            dx4 (- car(p5) car(p4))

            dy4 (- cadr(p5) cadr(p4))

            l1 (getdist (sqrt (+ dx1*dx1 dy1*dy1)))

            w1 (getdist (sqrt (+ dx2*dx2 dy2*dy2)))

            l2 (getdist (sqrt (+ dx3*dx3 dy3*dy3)))

            w2 (getdist (sqrt (+ dx4*dx4 dy4*dy4)))

        )

   Dist (- (/ l1 w1) (/ l2 w2))

   (princ "\n距离为:")

   (princ dist)

   (princ)

  )
发表于 2008-10-28 14:43:00 | 显示全部楼层
改为 Dist (+ (/ l1 w1) (/ l2 w2))
发表于 2008-10-29 22:51:00 | 显示全部楼层
看看这个,如果是PLINE线变要炸开才可以用
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-9-21 13:59 , Processed in 0.181657 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表