乐筑天下

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

[编程交流] Simple lisp request please :)

[复制链接]

9

主题

25

帖子

15

银币

初来乍到

Rank: 1

铜币
48
发表于 2022-7-6 12:45:40 | 显示全部楼层 |阅读模式
is it possible for someone to make me a lisp to invert the layer status? (on/off, frozen/thawed)
 
what do you think? is it easy?
 
many thanks in advance
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 12:59:19 | 显示全部楼层
I'll be glad when this insomnia wears off, I'd like to go to bed.
This is a fairly easy task to accomplish. Definitely something anyone could accomplish with a little work.
 
Hope this helps.  BTW, I think this can be accomplish in the layer manager, but I'm not sure, I never open it.
 
  1. ;;; Invert on/off and freeze/thaw state of all layers in drawing;;; Alan J. Thompson, 09.14.09(defun c:LayerInvert (/ #Doc) (vl-load-com) (vlax-for x (vla-get-Layers               (setq                 #Doc (vla-get-activedocument (vlax-get-acad-object))               ) ;_ setq             ) ;_ vla-get-Layers   ;; invert on/off state   (vl-catch-all-apply     'vla-put-layeron     (list x           (if (eq (vla-get-layeron x) :vlax-true)             :vlax-false             :vlax-true           ) ;_ if     ) ;_ list   ) ;_ vl-catch-all-apply   [color=Red];; invert freeze/thaw state   (vl-catch-all-apply     'vla-put-freeze     (list x           (if (eq (vla-get-freeze x) :vlax-true)             :vlax-false             :vlax-true           ) ;_ if     ) ;_ list   ) ;_ vl-catch-all-apply[/color] ) ;_ vlax-for (vla-regen #Doc acActiveViewport) (princ)) ;_ defun
回复

使用道具 举报

9

主题

25

帖子

15

银币

初来乍到

Rank: 1

铜币
48
发表于 2022-7-6 13:05:01 | 显示全部楼层
hmmm.... it doesnt seem to switch on those that are off......
 
(because it needs to do that)
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 13:19:37 | 显示全部楼层
Works fine for me. On->Off, Off->On, Frozen->Thawed, Thawed->Frozen
I even tested it on a file that has 730 layers (some even xrefed) with all assorted states. Everything was completely successful.
回复

使用道具 举报

9

主题

25

帖子

15

银币

初来乍到

Rank: 1

铜币
48
发表于 2022-7-6 13:20:51 | 显示全部楼层
i'll try again on another drawing later.... busy at work at the moment.... btw have you managed to get some sleep?
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 13:29:16 | 显示全部楼层
Hope you get it to work. I'll give it another look tomorrow. Still no sleep, but I'm going to make another attempt at it.
回复

使用道具 举报

9

主题

25

帖子

15

银币

初来乍到

Rank: 1

铜币
48
发表于 2022-7-6 13:44:58 | 显示全部楼层
i realised my problem now which is with my original question :S
 
can you remove the part where it inverts the freeze/thawed state because i was letting everything thawed so it froze everything....
 
my mistake sorry....
 
thanks again for your help
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 13:51:07 | 显示全部楼层
 
Easy fix, just remove this portion from the above code (I marked it in red):
  1.     ;; invert freeze/thaw state   (vl-catch-all-apply     'vla-put-freeze     (list x           (if (eq (vla-get-freeze x) :vlax-true)             :vlax-false             :vlax-true           ) ;_ if     ) ;_ list   ) ;_ vl-catch-all-apply
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-5 04:53 , Processed in 0.554595 second(s), 68 queries .

© 2020-2025 乐筑天下

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