明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1667|回复: 5

[求助]我是新手,帮我看一下

[复制链接]
发表于 2004-10-3 20:35:00 | 显示全部楼层 |阅读模式
(defun C:test (/ pt1 screw luo luo1 pt2 pt3)
(command "undo" "group")
;;; (setq olderr *error*
;;; *error* clerr)
(setvar "cmdecho" 0)
(setq pt1 (getpoint "\n中心点: "))
(setq screw (getint "\n输入螺丝公称尺寸[2/3/4/5/6/8/10/12/14/16/18/20/22/24/26/28/30/33/36]:"))
(wai)
(setq pt2 (polar pt1 (- (/ pi 2)) luo))
(setq pt3 (polar pt1 pi luo))
(setq luo1 (/ screw 2))
(command "circle" pt1 luo1)
(command "_arc" "_c" pt1 pt2 pt3)
(setvar "cmdecho"1)
;;; (setq *error* olderr)
(command "undo" "end")
)
(defun wai ()
(if (= screw 2)
(setq luo 0.8)
)
(if (= screw 3)
(setq luo 1.25)
)
(if (= screw 4)
(setq luo 1.65)
)
(if (= screw 5)
(setq luo 2.1)
)
(if (= screw 6)
(setq luo 2.5)
)
(if (= screw 8)
(setq luo 3.4)
)
(if (= screw 10)
(setq luo 4.3)
)
(if (= screw 12)
(setq luo 5.15)
)
(if (= screw 14)
(setq luo 6)
)
(if (= screw 16)
(setq luo 7)
)
(if (= screw 18)
(setq luo 7.75)
)
(if (= screw 20)
(setq luo 8.75)
)
(if (= screw 22)
(setq luo 9.75)
)
(if (= screw 24)
(setq luo 10.5)
)
(if (= screw 30)
(setq luo 13.25)
)
(if (= screw 33)
(setq luo 13.25)
)
(if (= screw 36)
(setq luo 16)
)
)

(princ)
发表于 2004-10-4 09:08:00 | 显示全部楼层
(defun C:test (/ pt1 screw luo luo1 pt2 pt3)
(command "undo" "group")
;;; (setq olderr *error*
;;; *error* clerr)
(setq datalst '((2 . 0.8)(3 . 1.25)(4 . 1.65)(5 . 2.1)(6 . 2.5)(8 . 3.4)
(10 . 4.3)(12 . 5.15)(14 . 6)(16 . 7)(18 . 7.75)(20 . 8.75)
(22 . 9.75)(24 . 10.5)(30 . 13.25)(33 . 13.25)(36 . 16)))
(setvar "cmdecho" 0)
(setq pt1 (getpoint "\n中心点: "))
(setq screw (getint "\n输入螺丝公称尺寸[2/3/4/5/6/8/10/12/14/16/18/20/22/24/26/28/30/33/36]:"))
(setq luo (cdr (assoc screw datalst)))
(setq pt2 (polar pt1 (- (/ pi 2)) luo))
(setq pt3 (polar pt1 pi luo))
(setq luo1 (/ screw 2.0))
(command "circle" pt1 luo1)
(command "_arc" "_c" pt1 pt2 pt3)
(setvar "cmdecho" 1)
;;; (setq *error* olderr)
(command "undo" "end")
(princ)
)
 楼主| 发表于 2004-10-4 09:46:00 | 显示全部楼层
本帖最后由 作者 于 2004-10-4 10:23:39 编辑

谢谢版主,请问我的程序错在哪里?为什么有时可以,有时不行?



你的程序有时可以,有时不行,为什么?如图:





本帖子中包含更多资源

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

x
 楼主| 发表于 2004-10-6 09:23:00 | 显示全部楼层
请班主帮忙!!
发表于 2004-10-6 10:43:00 | 显示全部楼层
把对象捕捉关掉 在程序前加上 (setq osm (getvar "osmode"));取得捕捉变量
(setvar "osmode" 0);关掉捕捉 画好螺纹后加上 (setvar "osmode" osm);恢复捕捉
 楼主| 发表于 2004-10-6 15:25:00 | 显示全部楼层
谢谢!搞定了!


本帖子中包含更多资源

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

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-30 12:20 , Processed in 0.193022 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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