乐筑天下

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

[编程交流] Selected Objects to color# LIS

[复制链接]

4

主题

16

帖子

12

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 05:25:00 | 显示全部楼层 |阅读模式
Hi guys i'm trying to figure out how to make this lisp and I'm just not able to get it done
 
I would like a lisp to do this by launching "CHC"
 
- Select objects (or objects could be already selected when launching the CHC lisp)
 
- Question asked: "Which color ?" (answering a color number)
 
- If number is 256 or more (its wrong) and the question has to be reasked to get a number between 1 and 255.
 
-Change selection set to the color# answered
 
I've try this but it doesnt work :
 
  1. (defun c:chc ( / obj col#)(setq cmdecho 0)(setq obj (ssget))(setq col# (getint "\nQuelle couleur ? : "))(if (< col# 255) (setq col# (getint "\nQuelle couleur ? : " (command "change" obj "" "properties" "color" col# ""))))(princ))
 
Thanks!
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-6 05:33:11 | 显示全部楼层
How many people know what color is associated with what color number?
 
Lee Mac came up with this lisp routine for another thread where a similar question was asked.
 
http://www.cadtutor.net/forum/showthread.php?43839-Lisp-to-change-all-objects-with-a-certain-color-to-another-color
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-6 05:37:48 | 显示全部楼层
Try it this way instead .
 
  1. (defun c:chc (/ c s i e) (if (and (setq c (acad_colordlg 256))          (progn (princ "\n Select object to change thei colors ")                 (setq s (ssget "_:L"))          )     )   (repeat (setq i (sslength s))     (setq e (entget (ssname s (setq i (1- i)))))     (entmod (append e (list (cons 62 c))))   ) ) (princ))
回复

使用道具 举报

4

主题

16

帖子

12

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 05:39:19 | 显示全部楼层
 
I does, our plot setup use color for lineweight. Often I force color on objects.
 
Thanks I'll check it out
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-6 05:42:32 | 显示全部楼层
OK...so maybe you do.  Do your colleagues know all the color numbers?
 
Does it make sense to override layer colors?
回复

使用道具 举报

4

主题

16

帖子

12

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 05:49:40 | 显示全部楼层
 
Great, can you make that I can type number instead and add the option for the pop up by typing "C" for if I don't remeber my color number?
If not, I'll take it like this.
Great work
Thanks a lot for the fast answers!
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 05:53:51 | 显示全部楼层
I'd look into (acad_colordlg )
 
-David
回复

使用道具 举报

4

主题

16

帖子

12

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 05:58:58 | 显示全部楼层
 
They do. We have a chart and for a specific lineweight, we have ±2 color number. Steps of ±0.1.
 
It makes sense for us to override layer colors for hidden parts that we have to see thinner. Not everything is forced in the drawing!
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-6 06:02:44 | 显示全部楼层
Wouldn't it make more sense to have a layer called Hidden with an assigned color like grey for example?
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-6 06:05:16 | 显示全部楼层
This... ?
 
  1. (defun c:chc (/ s i e) (if (not c)   (setq c 1) ) (while   (not (< 0           (setq             c              (cond                ((getint (strcat "\n Specify color between [1-255] ( "                                 (itoa c)                                 " ) : "                         )                 )                )                (t c)              )           )           255        )   )    (princ "\n Number of color must be between [1-255] ") ) (if   (and     c     (progn (princ "\n Select object to change thei colors ")            (setq s (ssget "_:L"))     )   )    (repeat (setq i (sslength s))      (setq e (entget (ssname s (setq i (1- i)))))      (entmod (append e (list (cons 62 c))))    ) ) (princ))
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 18:41 , Processed in 0.608338 second(s), 72 queries .

© 2020-2025 乐筑天下

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