只需一步,快速开始
我有两个标注方面的问题想向高手请教:
1、怎样才能控制直径标注的标注点与被标注圆的距离。
(setq pb4 (polar (list 0 0) (/ pi 4) (+ ra 15))) (setvar "dimtoh" 1) (command "_.dimdiameter" (list bz1 pb4) "");;;bz1为圆的图元,不管(+ ra 15)多大,pb4只能控制方向,而不能控制距离。请问如何才能由自己控制距离。
2、直径标注的多行文字的程序代码是什么?
(command "_.dimdiameter" (list x3 pb8) "m" "" 均布 "" "" "");;;x3为图元
这句错在哪?
请版主和大侠、高手们帮帮忙!!!!!!
先行谢谢了。
使用道具 举报
1.如bz1为圆的图元,ra为圆的直径,cenpt为圆心坐标,圆上任意一点为(setq pt1 (polar pt1 (/ pi 4) ra)),如下标注:
(setq dis1 (getreal "\ninput distance:"))
(setq pt2 (polar cenpt (/ pi 4) (+ ra dis1)));;(/ pi 4)为标注角度
(command "_dimdiameter" (list bz1 pt1) pt2)
2.“均布”等字样宜另写,字体也要改动。
(setq oldstyle (getvar "textstyle"))
(setq str1 "均布")
(setq pt (polar (cdr (assoc 11 (entget dim1))) (/ (* 3 pi) 2) 1))
;;;dim1为尺寸图元
(if (= (tblobjname "STYLE" "HZST3") nil) (command "_style" "HZST3" "宋体" 3 "" "" "" "") (setvar "textstyle" "HZST3"))
(command "text" "J" "TC" pt 0 str1)
(setvar "textstyle" oldstyle)
还是不太会用,wandong兄给的程序,有点小问题。请wandong兄再给帮帮忙,下面是一个测试小程序。
运行时会出现:错误: 参数类型错误: 二维/三维点: nil
(defun c:aa()(setq q1 (getpoint"请选择输入点")) (setq q2 (polar q1 0 50)) (command "circle" q1 50 "") (setq dim1 (entlast)) (setq oldstyle (getvar "textstyle")) (setq str1 "均布") (setq pt (polar (cdr (assoc 11 (entget dim1))) (/ (* 3 pi) 2) 1));;;dim1为尺寸图元 (if (= (tblobjname "STYLE" "HZST3") nil) (command "_style" "HZST3" "宋体" 3 "" "" "" "") (setvar "textstyle" "HZST3")) (command "text" "J" "TC" pt 0 str1) (setvar "textstyle" oldstyle)
(command "_.dimdiameter" (list dim q2) "m" "" str1 "" "" "" ""))
不知道你是不是想完成如下的功能:
(defun c:aa()(setvar "dimtoh" 1)(setq q1 (getpoint"请选择输入点")) (setq q2 (polar q1 0 50)) (command "circle" q1 50) (setq bz1 (entlast)) (setq ra (cdr (assoc 40 (entget bz1))) cenpt (cdr (assoc 10 (entget bz1))) ) (setq dis1 (getreal "\n输入尺寸标注点与圆之间的距离:")) (setq pt1 (polar cenpt (/ pi 4) ra)) (setq pt2 (polar cenpt (/ pi 4) (+ ra dis1))) (command "_dimdiameter" (list bz1 pt1) pt2) (setq dim1 (entlast)) ;;;dim1为尺寸图元 (setq oldstyle (getvar "textstyle")) (setq str1 "均布") (setq pt (polar (cdr (assoc 11 (entget dim1))) (/ (* 3 pi) 2) 1));;;dim1为尺寸图元 (if (= (tblobjname "STYLE" "HZST3") nil) (command "_style" "HZST3" "宋体" 3 "" "" "" "") (setvar "textstyle" "HZST3")) (command "text" "J" "TC" pt 0 str1) (setvar "textstyle" oldstyle))
wandong兄弟,我的意思就是想标注一下阵列的六个圆,除了标注尺寸外还想再后面加上“X6均布”的字样,兄弟上面的程序已能解决这标注问题了。在此谢过了。
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 ) ©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途
GMT+8, 2024-5-19 00:55 , Processed in 0.271063 second(s), 25 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.