flopo 发表于 2022-7-6 09:21:59

帮我解决这个口齿不清的问题

大家好,
我的Lisp程序经验很低。我做了下一个lisp,我想改进它,以这样使用:继续选择其他点,并不断绘制“管道”-一些与while。。。然后选择下一个点。。。请帮帮我!
 
;;;特维·弗洛林
(定义C:管道(/stp ep ds d1 d2 d3 d4 ang old\u err old\u hcosmode)
(defun DTR(deg)(*deg(/PI 180)))
(setq old\u err*错误*
*错误*hc\U err)
(setvar“CMDECHO”0)
(setvar“BLIPMODE”0)
(setq old\u hcosmode(getvar“Osmode”))
(setvar“Osmode”0)
(setq dia(getreal“\n名称:”)
(如果(=直径50)
(setq di 60.3))
(如果(=直径80)
(setq di 88.9))
(如果(=直径100)
(setq di 114.3))
(如果(=直径150)
(setq di 168.3)
(如果(=直径200)
(setq di 219.0)
(如果(=直径250)
(setq di 273)
(如果(=直径300)
(setq di 323.9))
(如果(=直径350)
(setq di 355.6))
(如果(=直径400)
(setq di 406.4))
(如果(=直径450)
(setq di 457.2))
(如果(=直径500)
(setq di 508)
(如果(=直径600)
(setq di 609.6))
(如果(=直径700)
(setq di 710)
(如果(=直径800)
(setq di 813)
(如果(=直径900)
(setq di 914))
 
(setq stp(getpoint“\n函数插入:”)
(如果(/=stp NIL)
(程序
(setq ep(getpoint“\nVarf:”stp))
 
(setq ds(距离stp ep)ang(角度stp ep))
)
(princ“\n?”)
)
(if(和stp ep)
(程序
(setq d1(极性stp(+ang(dtr 90))(/di 2))
d2(极性ep(+ang(dtr 90))(/di 2))
d3(极性ep(-ang(dtr 90))(/di 2))
d4(极性stp(-ang(dtr 90))(/di 2))
 
)
 
 
;(命令“_.PLINE”d1“W”“0”“0”
;d2 d3 d4 d1“”
 
(命令“行”d1 d2“”
“_.CHPROP”“L”“”“la”“contur”“lt”“bylayer”“c”“bylayer”“”
“行”d3 d4“”
“_.CHPROP”“L”“”“la”“contur”“lt”“bylayer”“c”“bylayer”“”
“行”stp ep“”
“_.CHPROP”“L”“”“la”“axe”“lt”“bylayer”“c”“bylayer”“”)
)
 
);如果结束。
(setvar“Osmode”old\u hcosmode)
(setq*error*old\U err)
(普林斯)
)

Tharwat 发表于 2022-7-6 09:40:45

请使用[代码过帐]过帐代码。
 
http://www.cadtutor.net/forum/showthread.php?9184-代码发布指南

David Bethel 发表于 2022-7-6 09:51:25

虽然我不太了解最终产品,但我会从以下内容开始:
 

;;;tevi florin
(defun C:pipe (/ stp ep ds d1 d2 d3 d4 ang old_err old_hcosmode
                data di dia)

;(setq old_err *error*
;   *error* hc_err)

(setvar "CMDECHO" 0)
(setvar "BLIPMODE" 0)
(setq old_hcosmode(getvar "Osmode"))
(setvar "Osmode" 0)
(setvar "CECOLOR" "BYLAYER")
(setvar "CELTYPE" "BYLAYER")
(setvar "PLINEWID" 0.0)

(setq data '((50. 60.3)
            (80. 88.9)
            (100 . 114.3)
            (150 . 168.3)
            (200 . 219.0)
            (250 . 273.0)
            (300 . 323.9)
            (350 . 355.6)
            (400 . 406.4)
            (450 . 457.2)
            (500 . 508.0)
            (600 . 609.6)
            (700 . 710.0)
            (800 . 813.0)
            (900 . 914.0)))

(while (not (assoc dia data))
      (initget 7)
      (setq dia (getreal "\nDiametru:   " )))

(setq di (cdr (assoc dia data)))

(initget 1)
(setq stp (getpoint "\nPunct Insertie:   "))

(while (setq ep (getpoint stp "\nVarf:   "))

      (setq ds (distance stp ep)
         ang (angle stp ep)
            d1 (polar stp (+ ang (* pi 0.5)) (/ di 2.))
            d2 (polar ep(+ ang (* pi 0.5)) (/ di 2.))
            d3 (polar ep(- ang (* pi 0.5)) (/ di 2.))
            d4 (polar stp (- ang (* pi 0.5)) (/ di 2.)))

      ;(command "_.PLINE" d1 d2 d3 d4 d1 "")

      (command "_.LINE" d1 d2 ""
               "_.LINE" d3 d4 ""
               "_.LINE" stp ep "")
      (setq stp ep))

(setvar "Osmode" old_hcosmode)
(setq *error* old_err)
(princ))

 
 
可能正在尝试制作自定义多线?
 
-大卫

BIGAL 发表于 2022-7-6 10:09:36

很好的一个是塑料管或钢管,因为混凝土300应该是362。但管道类型可以简单地添加到代码中,以生成更大的库。

David Bethel 发表于 2022-7-6 10:11:26

谢谢
 
如果是MILNE替代品,这应该非常有用:
 
 
http://www.cadtutor.net/forum/showthread.php?52810-查找-a-LISP-routine-Multiple-Polyline-Offset/page2&highlight=mline
 
-大卫

flopo 发表于 2022-7-6 10:30:00

谢谢大家,没关系!
页: [1]
查看完整版本: 帮我解决这个Lisp程序的问题