gohanrice 发表于 2022-7-6 10:11:46

将“Ctrl+Page Up/Down”更改为

我知道Ctrl+Page Up和Ctrl+Page Down在布局选项卡中循环,但有没有办法将按键更改为其他方式?我总是一只手放在鼠标上,一只手放在键盘上,所以我希望将其中一只手改成Shift-Tab(因为Ctrl-Tab在打开的应用程序窗口中循环,Alt-Tab在给定应用程序中的窗口中循环)。

Commandobill 发表于 2022-7-6 10:18:04

你可以使用这个代码(不是我写的),然后在你的cui中设置“nextlayout”和“previouslayout”作为键盘快捷键命令。。。。
 
 
;; Created by: Lee Ambrosius
;; Date Written: 12/11/03

;; Includes four commands which can be redefined.
;; NextLayout - Navigates to the right and will wrap around
;;            to the left side once the end is reached

;; PreviousLayout - Navigates to the left and will wrap around
;;                  to the right side once the end is reached

;; FirstLayout - Navigates to the left most tab

;; LstLayout - Navigates to the right most tab

;; Gets a listing of all Layouts in the drawing
(defun Get-Layout-List( / acadObj acDoc acDocLayouts layoutCount loopCount
                         layoutListLocal layoutListSorted layoutName layoutPosition
                         loopCountSorted)
(vl-load-com)
(setq acadObj (vlax-get-acad-object))
(setq acDoc (vlax-get-property acadObj 'ActiveDocument))
(setq acDocLayouts (vlax-get-property acDoc 'Layouts))

(setq layoutCount (vlax-get-property acDocLayouts 'Count)
       loopCount 0
       layoutListLocal (list)
       layoutListSorted (list)
)

(while (> layoutCount loopCount)
   (setq layoutName (vlax-get-property (vlax-invoke-method acDocLayouts 'Item loopCount) 'Name))
   (setq layoutPosition (vlax-get-property (vlax-invoke-method acDocLayouts 'Item loopCount) 'TabOrder))

   (setq layoutListLocal (append layoutListLocal (list (list layoutPosition layoutName))))
   (setq loopCount (1+ loopCount))
)

;; Resort listing by TabOrder
(setq layoutCountSorted 0)
(while (> (length layoutListLocal) (length layoutListSorted))
   (setq loopCountSorted 0)
   (foreach layoutLocation layoutListLocal
   (progn
       (if (and (= (car layoutLocation) (length layoutListSorted)) (= (car layoutLocation) layoutCountSorted))
         (progn
         (setq layoutListSorted (append layoutListSorted (cdr (nth loopCountSorted layoutListLocal))))
       (setq layoutCountSorted (1+ layoutCountSorted))
         )
       )
       (setq loopCountSorted (1+ loopCountSorted))
   )
   )
)
layoutListSorted
)

(defun c:nextlayout ( / layout-mem-list layout-list layoutLocation)
(setq layoutLocation 0)
(setq layout-list (get-layout-list))
(setq layout-mem-list (member (getvar "CTAB") layout-list))
(if layout-mem-list
   (progn
   (setq layoutLocation (- (length layout-list) (length layout-mem-list)))
   )
   (setq layoutLocation (1+ layoutLocation))
)
(if (>= (1+ layoutLocation) (length layout-list))
   (setvar "CTAB" (nth 0 layout-list))
   (setvar "CTAB" (nth (1+ layoutLocation) layout-list))
)
)

(defun c:previouslayout ( / layout-mem-list layout-list layoutLocation)
(setq layoutLocation 0)
(setq layout-list (get-layout-list))
(setq layout-mem-list (member (getvar "CTAB") layout-list))
(if layout-mem-list
   (progn
   (setq layoutLocation (- (length layout-list) (length layout-mem-list)))
   )
   (setq layoutLocation (1- layoutLocation))
)
(if (= layoutLocation 0)
   (setvar "CTAB" (nth (1- (length layout-list)) layout-list))
   (setvar "CTAB" (nth (1- layoutLocation) layout-list))
)
)

(defun c:FirstLayout ( / layout-list layoutLocation)
(setvar "CTAB" (nth 0 (get-layout-list)))
)

(defun c:LastLayout ( / layout-list)
(setq layout-list (get-layout-list))

(setvar "CTAB" (nth (- (length layout-list) 1) layout-list))
)

(princ)

gohanrice 发表于 2022-7-6 10:24:31

谢谢CommandoBill!

Ashishs 发表于 2022-7-6 10:29:10

 
 
 
命令“FirstLayout”实际上并不适用于第一个布局。
它需要您对空间进行建模。
 
有可能解决这个问题吗?
Tnx提前寻求帮助。

Lee Mac 发表于 2022-7-6 10:32:46

我认为它可以缩短一些。。。
 

;; Layout Switcher, by Lee McDonnell ~ 06.08.2009

(defun lays (/ lst)
(vl-load-com)
(vlax-for lay (vla-get-Layouts
               (vla-get-ActiveDocument
                   (vlax-get-acad-object)))
   (setq lst (cons lay lst)))
(mapcar 'vla-get-Name
   (vl-sort lst
   (function
       (lambda (a b)
         (< (vla-get-TabOrder a)
            (vla-get-TabOrder b)))))))

(defun c:nlay (/ pos lst)
(setq pos (1+ (vl-position (getvar "CTAB")
               (setq lst (lays)))))
(setvar "CTAB"
   (nth
   (cond ((eq (length lst) pos) 0) (pos)) lst))
(princ))

(defun c:play (/ pos lst)
(setq pos (1- (vl-position (getvar "CTAB")
               (setq lst (lays)))))
(setvar "CTAB"
   (nth
   (cond ((minusp pos) (1- (length lst))) (pos)) lst))
(princ))

(defun c:flay ()
(setvar "CTAB" (nth 1 (lays)))
(princ))

(defun c:llay ()
(setvar "CTAB" (last (lays)))
(princ))
         

2001jonathon 发表于 2022-7-6 10:39:14

 
太好了,李,再次感谢你的代码。

Ashishs 发表于 2022-7-6 10:44:04

 
没问题伙计

Lee Mac 发表于 2022-7-6 10:51:16

有人知道如何做一个LT友好的版本哈哈?

jamesfear 发表于 2022-7-6 10:54:18

试试这个,lisp应该适合你。
 
http://www.cadtutor.net/forum/showthread.php?19027-如何加载lisp程序

2001jonathon 发表于 2022-7-6 10:58:43

我不知道,但应该还能用。
页: [1] 2
查看完整版本: 将“Ctrl+Page Up/Down”更改为