明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2457|回复: 4

1个小程序:坐标标注(二维型)

[复制链接]
发表于 2003-8-7 21:26:00 | 显示全部楼层 |阅读模式
加载后命令行输入bzb
(defun C:bzb (/ texthigh p1 p2 x y  h h0 textx texty text  textlong  textend) ;标二维坐标
(setq        h0
         (vl-registry-read
           "HKEY_CURRENT_USER\\Test"
           "h0"))
  (if (not  h0)
    (setq h0 (vl-registry-write
      "HKEY_CURRENT_USER\\Test"
      "h0"
      "1")))
  (setq  message (strcat "\n请输入适当的字体大小" ":<" h0 ">"))
  (setq h (getstring message))
  (if  (eq h "")
   
(setq h (vl-registry-read
               "HKEY_CURRENT_USER\\Test"
               "h0"))
    (vl-registry-write
      "HKEY_CURRENT_USER\\Test"
      "h0"
      h)            
   
)
(setq texthigh (atof h))
   
  (setq p1 (getpoint "\n请选择要的标注点:"))
  (setq p2 (getpoint p1 "\n请选择文字位置:"))
  
  (while  p1
  (setq x (car p1))
  (setq y (cadr p1))
  (setq textx (rtos x 2 3))
  (setq texty (rtos y 2 3))
            
  (setq text (strcat "( " textx " , " texty " )"))
  (setq  textlong (* (strlen text) texthigh 0.85))
  (if ( > (car p2) (car p1))
    (progn
  (command "text" (polar p2 1.071 (* texthigh 0.5)) texthigh "0" text)
  
  (setq textend (polar p2 0 textlong))
  (command "pline" p1 p2 textend  "" )
      )
     (progn
  
  (setq  textlong (* (strlen text) texthigh 0.85))

  
  (setq textend (polar p2 pi textlong))
  (command "pline" p1 p2 textend  "" )
   (command "text" (polar textend 1.071 (* texthigh 0.5)) texthigh "0" text)  
     )
     )
  (setq p1 (getpoint "\n请选择要的标注点:"))
  (setq p2 (getpoint p1 "\n请选择文字位置:"))
    )
  (princ)
      )

评分

参与人数 1威望 +1 金钱 +5 贡献 +1 激情 +2 收起 理由
mccad + 1 + 5 + 1 + 2 【好评】好程序

查看全部评分

发表于 2003-8-8 12:26:00 | 显示全部楼层
本帖最后由 作者 于 2003-8-8 13:37:27 编辑

改用LEADER來做會更簡單一點!

  (defun C:TT (/ P1 P2 X Y TEXTX TEXTY TEXT)
  (while (and (setq P1 (getpoint "\n请选择要的标注点: "))
              (setq P2 (getpoint P1 "\n请选择文字位置: "))
         )
    (setq X (car P1))
    (setq Y (cadr P1))
    (setq TEXTX (rtos X 2 3))
    (setq TEXTY (rtos Y 2 3))
    (setq TEXT (strcat "( " TEXTX " , " TEXTY " )"))
    (command "_.LEADER" P1 P2 "A" TEXT "")
  )
)
发表于 2003-8-10 10:35:00 | 显示全部楼层
你的程序简直太差劲了,如果有三百个孔要标注的话岂不是要标一天,而且可能还会标重复。
发表于 2003-8-11 08:09:00 | 显示全部楼层
我想這個程序不是用來标注孔的.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-16 18:26 , Processed in 0.160910 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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