乐筑天下

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

[编程交流] 选择一个项目

[复制链接]

41

主题

301

帖子

265

银币

后起之秀

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

铜币
209
发表于 2022-7-6 14:48:14 | 显示全部楼层 |阅读模式
我一辈子都记不住了,我记不起正确的措辞来找到它;(.
 
我只想选择一个项目,这就是pedit的工作原理。
 
 
这是我目前拥有的,但一旦被选中,我希望它继续前进
  1. (setq ss1 (ssget "X" '((0 . "INSERT")(66 . 1))))

 
谢谢你抽出时间
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 14:55:34 | 显示全部楼层
是否需要用户选择项目,如(ssget“X”…)将自动选择项目。
 
如果它确实是来自用户的单个选择,您可以使用以下任一选项:
 
  1. (if (and (setq ent (car (entsel "\nSelect Item: ")))
  2.         (= "INSERT" (cdr (assoc 0 (entget ent))))
  3.         (= 1 (cdr (assoc 66 (entget ent)))))
  4. (progn
  5. ;...do stuff...
  6.   )
  7. (princ "\nSelected Item Isn't an Attributed Block"))

 

 
  1. (if (setq ss (ssget "_:S" '((0 . "INSERT") (66 . 1))))
  2. (progn
  3.   ;; do stuff here...
  4.   )
  5. (princ "\nNothing Selected"))
回复

使用道具 举报

41

主题

301

帖子

265

银币

后起之秀

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

铜币
209
发表于 2022-7-6 15:02:09 | 显示全部楼层
谢谢李的回复。
这就是我想要的
  1. (while
  2. (not
  3. (setq ss (ssget "_:S" '((0 . "INSERT") (66 . 1))))
  4. )
  5. )

 
还有,当我烦你的时候。
还有什么替代方案
  1. (setq en (ssname ss1 0))
  2. (setq ed (entget en))
  3. (setq blkn (dxf 2 ed))

很快就会出现这种情况
  1. (= "ITEMBALLOON" blkn)

 
(试图找到正确的块)
 
 
谢谢你抽出时间!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:14:37 | 显示全部楼层
如果您只希望用户选择该特定块,只需将其包括在ssget的过滤器列表中:
 
  1. (while
  2. (not
  3. (setq ss (ssget "_:S" '((0 . "INSERT")(2 . "ITEMBALLOON")(66 . 1))))
  4. )
  5. )
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:19:19 | 显示全部楼层
 
但在回答你的问题时:
 
  1. (setq blkn (cdr (assoc 2 (entget (ssname ss1 0)))))
回复

使用道具 举报

41

主题

301

帖子

265

银币

后起之秀

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

铜币
209
发表于 2022-7-6 15:24:38 | 显示全部楼层
非常感谢!!
 
最后一个问题。
为什么这一点不起作用,它会重复,但不会停止,
  1. (defun c:ct ()
  2.     ;for testing
  3.     ;to find if want to increase or renumber from a selected up
  4. (setq incre (getstring (strcat "\nDo you want to renumber(1,2) or increment (+1,-2)? <" incre "> :")))
  5.     ;works out the choice made
  6. (cond ((= (substr incre 1 1) "+")
  7. (progn
  8.    (setq change 0)
  9.    (setq orgno (atoi (substr incre 2)))
  10. )
  11. )
  12. ((= (substr incre 1 1) "-")
  13. (progn
  14.    (setq change 1)
  15.    (setq orgno (atoi (substr incre 2)))
  16. )
  17. )
  18. ((<= 1 (atoi incre))
  19. (progn
  20.    (setq change 2)
  21.    (setq orgno (atoi incre))
  22. )
  23. )
  24. )
  25. [color=red];this while!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/color]
  26. (while
  27. (progn
  28.    (setq ss1 nil) ;select the block for it to be done to.
  29. (while
  30.    (not
  31.      (setq ss1 (ssget "_:S" '((0 . "INSERT") (66 . 1))))
  32.    )
  33. )
  34.     ;finds its data
  35. (setq en (ssname ss1 0))
  36. (setq ed (entget en))
  37.     ;makes sure its itemballoon
  38. (setq blkn (cdr (assoc 2 ed)))
  39. (cond
  40.    ((= blkn "ITEMBALLOON")
  41.     (progn
  42.       (setq edata (entget en))
  43.       (setq edata (entget (entnext (cdr (assoc -1 edata)))))
  44.     ;gives attibutes current number
  45.       (setq itembubbleorg (atoi (cdr (assoc 1 edata))))
  46.       (rever)
  47.     )
  48.    )
  49.    ((not (= blkn "ITEMBALLOON"))
  50.     (Princ "\nYou Must Select the Item Bubble or masslist block")
  51. )
  52.    )
  53. )
  54. )
  55. )
  56. (defun rever ()     ;0, addes the number to the items one,1 takes it away, 2 changes it to selected one, then every item seleted will add one to that (change 3)     
  57. (cond
  58.    ((= change 0)
  59.     (setq itembubblenew (+ itembubbleorg orgno))
  60.    )
  61.    ((= change 1)
  62.     (setq itembubblenew (- itembubbleorg orgno))
  63.    )
  64.    ((= change 2)
  65.     (progn
  66.       (setq change 3)
  67.       (setq itembubblenew orgno)
  68.     )
  69.    )
  70.    ((= change 3)
  71.     (setq itembubblenew (1+ itembubblenew))
  72.    )
  73. )
  74.     ;creates the number to a string
  75. (setq interitembubblenew (itoa itembubblenew))
  76.     ;inserts it back to the attribute
  77. (setq el (subst (cons 1 interitembubblenew) (assoc 1 edata) edata))
  78. (entmod el)
  79. )

 
 
可能不是函数方法,但需要考虑
 
杰米
回复

使用道具 举报

5

主题

194

帖子

193

银币

初来乍到

Rank: 1

铜币
24
发表于 2022-7-6 15:33:52 | 显示全部楼层
我想这是一条捷径:
 
[code](defun c:ct(/incre change orgno ss1 att newitem)(setq incre(getstring(strcat“\n您想重新编号(1,2)或增量(+1,-2)?:”)(cond((=(substr incre 1 1)”+)(setq change 0 orgno(atoi(substr incre 2)))((=(substr incre 1 1)”-”)(setq change 1 orgno(atoi(substr incre 2)))((
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:39:17 | 显示全部楼层
不确定最终目标是什么,但这是我的一个选择。
[code](defun c:ct(/incre change orgno ss1 att newitem)(或incre(setq incre“+1”))(setq incre(getstring(strcat”\n是否要重新编号(1,2)或增量(+1,-2)?:”)(cond(=(substr incre 1)”+“”(setq change 0 orgno(atoi(substr incre 2)))(=(substr incre 1 1)”-“”)(setq更改1 orgno(atoi(substr增量2)))((
回复

使用道具 举报

CAB

29

主题

781

帖子

430

银币

中流砥柱

Rank: 25

铜币
526
发表于 2022-7-6 15:47:31 | 显示全部楼层
可悲的是,我似乎没有得到任何可行的建议,
杰米,我本来想这么做的,但是“S”的效果是一样的,
谢谢李,我会接受的
出租车,伙计,你的车没法开,试着玩弄它,但不行。
如果看不到它的作用,请放置一个带属性的块,其中第一个属性是一个数字,然后可以为每个选定的块选择将其增加6“+6”或“-6”,或者从任何数字开始重新编号。
我相信阿斯米,有一个非常相似的,但我不想要前缀或苏菲派
 
谢谢你们的帮助!
回复

使用道具 举报

41

主题

301

帖子

265

银币

后起之秀

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

铜币
209
发表于 2022-7-6 15:52:32 | 显示全部楼层
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 21:58 , Processed in 0.331343 second(s), 72 queries .

© 2020-2025 乐筑天下

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