乐筑天下

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

[编程交流] Routine request - Set some lay

[复制链接]

9

主题

33

帖子

23

银币

初来乍到

Rank: 1

铜币
47
发表于 2022-7-6 17:13:35 | 显示全部楼层 |阅读模式
Hi!
 
I have many layers i would like to see them forced to specific linetypes.
Let say;
Layers.............Linetypes
M-N-INC-25--->Hidden-25
M-N-INC-32--->Hidden-32
 
I would like to bind this function to a button and each time i click the button it set the layers to the specific linetypes above.. and when i click button one more time it set all these layers back to "By Layer" ...
if its not possible i could use 2 button instead but its less impressive
 
Thanks in advance.
回复

使用道具 举报

4

主题

940

帖子

961

银币

初来乍到

Rank: 1

铜币
12
发表于 2022-7-6 17:34:56 | 显示全部楼层
used as a learning experience... minimal error checking and testing
Edit as necessary
BTW... you can't set a layer's linetype to Bylayer, I used Continuous
  1. (defun c:test (/ laylist) (setq laylist (list "M-N-INC-25" "M-N-INC-32")) (if   (eq (getvar "useri1") 0)    (progn      (foreach    ln laylist    (if      (tblsearch "ltype" (strcat "Hidden-" (substr ln (- (strlen ln) 1))))        (command "layer" "l" (strcat "Hidden-" (substr ln (- (strlen ln) 1))) ln "")      (alert (strcat "Load linetype " (strcat "Hidden-" (substr ln (- (strlen ln) 1))) " first"))      );if            )                       ;foreach      (setvar "useri1" 1)    )                    ;progn    (progn      (foreach    ln laylist    (command "layer" "l" "continuous" ln "")      )                             ;foreach      (setvar "useri1" 0)    )                    ;progn )                    ;if)                    ;defun
回复

使用道具 举报

9

主题

33

帖子

23

银币

初来乍到

Rank: 1

铜币
47
发表于 2022-7-6 17:54:50 | 显示全部楼层
Wow it work really good
 
I would like to understand few things on how it work.
i am still at the "hello world" state.
 
       (tblsearch "ltype" (strcat "Hidden-" (substr ln (- (strlen ln) 1))))
         (command "layer" "l" (strcat "Hidden-" (substr ln (- (strlen ln) 1))) ln "")
       (alert (strcat "Load linetype " (strcat "Hidden-" (substr ln (- (strlen ln) 1))) " first"))
 
First line, i beleive you are gathering ltype into the *.lin file...
one line 2 you force the layer to be on a linetype...
line 3 (alert) no idea...
 
Can you please tell me how it work i dont see how you call Hidden-25 line type..
 
and i would like to add more layer/Ltype in the future
 
Let say
M-N-MAIN-100 --to ltype--- CENTER-100
 
how can i do that?
回复

使用道具 举报

4

主题

940

帖子

961

银币

初来乍到

Rank: 1

铜币
12
发表于 2022-7-6 18:21:26 | 显示全部楼层
First line > takes the layer's name, strips all but the last 2 characters and tacks it on to Hidden-, then searches to see if the linetype Hidden-nn is loaded. If it is loaded it sets the layer's linetype to Hidden-nn (line 2). If the linetype is not loaded it skips to line 3 and gives you an alert to load it first.
 
As far as the rest, I suppose it could done, but maybe layer states would be easier.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 16:13 , Processed in 0.332265 second(s), 60 queries .

© 2020-2025 乐筑天下

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