明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 988|回复: 6

[源码] 立面标高的程序

[复制链接]
发表于 2018-6-10 09:27 | 显示全部楼层 |阅读模式
这是一个标立面标高的程序,每次执行都要输入一次基点标高值,我的想法是,第一次执行程序,输入了基点标高值,在没有移动图形的情况下,再执行这个程序时,就不需要在输入基点标高值了,直接选标注点标标高值,这个怎么改
  1. (defun c:bg1 (/ pt1 pt2 old_cmd cl ortho ww hh1 ang pt3 hh hh2 str bg)
  2. (setvar "clayer" "标高")   
  3. (setq pt1 (getpoint "\n标高基准点:"))
  4. (if (not (setq hh1 (getreal "\n请输入基准点标高±0.000:")))  
  5.              (setq hh1 0.000)
  6.            )
  7.            (setq hh1 (if (/= hh1 0)   
  8.             (rtos hh1 2 3)           
  9.              "%%P0.000"         
  10.                       )
  11.            )
  12. (while(setq pt2 (getpoint "\n定位点:")); 此点相对基准往左、右对应相应的标高符号
  13. (setq ang (angle pt1 pt2))
  14. (setq pt3 (polar pt2 0 100))
  15. (setq hh (szx_h pt1 pt2)
  16.       hh2 (/ hh 1000)
  17.     )
  18. (if (/= (type hh1) 'str)(setq hh1(vl-princ-to-string hh1)));判断是否是字符串并转换
  19. (setq hh1 (atof hh1))           ;字符串转换成实型数
  20. (if (and (> ang 0)(< ang 3.141))
  21. (setq str (+ hh1 hh2))
  22. (setq str (- hh1 hh2))
  23. )
  24.   (setq str (if (/= str 0)   
  25.             (rtos str 2 3)           
  26.              "%%P0.000"         
  27.                       )
  28.   )
  29. (if (and (> ang 1.570)(< ang 4.712))  
  30. (command "._insert" "bgz.dwg" "non" pt2 "" "" str)
  31. (command "._insert" "bgy.dwg" "non" pt2 "" "" str)
  32. )
  33. (setq bg (entlast))
  34. (initget "Yes No")
  35.         (if (= "Yes"
  36.                (getkword "\n是否镜像?[是(Y)/否(N)] <N>:")
  37.             )
  38.             (command "mirror" bg "" "non" pt2 "non" pt3 "y")
  39.         )
  40. (setvar "orthomode" 1);_开  
  41. (prompt "\n左右移动定位: ")   
  42. (command "_move" bg "" pt2  pause )
  43. (setvar "orthomode" 0);_关
  44. )
  45.     (princ)
  46. )



"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2018-6-10 12:00 | 显示全部楼层
您可参考调用了 Ureal 函式的老帖
 楼主| 发表于 2018-6-10 13:22 | 显示全部楼层
Andyhon 发表于 2018-6-10 12:00
您可参考调用了 Ureal 函式的老帖

找了一下,没有查到Ureal 函式  能给个链接吗
发表于 2018-6-10 13:54 | 显示全部楼层
 楼主| 发表于 2018-6-10 16:29 | 显示全部楼层
Andyhon 发表于 2018-6-10 13:54
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=108502
http://bbs.mjtd.com/forum.php?mod=viewthrea ...

谢谢,我看了一下,没有明白ureal函数的作用,可以简单说说吗
发表于 2018-6-10 16:47 | 显示全部楼层
(defun ureal (bit kwd msg def / inp)

(ureal 1 "" "\n增减值(正为增,负为减)" NBTV_TXT_CopyADD)

NBTV_TXT_CopyADD 即为默认值
发表于 2023-2-11 09:19 | 显示全部楼层
非常不错的代码,谢谢楼主分享啊。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-26 01:34 , Processed in 0.174275 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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