乐筑天下

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

[编程交流] cond和重复com帮助

[复制链接]

62

主题

466

帖子

404

银币

后起之秀

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

铜币
310
发表于 2022-7-6 10:37:31 | 显示全部楼层 |阅读模式
我只是想知道怎么做。。
 
  1. (defun C:test (/)
  2. (setq ss (ssget))
  3. (command "_.erase" ss "")
  4. (setq p1 (getpoint "\n**First point**"))
  5. (setq p2 (getpoint p1 "\n**Second point**"))
  6. (command "_.line" p1 p2 nil)
  7. (setq opt (strcase (getstring "\NRepeat Last Command <Yes or No>: ")))
  8. (cond  ((or(= opt "Y")(= opt "YES"))(prompt "\nrepeat last command"))
  9. [color=red];;instead of prompting repeat last command I want it to actually repeat it[/color]
  10.           (T (prompt "\nExiting command"))
  11. )
  12. (princ)
  13. )
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 10:43:31 | 显示全部楼层
这就是你想要实现的吗?
 
  1. (defun c:Test (/ ss p1 p2)
  2. (if (setq ss (ssget "_:L"))
  3.    (progn
  4.      (command "_.erase" ss "")
  5.      (while (and (setq p1 (getpoint "\nSpecify first point: "))
  6.                  (setq p2 (getpoint p1 "\nSpecify second point: "))
  7.             )
  8.        (command "_.line" "_non" p1 "_non" p2 "")
  9.      )
  10.    )
  11. )
  12. (princ)
  13. )
回复

使用道具 举报

24

主题

1265

帖子

1028

银币

后起之秀

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

铜币
362
发表于 2022-7-6 10:44:05 | 显示全部楼层
不确定你想重复哪一部分,但这里有一种方法。。。。
 
  1. (defun C:test (/)
  2. (setq ss (ssget))
  3. (command "_.erase" ss "")
  4. (setq wait T)
  5. (while wait
  6.    (setq p1 (getpoint "\n**First point**"))
  7.    (setq p2 (getpoint p1 "\n**Second point**"))
  8.    (command "_.line" p1 p2 nil)
  9.    (initget 1 "Y N")
  10.    (setq opt (getkword "\nRepeat Last Command [Yes or No]: "))
  11.    (if (eq "N" opt)
  12.      (setq wait nil)
  13.    )
  14. )  
  15. (princ)
  16. )
回复

使用道具 举报

62

主题

466

帖子

404

银币

后起之秀

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

铜币
310
发表于 2022-7-6 10:47:57 | 显示全部楼层
 
看起来你有。午饭后我会测试。
回复

使用道具 举报

51

主题

481

帖子

457

银币

后起之秀

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

铜币
262
发表于 2022-7-6 10:51:27 | 显示全部楼层
对于initget
使用
  1. (initget 1 "Y N")
  2. (setq opt (getkword "\nRepeat Last Command [Yes[color=red]/[/color]No]: "))

 
而不是
  1. (initget 1 "Y N")
  2. (setq opt (getkword "\nRepeat Last Command [Yes[color=red] or[/color] No]: "))

 
显示菜单(见附件)
113736ebin8s88ubz9di9v.png
回复

使用道具 举报

62

主题

466

帖子

404

银币

后起之秀

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

铜币
310
发表于 2022-7-6 10:56:05 | 显示全部楼层
好吧,我给!!
 
如何检索块旋转?
  1. (setq ss (ssget "_:s" '((0 . "insert"))))
  2. ;;not really knowledgeable on assoc or car functions
  3. ;;I did find that rotation = 50
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 10:59:42 | 显示全部楼层
1) 检查有效的选择集:
 
  1. (if (setq ss (ssget '((0 . "INSERT"))))
  2. ...

 
2) 迭代选择集:
 
最直观的可能是:
 
  1. (setq counter 0)
  2. (repeat (sslength ss)
  3. (setq ent (ssname ss counter))
  4. ...
  5. (setq counter (1+ counter))
  6. )

 
3) 查询每个实体的旋转:
 
  1. (cdr (assoc 50 (entget ent)))
回复

使用道具 举报

62

主题

466

帖子

404

银币

后起之秀

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

铜币
310
发表于 2022-7-6 11:02:33 | 显示全部楼层
 
 
谢谢你,先生
回复

使用道具 举报

62

主题

466

帖子

404

银币

后起之秀

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

铜币
310
发表于 2022-7-6 11:04:09 | 显示全部楼层
旋转是50吗?我得到了一些奇怪的角度。。。
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 11:07:44 | 显示全部楼层
它将以弧度为单位。
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-6 09:05 , Processed in 0.875351 second(s), 85 queries .

© 2020-2025 乐筑天下

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