乐筑天下

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

[编程交流] Turn off non-plottable layers

[复制链接]

3

主题

11

帖子

8

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-5 22:19:05 | 显示全部楼层 |阅读模式
Anyone have a Lisp routine that will turn off all layers marked as not plottable?
 
Thanks, Tom
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 22:41:14 | 显示全部楼层
Try the following:
  1. (defun c:nonplotoff ( / a e )   (while (setq a (tblnext "layer" (null a)))       (setq e (entget (tblobjname "layer" (cdr (assoc 2 a)))))       (if (zerop (cdr (assoc 290 e)))           (entmod (subst (cons 62 (- (abs (cdr (assoc 62 e))))) (assoc 62 e) e))       )   )   (princ))
回复

使用道具 举报

3

主题

11

帖子

8

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-5 22:52:39 | 显示全部楼层
Excellent! even works with that pesky layer Defpoints...  I see that changing "(cons 62 (- " to "(cons 62 (+ " turns the non-plot layers on.
 
Thank you Lee for all your generous Lisp help.
 
Tom
回复

使用道具 举报

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-5 23:03:07 | 显示全部楼层
ActiveX
  1. (vlax-for layer (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (if   (= (vla-get-plottable layer) :vlax-false)   (vla-put-layeron layer :vlax-false)   ) )
Vanila
  1. (while (setq layer (tblnext "layer" (not layer))) (if (= 0 (cdr (assoc 290 (setq lst (entget (tblobjname "layer" (cdr (assoc 2 layer))))))))   (entmod (subst (cons 62 (- (abs (cdr (setq old (assoc 62 lst)))))) old lst))   ) )
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 23:12:58 | 显示全部楼层
 
You're welcome Tom
 
If you were after both options, the code could be written more concisely as:
 
  1. (defun c:npoff nil (nonplot -))(defun c:npon  nil (nonplot +))(defun nonplot ( f / a e )   (while (setq a (tblnext "layer" (null a)))       (if (zerop (cdr (assoc 290 (setq e (entget (tblobjname "layer" (cdr (assoc 2 a))))))))           (entmod (subst (cons 62 (f (abs (cdr (assoc 62 e))))) (assoc 62 e) e))       )   )   (princ))
回复

使用道具 举报

3

主题

11

帖子

8

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-5 23:22:19 | 显示全部楼层
Efficiency is good... I do use both to quickly "isolate" layers (I hate that term). I use many routines to turn on/off various layers by wildcard: LO___ for off and LON__ for on.
 
Thanks again to London and Baia Mare (I visited Baia Mare in 1981 with my dance company...).
 
Tom
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-11 06:10 , Processed in 0.352385 second(s), 64 queries .

© 2020-2025 乐筑天下

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