乐筑天下

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

[编程交流] layer created & sorted base on

[复制链接]

9

主题

51

帖子

42

银币

初来乍到

Rank: 1

铜币
45
发表于 2022-7-5 17:32:25 | 显示全部楼层 |阅读模式
Description of lisp
How to make lisp include entities inside nested blocks? 
  1. ; CBLAYR.LSP  Change entity color to BYLAYER.;; This program sorts entities by their color, and places all entities with; the same color on a layer whose name is the color number (e.g., entities; with the color # 3 will be placed on a layer named "3").;; The entity color of all entities are changed to "BYLAYER", and the layer; inherits the color of the entities placed on it.;; Essentially, this program was written to eliminate entities with explicit; color properties, in preperation for exporting via DXF to a post-processor; that does not honor color-by-entity.   Use at your own risk.  (defun C:CBYLAYER ( / ss i hi clayer)     (initget 7)     (setq maxcolor (getint "\nHighest color number: "))     (setq i 0)     (princ "\nConverting entity colors from by-entity to by-layer...")     (setq hi (getvar "highlight"))     (setq clayer (getvar "clayer"))     (setvar "highlight" 0)     (setvar "cmdecho" 0)     (command ".layer")     (repeat maxcolor (command "make" (itoa (setq i (1+ i))) "c" i ""))     (command "")     (setq i 0)     (repeat maxcolor        (if (setq ss (ssget "x" (list (cons 62 (setq i (1+ i))))))            (command ".chprop" ss "" "la" (itoa i) "c" "bylayer" "")))     (setvar "highlight" hi)     (command ".layer" "s" clayer "")     (princ)  )
回复

使用道具 举报

rlx

21

主题

1505

帖子

1551

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
81
发表于 2022-7-5 18:31:51 | 显示全部楼层
Hi Tripledot,
 
 
Study this link http://www.cadtutor.net/forum/showthread.php?19161-lisp-for-changing-all-objects-in-a-block-to-layer-quot-0-quot
 
 
You can also find some examples on Lee's site on how to acces subentities in a block , some examples are easier to understand than others (for a beginner?) but all are elegantly written.
 
 
Gr. Rlx
回复

使用道具 举报

9

主题

51

帖子

42

银币

初来乍到

Rank: 1

铜币
45
发表于 2022-7-5 18:44:58 | 显示全部楼层
Found answer here
 
http://www.cadtutor.net/forum/showthread.php?533-Lisp-colour-change-for-all-layers-and-blocks&p=531712&viewfull=1#post531712
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-13 04:06 , Processed in 0.393600 second(s), 58 queries .

© 2020-2025 乐筑天下

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