明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2711|回复: 4

我的45度倒角标注程序,请高手们看看。

[复制链接]
发表于 2004-2-18 12:40:00 | 显示全部楼层 |阅读模式
; 45度的倒角标注 (defun C:CHAMFR()
(setq cmd(getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq osm(getvar "osmode"))
(setvar "osmode" 32)
(setq ort(getvar "ORTHOMODE"))
(setvar "ORTHOMODE" 0)
(setq sc(getvar "dimscale"))
(command "layer" "s" "dim" "") (setq p1 (getpoint "\n First point: "))
(setq p2 (getpoint "\n Second point: " p1))
(setq ang (angle p1 p2))
;(setq ang1 (angtos ang))
(setq x1 (car p1))
(setq x2 (car p2))
(setq dd (abs (- x2 x1)))
(setq pe (getpoint "\n End point: " p2))
(setq ds (distance p2 pe))
(setq dd (strcat "%%U" (rtos dd) "×45%%d"))

(if (or (and (> ang 0.00000000) (< ang (/ pi 2)))
(and (> ang (* pi 1.5)) (< ang (* pi 2)))
)
(progn
(if (and (> ang 0.000) (< ang (/ pi 2)))
(progn
(command "line" p2 (setq pe(polar p2 (/ pi 4) ds)) "")
(setq pe(polar pe (/ pi 2) (* 0.6 sc)))
(setq pe(polar pe 0 (* 0.5 sc)))
(command "text" pe "0" dd)
)
)
(if (and (> ang (* pi 1.5)) (< ang (* pi 2)))
(progn
(command "line" p2 (setq pe(polar p2 (* pi 1.75) ds)) "")
(setq pe(polar pe (/ pi 2) (* 0.6 sc)))
(setq pe(polar pe 0 (* 0.5 sc)))
(command "text" pe "0" dd)
)
)
)
)
(if (and (> ang (/ pi 2)) (< ang pi))
(progn
(command "line" p2 (setq pe(polar p2 (* pi 0.75) ds)) "")
(command "text" "r" (polar pe (/ pi 2) (* 0.6 sc)) "0" dd)
)
)
(if (and (> ang pi) (< ang (* pi 1.5)))
(progn
(command "line" p2 (setq pe(polar p2 (* pi 1.25) ds)) "")
(command "text" "r" (polar pe (/ pi 2) (* 0.6 sc)) "0" dd)
)
)
;
(setvar "cmdecho" cmd)
(setvar "osmode" osm)
(setvar "ORTHOMODE" ort)
(redraw)
)
发表于 2004-2-19 21:08:00 | 显示全部楼层
不能用嘛
 楼主| 发表于 2004-2-20 13:15:00 | 显示全部楼层
将程序中(command "layer" "s" "dim" "")去掉试试。


高手们能帮助我改改吗?
发表于 2004-2-20 13:18:00 | 显示全部楼层
要怎么改呢?有什么问题你要说说啊。。。


就像看医生,不可能过去就说,医生你给我看看吧。。。也得告诉医生发烧还是咳嗽,不会一点小病要做全身检查吧
 楼主| 发表于 2004-2-20 14:22:00 | 显示全部楼层
端点的确定能否直接通过拖拉限制在45°、135°、225°、315°这4个方向上。


(setq pe (getpoint "\n End point: " p2))
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-10-2 01:26 , Processed in 0.182904 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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