明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4497|回复: 12

[已解答] 怎么跳出PAUSE

[复制链接]
发表于 2014-9-16 12:32:59 | 显示全部楼层 |阅读模式
(DEFUN C:HD1()    (prinC "线性标注")(command "_dimlinear" pause pause pause )(c:hd1))
(DEFUN C:HD2()    (prinC "线性标注")(command "_dimlinear" "" pause pause )(c:hd2))
(DEFUN C:DD1()    (prinC "直径标注") (command "_dimdiameter" pause pause (c:dd1)))
(DEFUN C:RD1()    (prinC "半径标注") (command "_dimradius" pause pause (c:rd1)))
(DEFUN C:AD1()    (prinC "标弧度") (command "_dimangular" pause pause pause (c:ad1)))
(DEFUN C:XD1()    (prinC "坐标标注")(command "_.dimordinate" pause pause)(c:xd1))

请教大师,就是想重复执行CAD自带的命令。按上面这样做的话,跳不出PAUSE,想执行下个命令就会有问题!


"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2023-9-28 23:59:35 | 显示全部楼层

这是的f变量起到了什么作用,没看懂
发表于 2014-9-16 12:43:01 | 显示全部楼层
给你个参考
  1. (defun c:dor (/ bpt)
  2.   (prompt "创建坐标点标注")
  3. (setvar "cmdecho" 0)
  4.   (while (setq bpt (getpoint "\n指定点坐标:"))
  5.     (command ".dimordinate")
  6.     (setvar "cmdecho" 1)
  7.     (command bpt)
  8.     (while (> (getvar "cmdactive") 0)
  9.       (command pause)
  10.     )
  11.     (setvar "cmdecho" 0)
  12.   )
  13.   (princ)
  14. )

 楼主| 发表于 2014-9-16 12:43:26 | 显示全部楼层
像图中一样!

本帖子中包含更多资源

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

x
 楼主| 发表于 2014-9-16 13:46:29 | 显示全部楼层
本帖最后由 xiaolong1487 于 2014-9-16 14:10 编辑
SunSpring 发表于 2014-9-16 12:43
给你个参考

谢谢 SunSpring

为什么我改成这样的话选多段线都要先两次呢
  1. (defun c:xd1 (/ pt)
  2.   (prompt "坐标标注")
  3. (setvar "cmdecho" 0)
  4.   (while (setq pt (getpoint "\n指定点坐标:"))
  5.     (command "_dimordinate")
  6.     (setvar "cmdecho" 1)
  7.     (command pt)
  8.     (while (> (getvar "cmdactive") 0)
  9.       (command pause)
  10.     )
  11.     (setvar "cmdecho" 0)
  12.   )
  13.   (princ)
  14. )

  15. (defun c:hd1 (/ pt)
  16.   (prompt "线性标注")
  17. (setvar "cmdecho" 0)
  18.   (while (setq pt (getpoint "\n指定第一条尺寸界线原点:"))
  19.     (command "_dimlinear")
  20.     (setvar "cmdecho" 1)
  21.     (command pt)
  22.     (while (> (getvar "cmdactive") 0)
  23.       (command pause)
  24.     )
  25.     (setvar "cmdecho" 0)
  26.   )
  27.   (princ)
  28. )

  29. (defun c:hdd (/ ent)
  30.   (prompt "线性标注")
  31. (setvar "cmdecho" 0)
  32.   (while (setq ent (entsel "\n选择标注对象:"))
  33.     (command "_dimlinear" "")
  34.     (setvar "cmdecho" 1)
  35.     (command ent)
  36.     (while (> (getvar "cmdactive") 0)
  37.       (command pause)
  38.     )
  39.     (setvar "cmdecho" 0)
  40.   )
  41.   (princ)
  42. )

  43. (defun c:ld1 (/ pt)
  44.   (prompt "对齐标注")
  45. (setvar "cmdecho" 0)
  46.   (while (setq pt (getpoint "\n指定第一条尺寸界线原点:"))
  47.     (command "_dimaligned")
  48.     (setvar "cmdecho" 1)
  49.     (command pt)
  50.     (while (> (getvar "cmdactive") 0)
  51.       (command pause)
  52.     )
  53.     (setvar "cmdecho" 0)
  54.   )
  55.   (princ)
  56. )

  57. (defun c:ldd (/ ent)
  58.   (prompt "对齐标注")
  59. (setvar "cmdecho" 0)
  60.   (while (setq ent (entsel "\n选择标注对象:"))
  61.     (command "_dimaligned" "")
  62.     (setvar "cmdecho" 1)
  63.     (command ent)
  64.     (while (> (getvar "cmdactive") 0)
  65.       (command pause)
  66.     )
  67.     (setvar "cmdecho" 0)
  68.   )
  69.   (princ)
  70. )

  71. (defun c:dd1 (/ ent)
  72.   (prompt "直径标注")
  73. (setvar "cmdecho" 0)
  74.   (while (setq ent (entsel "\n选择圆弧或圆:"))
  75.     (command "_dimdiameter")
  76.     (setvar "cmdecho" 1)
  77.     (command ent)
  78.     (while (> (getvar "cmdactive") 0)
  79.       (command pause)
  80.     )
  81.     (setvar "cmdecho" 0)
  82.   )
  83.   (princ)
  84. )

  85. (defun c:rd1 (/ ent)
  86.   (prompt "半径标注")
  87. (setvar "cmdecho" 0)
  88.   (while (setq ent (entsel "\n选择圆弧或圆:"))
  89.     (command "_.dimradius")
  90.     (setvar "cmdecho" 1)
  91.     (command ent)
  92.     (while (> (getvar "cmdactive" ) 0)
  93.       (command pause)
  94.     )
  95.     (setvar "cmdecho" 0)
  96.   )
  97.   (princ)
  98. )

  99. (defun c:ad1 (/ ent)
  100.   (prompt "弧度标注")
  101. (setvar "cmdecho" 0)
  102.   (while (setq ent (entsel "\n选择圆弧、圆、直线:"))
  103.     (command "_dimangular")
  104.     (setvar "cmdecho" 1)
  105.     (command ent)
  106.     (while (> (getvar "cmdactive") 0)
  107.       (command pause)
  108.     )
  109.     (setvar "cmdecho" 0)
  110.   )
  111.   (princ)
  112. )
发表于 2014-9-16 14:19:42 | 显示全部楼层
xiaolong1487 发表于 2014-9-16 13:46
谢谢 SunSpring

为什么我改成这样的话选多段线都要先两次呢

因为命令要的参数和传递的内容不同,改为(command (cadr ent))
 楼主| 发表于 2014-9-16 14:52:17 | 显示全部楼层
SunSpring 发表于 2014-9-16 14:19
因为命令要的参数和传递的内容不同,改为(command (cadr ent))

谢谢,已经改好了!
  1. (defun c:xd1 (/ pt)
  2.   (prompt "坐标标注")
  3. (setvar "cmdecho" 0)
  4.   (while (setq pt (getpoint "\n指定点坐标:"))
  5.     (command "_dimordinate")
  6.     (setvar "cmdecho" 1)
  7.     (command pt)
  8.     (while (> (getvar "cmdactive") 0)
  9.       (command pause)
  10.     )
  11.     (setvar "cmdecho" 0)
  12.   )
  13.   (princ)
  14. )

  15. (defun c:hd1 (/ pt)
  16.   (prompt "线性标注")
  17. (setvar "cmdecho" 0)
  18.   (while (setq pt (getpoint "\n指定第一条尺寸界线原点:"))
  19.     (command "_dimlinear")
  20.     (setvar "cmdecho" 1)
  21.     (command pt)
  22.     (while (> (getvar "cmdactive") 0)
  23.       (command pause)
  24.     )
  25.     (setvar "cmdecho" 0)
  26.   )
  27.   (princ)
  28. )

  29. (defun c:hdd (/ ent)
  30.   (prompt "线性标注")
  31. (setvar "cmdecho" 0)
  32.   (while (setq ent (entsel "\n选择标注对象:"))
  33.     (command "_dimlinear" "")
  34.     (setvar "cmdecho" 1)
  35.     (command (cadr ent))
  36.     (while (> (getvar "cmdactive") 0)
  37.       (command pause)
  38.     )
  39.     (setvar "cmdecho" 0)
  40.   )
  41.   (princ)
  42. )

  43. (defun c:ld1 (/ pt)
  44.   (prompt "对齐标注")
  45. (setvar "cmdecho" 0)
  46.   (while (setq pt (getpoint "\n指定第一条尺寸界线原点:"))
  47.     (command "_dimaligned")
  48.     (setvar "cmdecho" 1)
  49.     (command pt)
  50.     (while (> (getvar "cmdactive") 0)
  51.       (command pause)
  52.     )
  53.     (setvar "cmdecho" 0)
  54.   )
  55.   (princ)
  56. )

  57. (defun c:ldd (/ ent)
  58.   (prompt "对齐标注")
  59. (setvar "cmdecho" 0)
  60.   (while (setq ent (entsel "\n选择标注对象:"))
  61.     (command "_dimaligned" "")
  62.     (setvar "cmdecho" 1)
  63.     (command (cadr ent))
  64.     (while (> (getvar "cmdactive") 0)
  65.       (command pause)
  66.     )
  67.     (setvar "cmdecho" 0)
  68.   )
  69.   (princ)
  70. )

  71. (defun c:dd1 (/ ent)
  72.   (prompt "直径标注")
  73. (setvar "cmdecho" 0)
  74.   (while (setq ent (entsel "\n选择圆弧或圆:"))
  75.     (command "_dimdiameter")
  76.     (setvar "cmdecho" 1)
  77.     (command (cadr ent))
  78.     (while (> (getvar "cmdactive") 0)
  79.       (command pause)
  80.     )
  81.     (setvar "cmdecho" 0)
  82.   )
  83.   (princ)
  84. )

  85. (defun c:rd1 (/ ent)
  86.   (prompt "半径标注")
  87. (setvar "cmdecho" 0)
  88.   (while (setq ent (entsel "\n选择圆弧或圆:"))
  89.     (command "_.dimradius")
  90.     (setvar "cmdecho" 1)
  91.     (command (cadr ent))
  92.     (while (> (getvar "cmdactive" ) 0)
  93.       (command pause)
  94.     )
  95.     (setvar "cmdecho" 0)
  96.   )
  97.   (princ)
  98. )

  99. (defun c:ad1 (/ ent)
  100.   (prompt "弧度标注")
  101. (setvar "cmdecho" 0)
  102.   (while (setq ent (entsel "\n选择圆弧、圆、直线:"))
  103.     (command "_dimangular")
  104.     (setvar "cmdecho" 1)
  105.     (command (cadr ent))
  106.     (while (> (getvar "cmdactive") 0)
  107.       (command pause)
  108.     )
  109.     (setvar "cmdecho" 0)
  110.   )
  111.   (princ)
  112. )
发表于 2014-9-16 15:49:33 | 显示全部楼层
(defun c:df( / ge ent)
  (setq ge (ssget "i"))
  (if (= ge nil)
    (progn (setvar "cmdecho" 0)
  (while (setq pt (getpoint "\n指定第一条尺寸界线原点:"))
    (command "_dimlinear")
    (setvar "cmdecho" 1)
    (command pt)
    (while (> (getvar "cmdactive") 0)
      (command pause)
    )
    (setvar "cmdecho" 0)
    (command "_.chprop" (entlast) "" "LA" "DIM" "")
  );WHILE
      )
    (progn (setvar "cmdecho" 0)
  (while (setq ent (entsel "\n选择标注对象:"))
    (command "_dimlinear" "")
    (setvar "cmdecho" 1)
    (command (cadr ent))
    (while (> (getvar "cmdactive") 0)
      (command pause)
    )
    (setvar "cmdecho" 0)
    (command "_.chprop" (entlast) "" "LA" "DIM" "")
  );WHILE
      )
    )
    (princ)
)
在上面的程序再做了一下修改,把指定尺寸界线与选择对象整在一起了,分别以先择择对象,与不选择对象执行不同的标注。
最后把标注放到了DIM层
发表于 2014-9-16 16:07:54 | 显示全部楼层
(setq ge (ssget "i")) 高手再出手下,把这句改成判断按空格就完美了。
就与CAD一样了
指定第一条尺寸界线原点或 <选择对象>:
发表于 2014-9-16 16:34:09 | 显示全部楼层
本帖最后由 SunSpring 于 2014-9-16 16:46 编辑
琴剑江山_10184 发表于 2014-9-16 16:07
(setq ge (ssget "i")) 高手再出手下,把这句改成判断按空格就完美了。
就与CAD一样了
指定第一条尺寸界线 ...

  1. (defun c:dli ( / bpt ent f str)
  2.   (prompt "创建线性标注")
  3.   (setq f t)
  4.   (setq str "或 <选择对象>")
  5.   (while (setq bpt (getpoint (strcat "\n指定第一条尺寸界线原点" str ":")))
  6.     (setq f nil)
  7.     (setq str "")
  8.     (command ".dimlinear")
  9.     (setvar "cmdecho" 1)
  10.     (command bpt)
  11.     (while (> (getvar "cmdactive") 0)
  12.       (command pause)
  13.     )
  14.     (setvar "cmdecho" 0)
  15.   )
  16.   (while (and f (setq ent (entsel "\n选择标注对象:")))
  17.     (command ".dimlinear" "")
  18.     (setvar "cmdecho" 1)
  19.     (command (cadr ent))
  20.     (while (> (getvar "cmdactive") 0)
  21.       (command pause)
  22.     )
  23.     (setvar "cmdecho" 0)
  24.   )
  25.   (princ)
  26. )

发表于 2014-9-16 17:01:42 | 显示全部楼层
SunSpring 发表于 2014-9-16 16:34

达到这样的效果了,感谢
请教T是什么意思,
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-17 06:22 , Processed in 0.191947 second(s), 32 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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