明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1305|回复: 1

[求助]请高手们看看这个程序有什么错?

[复制链接]
发表于 2005-3-15 15:09:00 | 显示全部楼层 |阅读模式
因为要做螺纹,从网上找到了一个Lisp程序,可是总出错,错误如下: 命令: iso228 公称尺寸, 1/16' to 6' (如: 1/8 or 1-1/4): 1 牙数:5
起始点:
螺纹总长(Y方向): 50
; 错误: no function definition: DRAWTHREAD 该程序如下,请高手们给看看: ; 该程序可生成三维实体外螺纹。
; 你可生成以下的螺纹:
; 执行命令:ISO228
; There is no error trapping or anything like that.
; The program works by creating a single thread
; and then arraying it out to the proper length. The threads are
; drawn a little longer and then sliced off to the correct length.
; This program only draws the thread, you're on your own drawing
; the rest of the screw or internal thread.
;
; Note, the threads created by this can make for some rather big files,
; so make sure your system is up to it. Also, it might take a while
; to union all of the single threads together so be patient.
;
;-------------------------------------------------------------------
(defun myerror (s) (if (/= s "function cancelled") (princ (strcat "\nError: " s)))
(setvar "cmdecho" ocmd)
(setvar "osmode" osm)
(setq *error* olderr)
(princ)
) (defun c:ISO228 (/ nom pitch length threadangle cpt inout minordiafactor nom1 nom2 size size1 n s olderr) ;;;;(setq olderr *error*
;;;; *error* myerror)
(setq osm (getvar "osmode"))
(setq ocmd (getvar "cmdecho")) (setvar "cmdecho" 1) (setq minordiafactor 1.6666666667)
;(Princ "\nThread according to DIN ISO 228, NEN 176")
;(initget 1 "I E")
;(setq inout (getkword "\nInternal or External thread (I/E): "))
(setq inout "I")
(initget "1/16 1/8 1/4 3/8 1/2 5/8 3/4 7/8 1 1-1/8 1-1/4 1-1/2 1-3/4 2 2-1/4 2-1/2 2-3/4 3 3-1/2 4 4-1/2 5 5-1/2 6")
(setq size1 (getkword "\n公称尺寸, 1/16' to 6' (如: 1/8 or 1-1/4): "))
(if(= size1 "1/16")(setq nom1 1.5875))
(if(= size1 "1/8")(setq nom1 3.175))
(if(= size1 "1/4")(setq nom1 6.35))
(if(= size1 "3/8")(setq nom1 9.525))
(if(= size1 "1/2")(setq nom1 12.7))
(if(= size1 "5/8")(setq nom1 15.875))
(if(= size1 "3/4")(setq nom1 19.05))
(if(= size1 "7/8")(setq nom1 22.225))
(if(= size1 "1")(setq nom1 25.4))
(if(= size1 "1-1/8")(setq nom1 28.575))
(if(= size1 "1-1/4")(setq nom1 31.75))
(if(= size1 "1-1/2")(setq nom1 38.1))
(if(= size1 "1-3/4")(setq nom1 44.45))
(if(= size1 "2")(setq nom1 50.8))
(if(= size1 "2-1/4")(setq nom1 57.15))
(if(= size1 "2-1/2")(setq nom1 63.5))
(if(= size1 "2-3/4")(setq nom1 69.85))
(if(= size1 "3")(setq nom1 76.2))
(if(= size1 "3-1/2")(setq nom1 88.9))
(if(= size1 "4")(setq nom1 101.6))
(if(= size1 "4-1/2")(setq nom1 114.3))
(if(= size1 "5")(setq nom1 127))
(if(= size1 "5-1/2")(setq nom1 139.7))
(if(= size1 "6")(setq nom1 152.4))
;(setq size "1") ; demo version only 1
;(if (= size "1")(if (= inout "E") (setq nom1 33.069) (setq nom1 33.568)))
(setq n (getdist "\n牙数:"))
(setq pitch (/ 25.4 n))
(initget 1) ; no enter
(setq cpt (getpoint "起始点: "))
(initget 3) ; no enter, not zero
(setq length (getdist "\n螺纹总长(Y方向): ")) (setq h (* 0.96049 pitch)) ; h according to ISO 228
(setq nom (+ nom1 (/ h 3))) ; biggest outside diameter
(setq nom2 (- nom (* h minordiafactor))) ; inside diameter
(setq threadangle (+ 27.5 0)) ; threadangle (setvar "osmode" 0)
(setvar "cmdecho" 0) (drawthread nom nom1 nom2 pitch length threadangle cpt) (princ "\nDone")
(setvar "osmode" osm)
(setvar "cmdecho" ocmd)
(setq *error* olderr)
(princ)
)
发表于 2005-3-15 15:36:00 | 显示全部楼层
(drawthread nom nom1 nom2 pitch length threadangle cpt) 缺副程序drawthread
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-17 13:33 , Processed in 0.167772 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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