Manuel_Kunde Posted August 20, 2021 Share Posted August 20, 2021 (edited) Hi all, below is a snippet of a lisp that writes a custom dsd for the current layout (ctab). So far it works, and creates me a PDF of the current layout. My problem is that I want to run this section for each layout that contains the layout name *Plan*. Does anyone have any idea on how I can incorporate this repetition? (write-line (strcat "[DWF6Sheet:" (getvar "DWGNAME") "-" (getvar "ctab") "]") file) (write-line (strcat "DWG=" (getvar "DWGPREFIX") (getvar "DWGNAME") ".dwg") file) (write-line (strcat "Layout=" (getvar "ctab")) file) (write-line (strcat "Setup=" ) file) (write-line (strcat "OriginalSheetPath=" (getvar "DWGPREFIX") (getvar "DWGNAME") ".dwg") file) (write-line (strcat "Has Plot Port=0") file) (write-line (strcat "Has3DDWF=0") file) Edited August 20, 2021 by Manuel_Kunde Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 20, 2021 Share Posted August 20, 2021 Here's an example: (setq dwp (getvar 'dwgprefix) dwg (getvar 'dwgname) ) (foreach lyt (layoutlist) (if (wcmatch (strcase lyt t) "*plan*") (write-line (strcat "[DWF6Sheet:" dwg "-" lyt "]" "\nDWG=" dwp dwg ".dwg" "\nLayout=" lyt "\nSetup=" "\nOriginalSheetPath=" dwp dwg ".dwg" "\nHas Plot Port=0" "\nHas3DDWF=0" ) file ) ) ) 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 21, 2021 Share Posted August 21, 2021 Thanks Lee, behind the scenes this was provided to Manuel. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/publish-dsd-file/td-p/1350729 Needs to merge the 2. (defun c:makedsd (/ file layouts_to_plot NumTabs OldFda ) (setq OldFda (getvar "FILEDIA")) (setvar "FILEDIA" 0) ;;;(setq layouts_to_plot (dos_multilist "Create Multi-sheet DWF file" "Select drawings" (layoutlist))) (setq NumTabs (length layouts_to_plot));Number of tabs selected (setq pathtxt (strcat (getvar "dwgprefix") "newfile.dsd")) (setq file (open (strcat (getvar "dwgprefix") "newfile.dsd") "w")) (write-line "[DWF6Version]" file) (write-line "Ver=1" file) (write-line "[DWF6MinorVersion]" file) (write-line "MinorVer=1" file) (write-line (strcat "[DWF6Sheet:"(substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))"-" (getvar "ctab") "]")file) (write-line (strcat "DWG=" (getvar "dwgprefix")(substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4)) ".dwg")file) (write-line (strcat "Layout=" (getvar "ctab") )file) (write-line (strcat "Setup=" )file) (write-line (strcat "OriginalSheetPath=" (strcat(getvar "dwgprefix")(substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))".dwg") )file) (write-line (strcat "Has Plot Port=1" )file) (write-line (strcat "[Target]") file) (write-line (strcat "Type=1" ) file) (write-line (strcat "DWF=" (strcat(getvar "dwgprefix")(substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))".dwf") )file) (write-line (strcat "OUT="(strcat(getvar "dwgprefix") )) file) (write-line (strcat "PWD=" )file) (close file) (command "_.delay" 2000) (command "-Publish" pathtxt ) (setvar "FILEDIA" OldFda) (startapp "explorer /e," (getvar "dwgprefix")) (princ) );defun 1 Quote Link to comment Share on other sites More sharing options...
Manuel_Kunde Posted August 30, 2021 Author Share Posted August 30, 2021 On 8/21/2021 at 4:55 AM, BIGAL said: Thanks Lee, behind the scenes this was provided to Manuel. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/publish-dsd-file/td-p/1350729 Needs to merge the 2. So far the Lisp works fine. However, I noticed that the layouts are not written to the DSD file in series, left to right, but randomly. Is it possible to set the order somehow? Quote Link to comment Share on other sites More sharing options...
confutatis Posted August 30, 2021 Share Posted August 30, 2021 The layout list is not randomly, but in alphabetical order. What do you need, to want the layouts from left to right? Quote Link to comment Share on other sites More sharing options...
Manuel_Kunde Posted August 30, 2021 Author Share Posted August 30, 2021 9 minutes ago, confutatis said: The layout list is not randomly, but in alphabetical order. What do you need, to want the layouts from left to right? Yes that is the problem with the alphabetical order. I need the order in the DSD as I have the layout tabs arranged, from left to right. In this case they are not alphabetical. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 30, 2021 Share Posted August 30, 2021 You can use the ActiveX taborder property to sort the layouts by the order in which they appear in the drawing, e.g.: ( (lambda ( / dwg dwp idx lst ) (setq dwp (getvar 'dwgprefix) dwg (getvar 'dwgname) ) (vlax-for lyt (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) (if (wcmatch (strcase (vla-get-name lyt) t) "*plan*") (setq lst (cons (vla-get-name lyt) lst) idx (cons (vla-get-taborder lyt) idx) ) ) ) (foreach n (vl-sort-i idx '<) (setq lyt (nth n lst)) (write-line (strcat "[DWF6Sheet:" dwg "-" lyt "]" "\nDWG=" dwp dwg ".dwg" "\nLayout=" lyt "\nSetup=" "\nOriginalSheetPath=" dwp dwg ".dwg" "\nHas Plot Port=0" "\nHas3DDWF=0" ) file ) ) ) ) 1 1 Quote Link to comment Share on other sites More sharing options...
Manuel_Kunde Posted August 31, 2021 Author Share Posted August 31, 2021 15 hours ago, Lee Mac said: You can use the ActiveX taborder property to sort the layouts by the order in which they appear in the drawing, e.g.: I wouldn't have figured it out myself. Thanks a lot! Quote Link to comment Share on other sites More sharing options...
confutatis Posted August 31, 2021 Share Posted August 31, 2021 ...taborder...here's another feature I didn't know about. You think you know enough and then you find out you're an ignorant. It's really true: the more you know, the less you know.... Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 1, 2021 Share Posted September 1, 2021 Plot based on taborder, ignores layout name. enter 99 auto fills end layout. Cadtutor downloads Plotpdfa3.lsp Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.