yxl88168 发表于 2011-4-10 22:20:12

回复 xyp1964 的帖子

那请楼主帮忙优化一下呀

yxl88168 发表于 2011-4-10 22:21:31

回复 zjyangxyz 的帖子

谢谢zjyangxyz ,就是这个样的子,只是他们好像在标注时与所标注的圆有点远,不知是在那里改,请再指教一下

zjyangxyz 发表于 2011-4-11 08:12:51

(setq PTB (polar CEN1 (* 0.25 pi) (+ radd 2)))
这一句

yxl88168 发表于 2011-4-11 19:06:34

回复 zjyangxyz 的帖子

谢谢楼主,你真是太好了,有这个以后模板标注就方便多了

tyzhi222 发表于 2011-4-14 11:31:16

好东西,好想法。只是试了一下,运行不了。环境是CAD2006,英文版。不知道为什么,有时间研究一下为什么运行不了。

linheyuanpcb 发表于 2011-4-30 20:25:35


(defun c:ttt()
(princ "\n 选择要进行统计的圆")
(setq ss (ssget (list (cons 0 "CIRCLE"))))
(setq pt (getpoint "\n 指定放置列表基点:"))
(setq si 0 tx 65 px (car pt) py (cadr pt) li '() lii 0)
(setq os (getvar "osmode") om (getvar "cmdecho"))
(command "osmode" 0 "osmode" 0 "_.ucs" "w")
(repeat (sslength ss)
   (setq cs (ssname ss si) ce (entget cs))
   (setq cp (cdr (assoc 10 ce)))
   (setq cr (cdr (assoc 40 ce)))
   (if (setq lst (assoc cr li))
   (setq ct (nth 1 lst) li (subst (list cr ct (1+ (nth 2 lst))) lst li))
   (setq ct tx tx (1+ tx) li (cons (list cr ct 1) li))
   )
   (command "_.text" (polar cp (/ pi 4) (+ cr 1)) 3 0 (chr ct))
   (command "_.chprop" "l" "" "p" "c" 6 "")
   (setq si (1+ si))
)
(foreach l li
   (setq cp (list px (+ py (* lii 5))) )
   (setq cr (nth 0 l) ct (nth 1 l) cn (nth 2 l))
   (command "_.text" cp 4 0 (strcat (chr ct) ":" (itoa cn) "-%%C" (rtos (* cr 2) 2)))
   (command "_.chprop" "l" "" "p" "c" 6 "")
   (setq lii (1+ lii))
)
(setvar "osmode" os)
(setvar "cmdecho" om)
(princ "\n统计完成!")
(princ)
)


试下这个

linheyuanpcb 发表于 2011-4-30 20:44:29

(command "_.text" (polar cp (/ pi 4) (+ cr 1)) 3 0 (chr ct));这里放置文字
(/ pi 4)---可设 1,2,3,4,个位置,自己可以试着去更改合适位置,但是放在圆心中心我就不知了,

linheyuanpcb 发表于 2011-4-30 20:57:53

本帖最后由 linheyuanpcb 于 2011-4-30 21:16 编辑

你要的效果是26楼的,这个是放在中心的

(defun c:cr()
(princ "\n选择要进行统计的圆对象")
(setq ss (ssget (list (cons 0 "CIRCLE"))))
(setq pt (getpoint "\n选择输出基点:"))
(setq si 0 tx 65 px (car pt) py (cadr pt) li '() lii 0)
(setq os (getvar "osmode") om (getvar "cmdecho"))
(command "osmode" 0 "osmode" 0 "_.ucs" "w")
(repeat (sslength ss)
   (setq cs (ssname ss si) ce (entget cs))
   (setq cp (cdr (assoc 10 ce)))
   (setq cr (cdr (assoc 40 ce)))
   (if (setq lst (assoc cr li))
   (setq ct (nth 1 lst) li (subst (list cr ct (1+ (nth 2 lst))) lst li))
   (setq ct tx tx (1+ tx) li (cons (list cr ct 1) li))
   )
   (command "_.text" (polar cp (/ pi 2) (- cr 2)) 3 0 (chr ct))
   (command "_.chprop" "l" "" "p" "c" 6 "")
   (setq si (1+ si))
)
(foreach l li
   (setq cp (list px (+ py (* lii 5))) )
   (setq cr (nth 0 l) ct (nth 1 l) cn (nth 2 l))
   (command "_.text" cp 3 0 (strcat (chr ct) ":" (itoa cn) "-%%C" (rtos (* cr 2) 2))2)
   (command "_.chprop" "l" "" "p" "c" 6 "")
   (setq lii (1+ lii))
)
(setvar "osmode" os)
(setvar "cmdecho" om)
(princ "\n统计完成!")
(princ)
)

修改了下文字位置和小数精度

yxl88168 发表于 2011-5-1 15:09:05

回复 linheyuanpcb 的帖子

谢谢,东西不错,要是能把同心圆只标注一个就好了

alwtyp 发表于 2011-5-3 17:40:10

程序好長,還沒有試用。不知道這個程序可以把所有的模板標出來?還是只能標特定的板子?
页: 1 2 [3] 4 5
查看完整版本: 自动注解并输出