乐筑天下

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

[编程交流] Re-ordering layout tabs?

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:18:50 | 显示全部楼层
This might be useful to you:

http://web2.airmail.net/terrycad/AutoLISP-Code.htm
 
Top one ^^
回复

使用道具 举报

CAB

29

主题

781

帖子

430

银币

中流砥柱

Rank: 25

铜币
526
发表于 2022-7-6 15:21:41 | 显示全部楼层
Another:
  1. ;; 07/14/2005  CAB(defun C:TabSort (/ cnt doc lay) (vl-load-com) (setq cnt 1       doc (vla-get-activedocument (vlax-get-acad-object))       ) (foreach lay (acad_strlsort (vl-remove "Model" (layoutlist)))   (vla-put-taborder (vla-item (vla-get-layouts doc) lay) cnt)   (setq cnt (1+ cnt)) ) (princ))
回复

使用道具 举报

CAB

29

主题

781

帖子

430

银币

中流砥柱

Rank: 25

铜币
526
发表于 2022-7-6 15:24:43 | 显示全部楼层
  1. ;; --------------------------------------------------------------------------- ;; Function: tabsort ;; Purpose : sort Tabs by the prefix then the first numbers found ;; AUTHOR  Charles Alan Butler @ TheSwamp.org;; --------------------------------------------------------------------------- ;; Last Update 03/01/2006  CAB(defun C:TabSort (/ cnt doc lay) (vl-load-com) ;; ---------------------------------------------------------------------------  ;; Function: Num_sort  ;; Purpose : sort list of strings by the prefix then the first numbers found  ;; AUTHOR  Charles Alan Butler @ TheSwamp.org ;; Params  : tablst:    list of strings to sort ;; Returns : sorted list ;; ---------------------------------------------------------------------------  (defun Num_Sort (tablst / tab ptr len loop tmp tmp2 sub lst)   (defun vl-sort-it (lst func)     (mapcar '(lambda (x) (nth x lst)) (vl-sort-i lst func))   )   (defun sort2 (tmp2 sub)     (setq tmp2 (append                  (vl-sort-it sub '(lambda (e1 e2) (< (cadr e1) (cadr e2))))                  tmp2                )     )   )   ;;  convert to a list (string) -> (prefix num string)   (foreach tab tablst     (setq ptr  1           len  (strlen tab)           loop t     )     (while loop       (cond         ((wcmatch "0123456789" (strcat "*" (substr tab ptr 1) "*"))          (setq tmp  (cons (list (substr tab 1 (1- ptr))                                 (atof (substr tab ptr))                                 tab                           )                           tmp                     )                loop nil          )         )         ((> (setq ptr (1+ ptr)) len)          ;;  no number in string          (setq tmp  (cons (list tab nil tab) tmp)                loop nil          )         )       )                     ; end cond stmt     )   )   ;;  sort on the prefix   (setq tmp (vl-sort-it tmp '(lambda (e1 e2) (< (car e1) (car e2)))))   ;; Do a number sort on each group of matching prefex   (setq idx (length tmp))   (while (> (setq idx (1- idx)) -1)     (cond       ((not sub)        (setq sub (List (nth idx tmp))              str (car (nth idx tmp))        )       )       ((= (car (nth idx tmp)) str) ; still in the group        (setq sub (cons (nth idx tmp) sub))       )     )                       ; end cond stmt     (if (= idx 0)           ; end of list       (progn         (setq tmp2 (sort2 tmp2 sub))         (if (/= (car (nth idx tmp)) str)           (setq tmp2 (append (list (nth idx tmp)) tmp2))         )         (setq str (car (nth idx tmp)))       )     )     (if (/= (car (nth idx tmp)) str)       ;; next group, so sort previous group       (setq tmp2 (sort2 tmp2 sub)             sub  (list (nth idx tmp))             str  (car (nth idx tmp))       )     )   )                         ; end while   (setq lst (mapcar 'caddr tmp2))   (princ)   lst )                           ; end defun ;;========================================================================== (setq cnt 1       doc (vla-get-activedocument (vlax-get-acad-object)) ) (foreach lay (num_sort (vl-remove "Model" (layoutlist)))   (vla-put-taborder (vla-item (vla-get-layouts doc) lay) cnt)   (setq cnt (1+ cnt)) ) (princ))                           ; end defun(prompt "\nTabSort loaded, enter TabSort to run.")(princ)
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:27:35 | 显示全部楼层
Nice CAB.
 
Just goes to show what they say about coding these things - its all been done before
回复

使用道具 举报

11

主题

35

帖子

28

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
53
发表于 2022-7-6 15:33:00 | 显示全部楼层
I'm having a hard time figuring out how to configure things right.  It says to:
 
"Change the following global lists *PlotterInfo@ and *PlotStyles@ to suit the specifications of each AutoCAD department"
 
Where are those lists?  sorry, I'm a little lost.
回复

使用道具 举报

11

主题

35

帖子

28

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
53
发表于 2022-7-6 15:35:52 | 显示全部楼层
 
 
When I had 2007 I could find that file in the programs folder.  Now I have 2010 and I cannot find it anywhere.  If I do a windows search it does not show up (even including hidden files).  I see "acad2010.lsp" and "acad2010doc.lsp" but the help file says you should not edit the second one for whatever reason:
 
I thought maybe they got rid of the acaddoc.lsp and just want you to change the ACADLSPASDOC setting to load the regular one on start up.  But then it says this in the help file (in addition to mentioning it above): 
So that file must exist still.  how come I can't find it?
回复

使用道具 举报

4

主题

940

帖子

961

银币

初来乍到

Rank: 1

铜币
12
发表于 2022-7-6 15:39:48 | 显示全部楼层
The acaddoc.lsp does not come with the installation of Acad. It's just a text file easily created with Notepad.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:43:10 | 显示全部楼层
Just create an ACADDOC.lsp with Notepad (save it as a .lsp file and put it in your search path file)
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-5 00:35 , Processed in 0.697303 second(s), 66 queries .

© 2020-2025 乐筑天下

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