aharms33 发表于 2022-7-5 17:27:02

选择某个冻结或关闭l

我想创建一个lisp,当我有一个冻结或解冻的层时,当我不确切地知道我想要的对象在哪一层时,我想在其中。
 
为了明确何时需要打开特定对象,我先放置并放置,然后xlist该对象,然后截图对话框,然后通过图层管理器解冻/或放置我想要的图层。
 
我想知道是否有人可以帮我写一个lisp例程,这将帮助我节省一些时间在这个过程中。
 
谢谢

BIGAL 发表于 2022-7-5 17:52:52

-LA ON*T*
拾取对象查看其所在的层
U U U U
-洛杉矶

broncos15 发表于 2022-7-5 18:10:13

这个例程非常有用:http://cadtips.cadalyst.com/layer-properties/unhide-layers.

jonathann3891 发表于 2022-7-5 18:23:23

该lisp显示一个DCL,显示哪些层处于关闭/冻结/锁定状态
 
; Turn ON, Thaw ar Unlock layers
; Stefan M. - 04.06.2013
; Edited by Jonathan Norton

(defun C:LCON ( / *error* acDoc filen filew id l layers r c l_frz l_off l_lck selected_layers prop val)
(vl-load-com)
(setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-startundomark acDoc)

(defun *error* (m)
   (and
   m
   (not (wcmatch (strcase m) "*CANCEL*,*QUIT*"))
   (princ (strcat "\nError: " m))
   )
   (vla-endundomark acDoc)
   )

(defun prompt_list ()
   (start_list "a_list")
   (mapcar
   'add_list
   (setq l (cond
               ((= "1" *tog1*) l_off)
               ((= "1" *tog2*) l_frz)
               ((= "1" *tog3*) l_lck)
               )
         )
   )
   (end_list)
   )

(vlax-for la (setq layers (vla-get-layers acDoc))
   (if (eq (vla-get-LayerOn la) :vlax-false)
   (setq l_off (cons (vla-get-Name la) l_off))
   )
   (if (eq (vla-get-Freeze la) :vlax-true)
   (setq l_frz (cons (vla-get-Name la) l_frz))
   )
   (if (eq (vla-get-Lock la) :vlax-true)
   (setq l_lck (cons (vla-get-Name la) l_lck))
   )
   )
(setq l_off (acad_strlsort l_off)
       l_frz (acad_strlsort l_frz)
       l_lck (acad_strlsort l_lck)
       )

(if (or l_off l_frz l_lck)
   (progn
   (setq filew (open (setq filen (strcat (getvar 'dwgprefix) "temp_layer_dialog.dcl")) "w"))
   (write-line
       "layer_on_dialog : dialog {
      label = \"Layer Control\";
      : column {
      : list_box { label = \"Select Layer:\"; key = \"a_list\"; width = 40; height = 15; multiple_select = true; allow_accept = true;}
      : radio_column {
      : radio_button { label = \"Off Layers\";    key = \"tog1\"; }
      : radio_button { label = \"Frozen Layers\"; key = \"tog2\"; }
      : radio_button { label = \"Locked Layers\"; key = \"tog3\"; }}
      ok_cancel;}}" filew)
   (close filew)
   (if
       (>= (setq id (load_dialog filen)) 0)
      (if
          (new_dialog "layer_on_dialog" id)
         (progn
             (or *tog1* (setq *tog1* "1"))
             (or *tog2* (setq *tog2* "0"))
             (or *tog3* (setq *tog3* "0"))
             (prompt_list)
             (action_tile "a_list" "(setq selected_layers $value)")
             (action_tile "tog1"   "(setq *tog1* \"1\" *tog2* \"0\" *tog3* \"0\" selected_layers nil) (prompt_list)")
             (action_tile "tog2"   "(setq *tog1* \"0\" *tog2* \"1\" *tog3* \"0\" selected_layers nil) (prompt_list)")
             (action_tile "tog3"   "(setq *tog1* \"0\" *tog2* \"0\" *tog3* \"1\" selected_layers nil) (prompt_list)")
             (set_tile "tog1" *tog1*)
             (set_tile "tog2" *tog2*)
             (set_tile "tog3" *tog3*)
             (mode_tile "tog1" (if l_off 0 1))
             (mode_tile "tog2" (if l_frz 0 1))
             (mode_tile "tog3" (if l_lck 0 1))
             (setq r (start_dialog))
             (unload_dialog id)
             )
         (princ "\nWrong dialog definition")
         )
      (princ "\nDCL file not found")
      )
   (if (findfile filen) (vl-file-delete filen))
   (if
       (and (= r 1) selected_layers)
      (progn
          (setq prop (cond
                     ((= "1" *tog1*) 'LayerON)
                     ((= "1" *tog2*) 'Freeze)
                     ((= "1" *tog3*) 'Lock)
                     )
                val(cond
                     ((= "1" *tog1*) -1)
                     ((= "1" *tog2*) 0)
                     ((= "1" *tog3*) 0)
                     )
                )
          (foreach x (read (strcat "(" selected_layers ")"))
            (vlax-put (vla-item layers (nth x l)) prop val)
            )
          )
      )
   (vla-regen acDoc acActiveViewport)
   )
   (Alert "All Layers On/Active")
   )
(*error* nil)
(princ)
)

BIGAL 发表于 2022-7-5 18:34:21

问题是,aharms33想打开之前绘制的对象并将其关闭,好主意Jonathonn3891,但你仍然不知道我在哪个层绘制了“零件1234”。
 
唯一的方法是附加扩展数据并使用它和记录项找到对象扩展数据“Part 12345”并检查图层?可能是区域。
页: [1]
查看完整版本: 选择某个冻结或关闭l