明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2067|回复: 5

请帮忙改成文字自动放置在直线中心位上

[复制链接]
发表于 2012-11-28 11:01 | 显示全部楼层 |阅读模式
本帖最后由 linheyuanpcb 于 2012-11-28 11:17 编辑

(defun c:TffT (/ I E  curve tlen ss n sumlen)
  (setq I 0)
  (while (setq E (entsel))
    (setq E (cdr (assoc 10 (entget (car E))))
          I (1+ I)
    )
    (if (> I 1)
      (command "_non" E)
      (command "_.LINE" "_non" E)
    )
                                                          )
                                                                        (command "")
                                                                (xccc)
          (princ)
)
(defun xccc (/ curve tlen ss n sumlen)
  (vl-load-com)
  (setq sumlen 0)
        (setq ss (ssget "l"))
  (setq n 0)
  (repeat (sslength ss)
    (setq curve (vlax-ename->vla-object (ssname ss n)))
    (setq tlen (vlax-curve-getdistatparam curve (vlax-curve-getendparam curve) ) )
    (setq sumlen (+ sumlen tlen))
    (setq n (1+ n))
  )
        (setq pl (getpoint "\n指定文字位置:"))
        (command "text" "j" "m" pl "2.2" "0" (strcat(rtos sumlen 2 2)) )
)
请各位帮忙优化改进一下,
改成选完两个圆事完线后就将长度标注在直线的中心上方2mm处
然后继续重复以上动作 谢谢


本帖子中包含更多资源

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

x
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2012-11-28 11:33 | 显示全部楼层
(command "_non" E)是什么命令?能执行吗?没看明白
发表于 2012-11-28 13:54 | 显示全部楼层
文字按线对齐就可以了
 楼主| 发表于 2012-11-28 13:57 | 显示全部楼层
chenbh2 发表于 2012-11-28 13:54
文字按线对齐就可以了

同在是要指定点放文字,要对齐是不是得放置后再对齐?
这样步骤会更多了?
发表于 2013-1-1 10:53 | 显示全部楼层
这个程序非常有适用性,可惜需高手优优
发表于 2014-9-5 15:47 | 显示全部楼层
期待高手出现呀!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-19 10:14 , Processed in 0.540635 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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