乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: tmelancon

[编程交流] 输入平面尺寸(MM)

[复制链接]

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 16:50:52 | 显示全部楼层
尝试:
[code](defun c:dimm(/*error*dft dimsft elst ent oldlayr oldorth pt)(setq oldlayr(getvar“clayer”)(setq oldorth(getvar“orthomode”))(defun*error*(msg)(if oldlayr(setvar“clayer”oldlayr))(if oldorth(setvar“orthomode”oldorth))(if ent(entdel ent))(if(and msg(not(非(wcmatch(strcase msg)”*取消*、*退出*、*退出*、*中断*))(提示消息));(laychk\u s“dim”“5”“continuous”)(while(setq dft(getreal”\n输入管道长度,单位为mm:)(if(setq dimsft;可以为零。(cond(<1 dft 304)。”
回复

使用道具 举报

47

主题

257

帖子

216

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
229
发表于 2022-7-5 16:52:45 | 显示全部楼层
罗伊,我非常感谢你的意见!这真是太棒了!
回复

使用道具 举报

47

主题

257

帖子

216

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
229
发表于 2022-7-5 16:56:51 | 显示全部楼层
回复

使用道具 举报

47

主题

257

帖子

216

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
229
发表于 2022-7-5 17:00:08 | 显示全部楼层
I figured it out guys. I added this to my error handler. Seems to be what I needed. Thanks everyone for their help. Full code in Post #12 has been updated.
 
  1. (and ENT (entdel ENT))
回复

使用道具 举报

47

主题

257

帖子

216

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
229
发表于 2022-7-5 17:04:00 | 显示全部楼层
Grrrrrrr.. Ok so after using it just now, I am noticing a problem, apparently I am writing this method wrong because if the user steps into the routine, enters a value, places the value, then chooses to esc to exit the routine, it always deletes the previously added entity. I will keep trying to figure it out when I have time today.
 
I want the routine to:
1. prompt for value
2. allow user to place value
3. loop if users wants to enter more
4. esc to exit cleanly, leaving previously entered values OR
5. if a user enters another value accidentally but no longer wants that value
6. hitting esc exits the routine then deletes the value that is currently on cursor (grread) waiting for placement- leaving the existing values the user just placed.
回复

使用道具 举报

18

主题

1529

帖子

973

银币

中流砥柱

Rank: 25

铜币
649
发表于 2022-7-5 17:07:31 | 显示全部楼层
Try:

[code](defun c:dimm (/ *error* dft dimsft elst ent oldlayr oldorth pt) (setq oldlayr (getvar "clayer")) (setq oldorth (getvar "orthomode")) (defun *error* (msg)   (if oldlayr     (setvar "clayer" oldlayr)   )   (if oldorth     (setvar "orthomode" oldorth)   )   (if ent     (entdel ent)   )   (if     (and       msg       (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*EXIT*,*BREAK*"))     )     (prompt msg)   ) ) ; (laychk_s "dim" "5" "continuous") (while (setq dft (getreal "\nEnter pipe length in mm: "))   (if     (setq dimsft ; Can be nil.       (cond         ((< 1 dft 304.           "
回复

使用道具 举报

47

主题

257

帖子

216

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
229
发表于 2022-7-5 17:12:28 | 显示全部楼层
Roy I do appreciate your input! This worked out fantastically!
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-13 20:13 , Processed in 0.891920 second(s), 75 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表