BlackBox 发表于 2022-7-6 11:00:19

 
 
 
... 那些该死的明尼苏达-威斯康星州-加拿大程序员,总是让事情变得如此困难。(只是开玩笑,不要给我发仇恨邮件)

Lee Mac 发表于 2022-7-6 11:02:27

要允许双击操作:
 

(defun c:ll ( / *error* _WriteDialogDefinition _GetSavePath DCLPath DCLFile DCLFlag DCLHandle lst ptr )
(vl-load-com)
;; © Lee Mac 2010

(defun *error* ( msg )
   
   (and DCLHandle (unload_dialog DCLHandle))
   (and openfile(close openfile))
   
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ)
)

(defun _WriteDialogDefinition ( filename / openfile )
   (cond
   ( (findfile filename) )
   ( (setq openfile (open filename "w"))

       (foreach l
          '("ll : dialog { label = \"Select Layout to Make Current\"; spacer;"
            ": list_box { key = \"lay\"; allow_accept = true; alignment = centered; } ok_cancel; }")
         (write-line l openfile)
       )

       (setq openfile (close openfile)) T
   )
   )
)

(defun _GetSavePath ( / tmp )
   (cond
   ( (setq tmp (getvar 'ROAMABLEROOTPREFIX))

       (or (eq "\\" (substr tmp (strlen tmp)))
         (setq tmp (strcat tmp "\\"))
       )
       (strcat tmp "Support")
   )
   ( (setq tmp (findfile "ACAD.pat"))

       (setq tmp (vl-filename-directory tmp))

       (and (eq "\\" (substr tmp (strlen tmp)))
            (setq tmp (substr tmp (1- (strlen tmp))))
       )      
       tmp
   )
   )
)

(cond
   ( (not (vl-file-directory-p (setq DCLPath (_GetSavePath))))

   (princ "\n** Cannot Locate Save Path **")
   )   
   ( (not (_WriteDialogDefinition (setq DCLFile (strcat DCLPath "\\LMAC_SelectLayout.dcl"))))

   (princ "\n** Cannot Write Dialog Definition **")
   )
   ( (<= (setq DCLHandle (load_dialog DCLFile)) 0)

   (princ "\n** Cannot Find Dialog File **")
   )
   ( (not (new_dialog "ll" DCLHandle))

   (princ "\n** Cannot Load Layout Select Dialog **")
   )
   (t
   (start_list "lay")
   (mapcar 'add_list (setq lst (cons "Model" (layoutlist))))
   (end_list)

   (set_tile "lay" (setq ptr (itoa (vl-position (getvar 'CTAB) lst))))
   (action_tile "lay" "(setq ptr $value)")

   (setq DCLFlag (start_dialog) DCLHandle (unload_dialog DCLHandle))

   (if (= 1 DCLFlag)
       (setvar 'CTAB (nth (atoi ptr) lst))
       (princ "\n*Cancel*")
   )
   )
)

(princ)
)

lutcus 发表于 2022-7-6 11:06:14

我很困惑,为什么不从屏幕底部显示的位置选择所需的布局选项卡呢?
 

 
为了好玩和DosLib用户。。。
 
LAYOUTS : dialog {
       label = "Select Layout to make Current";
       : column {
         : row {
         : boxed_column {
             : list_box {
               key = "lays";
               label = "Layouts:";
               allow_accept = true;
               multiple_select = false;
               width = 40;
             }
         }   
         }
         : row {
         : boxed_row {
             : button {
               key = "accept";
               label = "Okay";
               is_default = true;
             }
             : button {
               key = "cancel";
               label = "Cancel";
               is_default = false;
               is_cancel = true;
             }
         }
         }
       }   
}

lutcus 发表于 2022-7-6 11:10:16

 
嗨,艾伦,
 
如果你是那种在绘图中有很多图纸空间选项卡并且懒得滚动的人,那么它可以让你更容易地找到一个特定的选项卡。

Lee Mac 发表于 2022-7-6 11:11:19

向右打开;这是有道理的。好吧,那么排除以上所有内容:为了好玩和DosLib用户。。。然后从那里读下去。

alanjt 发表于 2022-7-6 11:15:31

alanjt 发表于 2022-7-6 11:18:54

I'm confused, why not just select the desired layout tab from where they are displayed at the bottom of the screen?
 

 
For fun and the DosLib users...
 

(defun c:Test (/ lst tab) (if (setq tab (dos_popupmenu (setq lst (cons "Model" (layoutlist)))))   (setvar 'ctab (nth tab lst)) ) (princ))

The Buzzard 发表于 2022-7-6 11:21:03

 
Hey Alan,
 
Its suppose to make it easier to find a particular tab if you are the type to have alot of paper space tabs in your drawing and are too lazy to scroll through them.

alanjt 发表于 2022-7-6 11:24:55

Right on; that makes sense.Well, then exclude everything above: For fun and the DosLib users... and just read from there.
页: 1 [2]
查看完整版本: 布局lisp(编辑帮助)