GVR Posted May 11, 2011 Share Posted May 11, 2011 Hello, I have made a macro which print a specifically area of different layout-tabs. It works fine. But now i have to use it in other drawings with other layout-tab names and than the macro doesn't work anymore. Now i have to change the macro each time with all the new layout-tab names. Is there a way to use a name/number that always work for layout1, layout2, layout3,...etc. I thought it was "layout1" etc. with or without the ", but that doesn't work. I hope someone has a answer. Already thanks. Quote Link to comment Share on other sites More sharing options...
Ahankhah Posted May 11, 2011 Share Posted May 11, 2011 You can issue (layoutlist) to get a list containing all layout tabs, so then you can use foreach function to set each tab current to do print. (foreach layout (layoutlist) (command "._LAYOUT" "_Set" layout) [color=red] put here your code to print[/color] [color=black])[/color] Quote Link to comment Share on other sites More sharing options...
GVR Posted May 11, 2011 Author Share Posted May 11, 2011 I don't know this kind of code. Is this code part of LISP? In that case i can't use it. I'm using AutoCAD LT. Edit: I tried it but i got this error back: (foreach LISP command is not available. So my question about LISP is now answered i think. Quote Link to comment Share on other sites More sharing options...
Ahankhah Posted May 11, 2011 Share Posted May 11, 2011 I don't know this kind of code. Is this code part of LISP? In that case i can't use it. I'm using AutoCAD LT.Could you insert your macro which works on your PC? Quote Link to comment Share on other sites More sharing options...
GVR Posted May 11, 2011 Author Share Posted May 11, 2011 This is the script that i use: filedia 0 layout 001 _-plot y PublishToWeb JPG.pc3 onderlegger l n w 0,0 2400,1670 1:1 y Print.ctb y y layout A _-plot y PublishToWeb JPG.pc3 onderlegger l n w 0,0 2400,1670 1:1 y Print.ctb y y layout B _-plot y PublishToWeb JPG.pc3 onderlegger l n w 0,0 2400,1670 1:1 y Print.ctb y y layout C _-plot y PublishToWeb JPG.pc3 onderlegger l n w 0,0 2400,1670 1:1 y Print.ctb y y layout 001 filedia 1 In the drawing for this script the layouts are named: 001, A, B, C. The paper-size is named: "onderlegger" Quote Link to comment Share on other sites More sharing options...
Ahankhah Posted May 11, 2011 Share Posted May 11, 2011 By using Ctab system variable, you cad obtain the name of current tab (layout). As I searched in AutoCAD's documntation and help, unfortunately there is no any command or system variable in AutoCAD to say the name of other tabs (layouts). Quote Link to comment Share on other sites More sharing options...
Ahankhah Posted May 11, 2011 Share Posted May 11, 2011 I think you have another problem in addition to not knowing tabs (layouts) name. You alse don't know the count of tabs. Without AutoLISP, You can't find out how many tabs are there in the drawing. Quote Link to comment Share on other sites More sharing options...
GVR Posted May 11, 2011 Author Share Posted May 11, 2011 Ahankhah, Thank you for your help. I'm gonna modify the script so it is printing only the active layout-tab. Then i can print each layout when i work on it, instead of printing them all at once at the end. But i still hope that someone els have a solution. Quote Link to comment Share on other sites More sharing options...
dbroada Posted May 11, 2011 Share Posted May 11, 2011 How are you using this? Do you use it as part of a batch process or just the current drawing? If the former I have no suggestions but if the latter can you just remove the first few lines (start your script with the -plot line) to run on the currently selected layout? edit...... I would have posted this before your identical solution but somebody brought me some work to do. Quote Link to comment Share on other sites More sharing options...
GVR Posted May 11, 2011 Author Share Posted May 11, 2011 @dbroada But still thanks for your idea. It was a little to late but it's the gesture that counts. The new version of the script is already working. Quote Link to comment Share on other sites More sharing options...
Ahankhah Posted May 11, 2011 Share Posted May 11, 2011 Ahankhah, Thank you for your help. You are welcom. i still hope that someone els have a solution. I will let you know any new solution, if I find, without fail. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 13, 2011 Share Posted May 13, 2011 Why not use excell to create a script for you, if you have always the same type of layout name then its only a matter of putting a number in 1 sq and run a macro, a script can be written as 1 line with multi commands rather than 1 after another a bit easier in exell as an example please check not tested 8 becomes filedia 0 layout 001 _-plot y PublishToWeb JPG.pc3 onderlegger l n w 0,0 2400,1670 1:1 y Print.ctb layout 002 _-plot y PublishToWeb JPG.pc3 onderlegger l n w 0,0 2400,1670 1:1 y Print.ctb . . . layout 008 _-plot y PublishToWeb JPG.pc3 onderlegger l n w 0,0 2400,1670 1:1 y Print.ctb maybe simpler just save scripts 1-10 and run the correct one. Quote Link to comment Share on other sites More sharing options...
GVR Posted May 17, 2011 Author Share Posted May 17, 2011 That's just the problem. There is no logical sequences. The layout-name is the name of that part of a building. (wing-a, wing-b, part c-f, basement.........etc) So i keep the script to print just 1 page at this moment. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 18, 2011 Share Posted May 18, 2011 This is way out there ! Got a copy of MSword or excell it has vba in it as its macro language so maybe dump a dxf and read it via excel macro write out layout tab names and create script. Big job but achieveable. Disavantage is that you will end up with a script for every dwg. Its sounding easier just type layout name in excel as created then create script. Much easier only need 1 line in excel repeated rest is easy. Found it excel cell A3 has layout cell B3 has "plot y PublishToWeb JPG.pc3 " D3 cell C3 = "l n w 0,0 2400,1670 1:1 y Print.ctb" so cell E1 = =CONCATENATE(B3," ",A3, C3 ) _-plot y PublishToWeb JPG.pc3 onderlegger l n w 0,0 2400,1670 1:1 y Print.ctb copy and paste E column into notebook save as script ps dont forgot E1="filedia 0" E2 etc at top of script as per first post. Just a comment I think theirs a massive opportunity for excell to write scripts for Acad LT with its inbuilt VBA for repetitive tasks. Just think outside the oblong, every one else has a sq. Quote Link to comment Share on other sites More sharing options...
Bhavik Posted November 6, 2017 Share Posted November 6, 2017 Hello all, I have Auto CAD LT2016 and right now I have to go to each layouts and than give command "zoom, extents". This is very irritating:( when I have too many layouts and file runs very slow. So, can anyone please tell me if you know any macro which automatically goes to every layout and runs "zoom, extents" command:roll:. Quote Link to comment Share on other sites More sharing options...
steven-g Posted November 6, 2017 Share Posted November 6, 2017 Not in LT unless you know the name of each layout, otherwise there is no way to tell LT to go to a layout. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 7, 2017 Share Posted November 7, 2017 steven-g any way to do the Ctrl+Pgdn this will step through layouts We name our layouts pretty simple like D01 D02 etc so could do a excel copy paste given number of layouts using ctab = D01 and so on would it matter if D30 it will just error. ctab D01 Zoom E ctab D02 Zoom E ctab D03 Zoom E Quote Link to comment Share on other sites More sharing options...
steven-g Posted November 7, 2017 Share Posted November 7, 2017 (edited) I have never found a way, Ctrl + PgDn is a shorcut not a command and it's not listed in the CUI which would give a clue as to how it operates, "ctab" or "layout - set" both work but only if you know the layout names, "layout - ?" does return the layout names and could conceivably be sent to a variable and split by diesel which I might try (might). Macro's do have some special control codes which can be useful. EDIT* Nope no way to get the output of the layout tab list into a diesel accesible list (from a macro), it is a nice way to get the list into excel, but if your doing that then there is no need to struggle with a macro, as using an excel script is much easier. Edited November 7, 2017 by steven-g Quote Link to comment Share on other sites More sharing options...
Bhavik Posted November 9, 2017 Share Posted November 9, 2017 Hi Steven, I have fixed layout name for ex :- DC-101, DC-102, DC-103, DC-201 etc. So is it possible with fixed layout name..? 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.