chiimayred 发表于 2022-7-6 02:55:15

用于创建顶部/侧面Vie的LISP

大家好,
 
我正在尝试编写一个代码,在这个代码中,我可以从W型梁的横截面投影顶视图和侧视图(示例请参见随附的方框)。
 
我已经尽力了,但这是我在转动轮子之前所能做的。
 
(Defun c:fd (/ d1 d2 d3 d4 p1)
(SETQ D1 (GETDIST "\nWhat is Flange width: "))
(setq d2 (getdist "\nWhat is Flange thickness: "))
(setq d3 (getdist "\nWhat is Web thickness: "))
(setq d4 (getdist "\nWhat is Depth: "))
(setq p1 (getpoint "\nBasepoint for top view: "))
(command
   "line" p1 @d1.0

)
)
 
请注意,此lisp仅适用于W型梁,我不需要全面的lisp。如果需要,我应该能够修改这个lisp,以适应未来的需要。最后,我还没有添加任何错误捕捉,因为我还没有到那个阶段。
 
非常感谢您的帮助。
W10x45(W250x67)。图纸

ReMark 发表于 2022-7-6 03:17:16

似乎要经历很多事情。我想这些信息已经可以通过另一种方式获得了。

chiimayred 发表于 2022-7-6 03:22:41

我也这么认为,我在过去的一个小时里一直在尝试搜索它,但还没有任何运气。。。我会继续寻找解决方案/想法,当我能找到的时候,把我的发现/解决方案张贴在这里。

ReMark 发表于 2022-7-6 03:33:45

你搜索得不够彻底。你需要的是艾尔的钢厂。看看这个。。。
 

 
Ta da!你现在注意到我了吗?

Tharwat 发表于 2022-7-6 03:47:37

我为另一个论坛写了这个lisp,希望这就是你想要的。
 

(defun c:IProfile (/ seg p p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11)
;;;;;      Author : Tharwat Al Shoufi    www.Autolisp.com    ;;;;;
;;;;;      14. November. 2012 , Codes to draw I profile         ;;;;;
(if (and
       (setq
         *l* (cond
               ((getdist (strcat "\n Specify Length "
                                 (if *l*
                                 (strcat "< " (rtos *l* 2 2) " > :")
                                 " :"
                                 )
                         )
                )
               )
               (t *l*)
             )
       )
       (setq
         *w* (cond
               ((getdist (strcat "\n Specify Width "
                                 (if *w*
                                 (strcat "< " (rtos *w* 2 2) " > :")
                                 " :"
                                 )
                         )
                )
               )
               (t *w*)
             )
       )
       (setq *ft*
            (cond
                ((getdist (strcat "\n Flange Thickness "
                                  (if *ft*
                                    (strcat "< " (rtos *ft* 2 2) " > :")
                                    " :"
                                  )
                        )
               )
                )
                (t *ft*)
            )
       )
       (setq *wt*
            (cond
                ((getdist (strcat "\n Web Thickness "
                                  (if *wt*
                                    (strcat "< " (rtos *wt* 2 2) " > :")
                                    " :"
                                  )
                        )
               )
                )
                (t *wt*)
            )
       )
       (if (and (> *l* *ft*) (> *l* *wt*) (> *w* *ft*) (> *w* *ft*))
         t
         (princ "\n Length and Width must be the tallest")
       )
       (setq p (getpoint "\n Specify a point :"))
   )
   (progn
   (setq p1(polar p 0.0 *w*)
         p2(polar p1 (* pi 0.5) *ft*)
         p3(polar p2 pi (setq seg (- (/ *w* 2.) (/ *wt* 2.))))
         p4(polar p3 (* pi 0.5) (- *l* (+ *ft* *ft*)))
         p5(polar p4 0.0 seg)
         p6(polar p5 (* pi 0.5) *ft*)
         p7(polar p6 pi *w*)
         p8(polar p7 (* pi 1.5) *ft*)
         p9(polar p8 0. seg)
         p10 (polar p9 (* pi 1.5) (- *l* (+ *ft* *ft*)))
         p11 (polar p10 pi seg)
   )
   (entmakex (list '(0 . "LWPOLYLINE")
                     '(100 . "AcDbEntity")
                     '(100 . "AcDbPolyline")
                     '(90 . 12)
                     '(70 . 1)
                     (cons 10 p)
                     (cons 10 p1)
                     (cons 10 p2)
                     (cons 10 p3)
                     (cons 10 p4)
                     (cons 10 p5)
                     (cons 10 p6)
                     (cons 10 p7)
                     (cons 10 p8)
                     (cons 10 p9)
                     (cons 10 p10)
                     (cons 10 p11)
               )
   )
   )
)
(princ)
)

David Bethel 发表于 2022-7-6 04:03:38

如果您只是处理梁:
 
http://www.cadtutor.net/forum/archive/index.php/t-1220.html
 
 
 
一个古老但优秀的程序-大卫
页: [1]
查看完整版本: 用于创建顶部/侧面Vie的LISP