明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2156|回复: 11

请高手帮忙解决

  [复制链接]
发表于 2004-11-14 09:25:00 | 显示全部楼层 |阅读模式



请帮忙编一个程序,解决上图件号标注,在MDT版本中标注显得字小圈大,和整张图很不匹配,先谢了!!!


我的这个图片中的件号是在其他软件中标注的,现在公司不用这个软件了,改用CAD了

本帖子中包含更多资源

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

x
发表于 2004-11-14 22:29:00 | 显示全部楼层
(defun c:test ()
(setvar "DIMASZ" 300)
(while (not (setq pt1 (getpoint "\n起点 : "))))
(while (not (setq pt2 (getpoint pt1 "\n编号放置点 : "))))
(setq sn (@ureal 1 "" "数值" sn)
no1 (@ureal 1 "" "圆半径" no1)
pt3 (polar pt2 (angle pt2 pt1) no1)
)
(command "_leader" pt1 pt3 "" "" "n")
(vl-cmdf "circle" pt2 no1)
(vl-cmdf "text" "j" "mc" pt2 no1 0 (rtos sn 2 0))
)
(defun @ureal (bit kwd msg def / inp)
(if def
(setq msg (strcat "\n" msg "<" (rtos def 2) ">: ")
bit (* 2 (fix (/ bit 2)))
)
(setq msg (strcat "\n" msg ": "))
)
(initget bit kwd)
(setq inp (getreal msg))
(if inp
inp
def
)
)

本帖子中包含更多资源

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

x
发表于 2004-11-15 09:08:00 | 显示全部楼层
ctclsc发表于2004-11-14 9:25:00回复:(ctclsc)请高手帮忙解决 13806 请帮忙编一个程序,解决上图件号标注,在MDT版本中标注显得字小圈大,...

在MDT中是可以设置的,也可以采用自定义的块。
 楼主| 发表于 2004-11-20 08:44:00 | 显示全部楼层



非常谢谢!!!!!!
 楼主| 发表于 2004-11-20 09:06:00 | 显示全部楼层
就是箭头不能拐弯,并且当数字为3位时,就跑到外面来了,可是我们公司经常使用,请你在修改修改,谢谢!!!!!!!
发表于 2004-11-24 09:42:00 | 显示全部楼层
试一下下面的程序。程序读取DIMSCALE变量为绘制比例,在R14上调试通过。 (defun c:test ()
(SETVAR "CMDECHO" 0)
(SETQ QQ (GETVAR "DIMSCALE"))
(SETQ OLDOS (GETVAR "OSMODE"))
(SETQ OLDL (GETVAR "CLAYER"))
(SETVAR "OSMODE" 0)
(SETQ Q5 (* QQ 5) Q4 (* QQ 4))
(WHILE (SETQ P1 (GETPOINT "\nPart point 选零件点 :"))
(INITGET 9)
(SETQ P2 (GETPOINT P1 "\nNext point 下一点 :"))
(COMMAND "_LEADER" P1 P2 "" "" "N")
(WHILE (SETQ P3 (GETPOINT P2 "\nNext point 下一点(文字点) :"))
(COMMAND "LINE" P2 P3 "")
(SETQ P1 P2 P2 P3)
)
(SETQ ANG (ANGLE P2 P1) P3 (POLAR P2 ANG Q5))
(PRINC "\nThe number of part or text 零件序号或字串 ")
(SETQ TXT (GETSTRING (STRCAT (IF (= A nil) "" (STRCAT "<" A ">")) " :"))
A (IF (= TXT nil) A TXT))
(COMMAND "STRETCH" "C" P2 P2 "" P2 P3 "CIRCLE" P2 Q5)
(COMMAND "LAYER" "M" "TXT" "")
(IF (> (STRLEN A) 3) (PROGN
(SETQ P4 (POLAR (POLAR P2 (/ PI -2) (+ QQ QQ)) PI Q4)
P5 (POLAR P4 0 (+ Q4 Q4)))
(COMMAND "TEXT" "F" P4 P5 Q4 A)
)
(COMMAND "TEXT" "M" P2 Q4 "" A)
)
)
(SETVAR "CLAYER" OLDL)
(SETVAR "OSMODE" OLDOS)
(SETVAR "CMDECHO" 1)
(PRINC)
)
 楼主| 发表于 2004-12-4 13:38:00 | 显示全部楼层
不能设定圆半径:(
 楼主| 发表于 2004-12-25 17:01:00 | 显示全部楼层
其他高手也都来吧。。。
发表于 2004-12-25 18:55:00 | 显示全部楼层
最好是用属性块操作。
发表于 2004-12-26 14:37:00 | 显示全部楼层
编得较简单,没错误处理,也不拐弯,但能拖曳实时显示,较直观 (defun m_bzbh( / m_wz m_zg m_oldcmdecho m_oldosmode m_pt1 m_pt2 m_pt3 m_ent m_lwpt m_rupt m_width m_ang m_dist m_rad m_ss) (setq m_wz (getstring"编号:"))
(setq m_zg (getreal"字高:")) (setq m_oldcmdecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq m_oldosmode (getvar "osmode"))
(setvar "osmode" 513);;捕捉模式端点(end)、最近点(nearst)
(setq m_pt1 (getpoint "\n基点"))(princ m_pt1) (setvar "osmode"16385);;捕捉模式关 (command "text" "mc" m_pt1 m_zg "0" m_wz)(command)
(setq m_ent (entlast))
(vla-getboundingbox (vlax-ename->vla-object m_ent) 'm_lwpt 'm_rupt)
(setq m_width (abs (- (car (vlax-safearray->list m_lwpt)) (car (vlax-safearray->list m_rupt)))));;文字的总宽度
(entdel m_ent);;删除

(setq m_rad (1+ (/ m_width 2)))
(princ "\n位置:")
(setq m_ss (ssadd))
(while (/= 3 (car (setq m_pt2 (grread T 5))))
(if m_ss (command "erase" m_ss ""))
(setq m_dist (distance m_pt1 (cadr m_pt2)))
(if (> m_dist m_rad)
(progn
(setq m_ang (angle m_pt1 (cadr m_pt2)))
(if (> (- m_dist m_rad) 3)
(progn
(command "pline" m_pt1 "w" 0 1 (polar m_pt1 m_ang 3) "w" 0 0 (polar m_pt1 m_ang (- m_dist m_rad)))
(command)
)
(progn
(command "pline" m_pt1 (polar m_pt1 m_ang (- m_dist m_rad)))
(command)
)
)
(ssadd (entlast) m_ss)
)
)
(command "text" "mc" (cadr m_pt2) m_zg "0" m_wz)(command)
(ssadd (entlast) m_ss)
(command "circle" (cadr m_pt2) m_rad)(command)
(ssadd (entlast) m_ss)
) (setvar "osmode" m_oldosmode);;还原捕捉
(setvar "cmdecho" m_oldcmdecho)
(princ)
)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-17 11:26 , Processed in 0.187726 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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