andy_lee 发表于 2022-7-5 18:49:47

绘制等腰梯形

嗨,伙计们
有这样的例行公事吗?谢谢你的帮助!
输入“L”和“H”的值,选择一个基本点,动态指定方向。绘制等腰梯形。

 
动态指定方向

BIGAL 发表于 2022-7-5 18:54:36

学习lisp的一个很好的开始,非常简单,只需几个命令,将其视为5个点,第一个点是拾取点,然后使用新的点=极角距离或老式三角可以计算出所有角,然后创建pline pt1 pt2 pt3 pt4 C,然后旋转。

Tharwat 发表于 2022-7-5 18:56:59

试试这个,安迪,让我知道
 

(defun c:Test (/ dtr ac ab p sl a b c d e p)
;;        Author : Tharwat Al Shoufi                        ;;
;; Draw Trapezoid with angle 55 on the two sides        ;;
;; --------------------------------------------------        ;;
(defun dtr (a) (* pi (/ a 180.0)))
(if (not *traplen*)
   (setq *traplen* 10.0)
)
(if (not *traphgt*)
   (setq *traphgt* 4.0)
)
(if (and (setq *traplen* (cond ((getdist (strcat "\n Specify Length of Trapezoid < " (rtos *traplen* 2 2) " > :")))
                              (*traplen*)
                        )
          )
          (setq *traphgt* (cond ((getdist (strcat "\n Specify Height of Trapezoid < " (rtos *traphgt* 2 2) " > :")))
                              (*traphgt*)
                        )
          )
          (setq ac (/ *traphgt* (sin (dtr 55.)))
                ab (* ac (cos (dtr 55.)))
          )
          (if (>= (setq sl (- *traplen* (+ ab ab))) 0.)
            (setq p (getpoint "\n Specify top center point of Trapezoid :"))
            (progn (alert "Length of Trapezoid is too small !!") nil)
          )
   )
   (progn (setq a (polar p pi (/ sl 2.))
                b (polar a (dtr 235.) ac)
                c (polar b 0. *traplen*)
                d (polar c (dtr 125.) ac)
                e (entmakex
                  (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1))
                            (mapcar '(lambda (pt) (cons 10 (list (car pt) (cadr pt)))) (list a b c d))
                  )
                  )
          )
   )
)
(if e
   (command "_.rotate" e "" "_non" p "\\")
)
(princ)
)

andy_lee 发表于 2022-7-5 19:01:50

 
多谢塔瓦。很好!这正是我需要的!

Tharwat 发表于 2022-7-5 19:04:46

 
很高兴听到这个消息,不客气。

NhonG 发表于 2022-7-5 19:07:40

嗨,塔瓦,
 
 
请询问另一个解决方案,以绘制四边差(输入)和梯形角度(角度不固定)。如何在代码中添加更多功能?提前谢谢你。
 
 
http://s18.postimg.org/66ae19obt/Untitled.jpg

Lee Mac 发表于 2022-7-5 19:09:13

查看此线程:http://www.theswamp.org/index.php?topic=39256

BIGAL 发表于 2022-7-5 19:12:32

正如李在没有已知角度的情况下所说,没有解决方案。你现在是怎么做到的,你一定在修正某个东西,或者你有一个对角距离,然后它是可解的。

eldon 发表于 2022-7-5 19:17:07

有一段空闲时间,我试着按尺寸绘制形状。不是直截了当的

BIGAL 发表于 2022-7-5 19:18:59

Eldon I得到的长度=263.495,而不是265,所以图表对整个度数不正确
页: [1] 2
查看完整版本: 绘制等腰梯形