乐筑天下

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

[编程交流] Select one object/entity, grip

[复制链接]

15

主题

52

帖子

37

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 07:15:37 | 显示全部楼层 |阅读模式
What function should i use to do that? I'm planning to change all entities in one layer but its is hard to select by windowing/crossing method because i have many entities in my drawing, so, i want to just click one but gripped all objects in the same layer to change simultaneously in just one command.
 
Thanks in advance..
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:24:25 | 显示全部楼层
QSelect / GetSel
回复

使用道具 举报

15

主题

52

帖子

37

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 07:27:36 | 显示全部楼层
 
Thanks Lee, but as I go to Autodesk Help (AutoLisp Functions) to see an example as my reference I've notice that there is no functions such as Getsel.
can u please give me an example of that?
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-6 07:30:04 | 显示全部楼层
 
GetSel is a command , and Lee gave you two options so you can use either of them
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 07:38:25 | 显示全部楼层
A third built-in alternative is the FILTER command.
 
The GETSEL command is part of Express pack; for this reason it isn’t listed in AutoCAD’s help. If you cannot call it at command prompt, too, this may be from either the fact that you don’t have that extension installed, or that you are using the LT type of AutoCAD.
回复

使用道具 举报

15

主题

52

帖子

37

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 07:40:30 | 显示全部楼层
 
Ok, I got you guys.. Thanks!
 
I tried this routine to make a selection and change all text heights in just one command but all I've got is  error: bad argument type: lselsetp
 
Would you please help me to do this right..
 
  1. (defun c:CTH ()   (graphscr)   ;(prompt "text height to change")(terpri)   (setq a (car (entsel)))(terpri)   (if a (setq a (cdr(assoc 8 (entget a)))          sslst(list (cons 0 "text")(cons 8 a))  )   );end if           (setq nh(getreal "New Text Height: "))          ;(princ "\nWORKING\n")       (setq N (sslength sslst))         (progn         (setq n1 N)         (repeat N           (setq n1 (- n1 1))           (setq b (ssname sslst n1))           (setq c (cdr(assoc 0(entget b))))           (if (= c "TEXT") (progn               (setq e (entget b))               (setq f (assoc 40 e))               (setq g (atof(rtos(cdr f)2 6)))               (entmod (subst(cons(car f) nh) f e))           ))           ))(princ))
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 07:45:28 | 显示全部楼层
That code attempts to treat a list as a selection set; I believe that this line:
  1. sslst (list (cons 0 "text") (cons 8 a))
should be instead:
  1. sslst [color=red](ssget "_X" [/color](list (cons 0 "text") (cons 8 a)[color=red])[/color])
回复

使用道具 举报

15

主题

52

帖子

37

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 07:48:06 | 显示全部楼层
well, i got it now.. here it is..
 
  1. (defun c:CTH ()   (graphscr)   (prompt "text height to change")(terpri)   (setq x (car (entsel)))(terpri)   (if x (setq x (cdr(assoc 8 (entget x)))          sslst(list (cons 0 "text")(cons 8 x))  )   );end if   (setq a (ssget "x" sslst))           (setq nh(getreal "New Text Height: "))        (setq N (sslength a))         (progn         (setq n1 N)         (repeat N           (setq n1 (- n1 1))           (setq b (ssname a n1))           (setq c (cdr(assoc 0(entget b))))           (if (= c "TEXT") (progn               (setq e (entget b))               (setq f (assoc 40 e))               (setq g (atof(rtos(cdr f)2 6)))               (entmod (subst(cons(car f) nh) f e))           ))           ))(princ))
 
Thank you Guys...
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 07:52:53 | 显示全部楼层
You should localize your variables and include the entire processing in the IF, or at least ensure that exit if user didn't select first text item. Just run your routine twice in a row, and second time do not select a text label, input a text height different than at first run and see what is happening.
Also, please edit the above port and add the required code tags. Thank you.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-6 08:01:13 | 显示全部楼层
Pay attention to locked layers with the selection method "_x"
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 10:01 , Processed in 0.781087 second(s), 72 queries .

© 2020-2025 乐筑天下

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