乐筑天下

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

[编程交流] 选择某个冻结或关闭l

[复制链接]

1

主题

1

帖子

0

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 17:27:02 | 显示全部楼层 |阅读模式
我想创建一个lisp,当我有一个冻结或解冻的层时,当我不确切地知道我想要的对象在哪一层时,我想在其中。
 
为了明确何时需要打开特定对象,我先放置并放置,然后xlist该对象,然后截图对话框,然后通过图层管理器解冻/或放置我想要的图层。
 
我想知道是否有人可以帮我写一个lisp例程,这将帮助我节省一些时间在这个过程中。
 
谢谢
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 17:52:52 | 显示全部楼层
-LA ON*T*
拾取对象查看其所在的层
U U U U
-洛杉矶
回复

使用道具 举报

95

主题

477

帖子

383

银币

后起之秀

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

铜币
475
发表于 2022-7-5 18:10:13 | 显示全部楼层
这个例程非常有用:http://cadtips.cadalyst.com/layer-properties/unhide-layers.
回复

使用道具 举报

35

主题

140

帖子

108

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
177
发表于 2022-7-5 18:23:23 | 显示全部楼层
该lisp显示一个DCL,显示哪些层处于关闭/冻结/锁定状态
 
  1. ; Turn ON, Thaw ar Unlock layers
  2. ; Stefan M. - 04.06.2013
  3. ; Edited by Jonathan Norton
  4. (defun C:LCON ( / *error* acDoc filen filew id l layers r c l_frz l_off l_lck selected_layers prop val)
  5. (vl-load-com)
  6. (setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
  7. (vla-startundomark acDoc)
  8. (defun *error* (m)
  9.    (and
  10.      m
  11.      (not (wcmatch (strcase m) "*CANCEL*,*QUIT*"))
  12.      (princ (strcat "\nError: " m))
  13.      )
  14.    (vla-endundomark acDoc)
  15.    )
  16. (defun prompt_list ()
  17.    (start_list "a_list")
  18.    (mapcar
  19.      'add_list
  20.      (setq l (cond
  21.                ((= "1" *tog1*) l_off)
  22.                ((= "1" *tog2*) l_frz)
  23.                ((= "1" *tog3*) l_lck)
  24.                )
  25.            )
  26.      )
  27.    (end_list)
  28.    )
  29. (vlax-for la (setq layers (vla-get-layers acDoc))
  30.    (if (eq (vla-get-LayerOn la) :vlax-false)
  31.      (setq l_off (cons (vla-get-Name la) l_off))
  32.      )
  33.    (if (eq (vla-get-Freeze la) :vlax-true)
  34.      (setq l_frz (cons (vla-get-Name la) l_frz))
  35.      )
  36.    (if (eq (vla-get-Lock la) :vlax-true)
  37.      (setq l_lck (cons (vla-get-Name la) l_lck))
  38.      )
  39.    )
  40. (setq l_off (acad_strlsort l_off)
  41.        l_frz (acad_strlsort l_frz)
  42.        l_lck (acad_strlsort l_lck)
  43.        )
  44. (if (or l_off l_frz l_lck)
  45.    (progn
  46.      (setq filew (open (setq filen (strcat (getvar 'dwgprefix) "temp_layer_dialog.dcl")) "w"))
  47.      (write-line
  48.        "layer_on_dialog : dialog {
  49.       label = "Layer Control";
  50.       : column {
  51.       : list_box { label = "Select Layer:"; key = "a_list"; width = 40; height = 15; multiple_select = true; allow_accept = true;}
  52.       : radio_column {
  53.       : radio_button { label = "Off Layers";    key = "tog1"; }
  54.       : radio_button { label = "Frozen Layers"; key = "tog2"; }
  55.       : radio_button { label = "Locked Layers"; key = "tog3"; }}
  56.       ok_cancel;}}" filew)
  57.      (close filew)
  58.      (if
  59.        (>= (setq id (load_dialog filen)) 0)
  60.         (if
  61.           (new_dialog "layer_on_dialog" id)
  62.            (progn
  63.              (or *tog1* (setq *tog1* "1"))
  64.              (or *tog2* (setq *tog2* "0"))
  65.              (or *tog3* (setq *tog3* "0"))
  66.              (prompt_list)
  67.              (action_tile "a_list" "(setq selected_layers $value)")
  68.              (action_tile "tog1"   "(setq *tog1* "1" *tog2* "0" *tog3* "0" selected_layers nil) (prompt_list)")
  69.              (action_tile "tog2"   "(setq *tog1* "0" *tog2* "1" *tog3* "0" selected_layers nil) (prompt_list)")
  70.              (action_tile "tog3"   "(setq *tog1* "0" *tog2* "0" *tog3* "1" selected_layers nil) (prompt_list)")
  71.              (set_tile "tog1" *tog1*)
  72.              (set_tile "tog2" *tog2*)
  73.              (set_tile "tog3" *tog3*)
  74.              (mode_tile "tog1" (if l_off 0 1))
  75.              (mode_tile "tog2" (if l_frz 0 1))
  76.              (mode_tile "tog3" (if l_lck 0 1))
  77.              (setq r (start_dialog))
  78.              (unload_dialog id)
  79.              )
  80.            (princ "\nWrong dialog definition")
  81.            )
  82.         (princ "\nDCL file not found")
  83.         )
  84.      (if (findfile filen) (vl-file-delete filen))
  85.      (if
  86.        (and (= r 1) selected_layers)
  87.         (progn
  88.           (setq prop (cond
  89.                        ((= "1" *tog1*) 'LayerON)
  90.                        ((= "1" *tog2*) 'Freeze)
  91.                        ((= "1" *tog3*) 'Lock)
  92.                        )
  93.                 val  (cond
  94.                        ((= "1" *tog1*) -1)
  95.                        ((= "1" *tog2*) 0)
  96.                        ((= "1" *tog3*) 0)
  97.                        )
  98.                 )
  99.           (foreach x (read (strcat "(" selected_layers ")"))
  100.             (vlax-put (vla-item layers (nth x l)) prop val)
  101.             )
  102.           )
  103.         )
  104.      (vla-regen acDoc acActiveViewport)
  105.      )
  106.    (Alert "All Layers On/Active")
  107.    )
  108. (*error* nil)
  109. (princ)
  110. )
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 18:34:21 | 显示全部楼层
问题是,aharms33想打开之前绘制的对象并将其关闭,好主意Jonathonn3891,但你仍然不知道我在哪个层绘制了“零件1234”。
 
唯一的方法是附加扩展数据并使用它和记录项找到对象扩展数据“Part 12345”并检查图层?可能是区域。
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-13 03:35 , Processed in 0.639900 second(s), 62 queries .

© 2020-2025 乐筑天下

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