明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2048|回复: 9

[已解答] 怎么完善 序号球 程序

[复制链接]
发表于 2014-11-18 22:51:00 | 显示全部楼层 |阅读模式
   程序是一个标序号球的LSP,目前问题是:设置半径增大时,球标内文字没有一起变大
                                    

以下源码:

(defun c:xh ()
   (setvar "cmdecho" 0)   ;命令回显
  (setq tx (getint "\n起始数字:"))
   (if (= tx nil)(setq tx 1))
   (setq yq (getdist "\n序号球直径:"))
   (if (= yq nil)(setq yq 5))
   (while
     (setq os (getvar "osmode"))  ;系统变量
     (setq po (getpoint "\n引线起点:"))
      (setvar "osmode" 0)  ;设置系统变量
     (command "line" po pause "")
      (setq pt (cadr (grread pause)))
      (setq ang (angle po pt))
      (command "circle" "2p" pt (polar pt ang yq) "")
      (setq cir entlast)
      (setq cirdata (cdr (assoc 10 (entget (cir)))))
      (command "text" "j" "m" cirdata "" "" tx "")
      (setq tx (1+ tx))
      (setvar "osmode" os)
   )
)

如何修改??
发表于 2014-11-18 23:25:43 | 显示全部楼层
  1. (defun c:xh ( / os tx yq po pt ang cir cirdata )
  2.         (setq os (getvar "osmode"))  ;系统变量   
  3.    (setvar "cmdecho" 0)   ;命令回显
  4.   (setq tx (getint "\n 序号起始数字(1):"))
  5.    (if (= tx nil)(setq tx 1))
  6.    (setq yq (getdist "\n序号球直径(5):"))
  7.    (if (= yq nil)(setq yq 5))
  8.    (while (setq po (getpoint "\n引线起点:"))
  9.      (command "line" po pause "")
  10.       (setq pt (cadr (grread pause)))
  11.       (setq ang (angle po pt))
  12.       (command "circle" "2p" pt (polar pt ang yq))
  13.       (setq cir entlast)
  14.       (setq cirdata (cdr (assoc 10 (entget (cir)))))
  15.       (command "text" "j" "m" cirdata "" "" tx)
  16.       (setq tx (1+ tx))
  17.    )   
  18.    (setvar "osmode" os)
  19.    (princ)
  20. )
发表于 2014-11-19 00:40:48 | 显示全部楼层
很好,谢谢!
 楼主| 发表于 2014-11-19 19:30:50 | 显示全部楼层
wzg356 发表于 2014-11-18 23:25

不行,没有效果,直径变化时 ,文字依然没有变化
发表于 2014-11-19 21:31:02 | 显示全部楼层
本帖最后由 ZZXXQQ 于 2014-11-21 07:52 编辑
  1. (defun c:xh ( / os tx yq high po pc)
  2.   (setq os (getvar "osmode"))  ;系统变量   
  3.   (setvar "cmdecho" 0)   ;命令回显
  4.   (setq tx (getint "\n 序号起始数字(1):"))
  5.   (if (= tx nil)(setq tx 1))
  6.   (setq yq (getdist "\n序号球直径(5):"))
  7.   (if (= yq nil)(setq yq 5))
  8.         (setq high (* yq 1.5))
  9.   (while (and (setq po (getpoint "\n引线起点: "))
  10.               (setq pc (getpoint po "\n引线终点: ")))
  11.    (setq pe (polar pc (angle pc po) yq))
  12.    (command "line" po pe "" "circle" pc yq)
  13.    (command "text" "m" pc high "" (itoa tx))
  14.    (setq tx (1+ tx))
  15.   )
  16.   (setvar "osmode" os)
  17.   (setvar "CMDECHO" 1)
  18.   (princ)
  19. )
 楼主| 发表于 2014-11-20 22:09:44 | 显示全部楼层
ZZXXQQ 发表于 2014-11-19 21:31

命令: ; 错误: 输入的列表有缺陷   不能正常运行 运行环境 autocad 2004

点评

5楼已改,再试试。  发表于 2014-11-21 07:53
 楼主| 发表于 2014-11-21 19:49:41 | 显示全部楼层
lengxiaxi 发表于 2014-11-20 22:09
命令: ; 错误: 输入的列表有缺陷   不能正常运行 运行环境 autocad 2004

改的很棒!已达到预期效果!谢谢Z版!

Z版如果有空的话,能否帮忙看看我的另外一个帖子 http://bbs.mjtd.com/thread-112101-3-1.html 有热心人回复晓东有个类似的lsp,但是我试了下,应该是需要加载晓东api的,您能帮我写个独立的lsp吗?我想很多做钣金的人也需要这样一个lsp提高绘图速度。
发表于 2014-11-21 20:36:46 来自手机 | 显示全部楼层
lengxiaxi 发表于 2014-11-21 19:49
改的很棒!已达到预期效果!谢谢Z版!

Z版如果有空的话,能否帮忙看看我的另外一个帖子 http://bbs.mj ...

人心不足蛇吞象啊!
 楼主| 发表于 2014-11-22 10:15:10 | 显示全部楼层
highflybird2014 发表于 2014-11-21 20:36
人心不足蛇吞象啊!

我这个‘不足’,不为金钱,不为名利,只为画好图,您说这过分不?

点评

已经有人给你程序了,你就知足吧,源码可遇不可求!要知道来这里帮助人的都是义务的!  发表于 2014-11-22 11:46
 楼主| 发表于 2014-11-22 11:59:49 | 显示全部楼层
lengxiaxi 发表于 2014-11-22 10:15
我这个‘不足’,不为金钱,不为名利,只为画好图,您说这过分不?

亲,我的帖子多数是请人修改的,不单单是来求写的。

   另外一点,明经最大的特点就是分享精神! 我虽然只能提供不完美的源码,但是经过大家的帮助后,变得完善,然后可以给更多的人搜索到,并下载应用,你说这不也是一个好事吗?并不是所有的欲望都是不好的,求知与分享不也是一种欲望吗?与其在这里评论是与非,不如把这点时间留出来多帮助下别人。对吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-23 19:40 , Processed in 0.164578 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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