MiningDave Posted September 15, 2014 Posted September 15, 2014 Hi all, I have about 140 layouts and I've just been asked to add a piece of information (some mtext) to every other layout, any ideas? Any help is appreciated, Dave Quote
RobDraw Posted September 15, 2014 Posted September 15, 2014 Copy and paste is probably the fastest way. You could also use an XREF or a block. If this is something that you will be doing on a regular basis, then you might be able to get someone to write some code for you that will insert something into selected layouts. Quote
rkent Posted September 15, 2014 Posted September 15, 2014 Make that piece of information a .dwg file and xref it into your files. It is likely to change and then you only have to change it once rather than open 140 drawings/layouts. Are you saying you have one file with 140 layouts? Quote
ROBP Posted September 15, 2014 Posted September 15, 2014 Make that piece of information a .dwg file and xref it into your files. It is likely to change and then you only have to change it once rather than open 140 drawings/layouts. Are you saying you have one file with 140 layouts? If drawing layout was done with dwt then updating the dwt should do it would it? Quote
RobDraw Posted September 15, 2014 Posted September 15, 2014 Nope. If the layout was done with an XREF, that would do it, except for the ones you don't want to see. Quote
BIGAL Posted September 16, 2014 Posted September 16, 2014 Looping through layouts is easy this is not tested but should work (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Layouts doc) (setvar "ctab" (vla-get-name lay)) (command "pspace") do your thing here insert block of mtext ? ) Quote
MiningDave Posted September 25, 2014 Author Posted September 25, 2014 Thanks all, I bit the bullet and just copied and pasted with base points. I did try that script but had no joy. And yeah just over 140 layouts in one file. Big Project time. Quote
BlackBox Posted September 25, 2014 Posted September 25, 2014 Thanks all, I bit the bullet and just copied and pasted with base points. I did try that script but had no joy. And yeah just over 140 layouts in one file. Big Project time. I _really_ wish I had seen this earlier... The only thing _slower_ than performing this task manually, is saving and closing the drawing after you perform this task in each layout manually. Short of coding this in either .NET, or ObjectARX APIs (which would be faster), this is about as fast as you can get... No changing the active layout (CTAB), active Viewports are a non-issue, and supports UNDO functionality : (vl-load-com) (defun c:CopyToAllLayouts (/ *error* layouts acDoc objects) (defun *error* (msg) (if acDoc (vla-endundomark acDoc) ) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (if (= 1 (getvar 'cvport)) (progn (prompt "\nSelect object(s) to copy to all Layouts: ") (princ) (if (ssget "_:L") (progn (setq layouts (list "Model" (getvar 'ctab))) (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) ) (vlax-for x (vla-get-activeselectionset acDoc) (setq objects (cons x objects)) ) (vlax-for layout (vla-get-layouts acDoc) (if (not (vl-position (vla-get-name layout) layouts)) (vlax-invoke acDoc 'copyobjects objects (vla-get-block layout) ) ) ) ) ) ) (prompt "\n** Command not available in Model Tab ** ") ) (*error* nil) ) Cheers [Edit] - I'd be very interested to know approximately how long it took you to do manually, as compared to how long this option takes? Quote
BlackBox Posted September 25, 2014 Posted September 25, 2014 [Edit] - I'd be very interested to know approximately how long it took you to do manually, as compared to how long this option takes? I just bench tested this on a drawing with 140 layouts, copying 104 circles (an exploded 8 x 13 array) to each layout, and it only took +/- 3 seconds... _Including_ the time it took me to select the circles to copy: Command: (length (layoutlist)) 140 Command: (bench '(c:foo) '() 1) C:FOO Select object(s) to copy to all Layouts: 104 found Elapsed: 2610 Average: 2610.0000 Cheers Quote
BIGAL Posted September 26, 2014 Posted September 26, 2014 I agree 140 to slow manually. A question Blackbox most of my layout stuff requires the use of 'CTAB using the vlax-invoke can you update a attributed block "Titleblock" with out having to go to that layout and force a display ? Thats the time killer mind you 89 layouts takes about max 1 min to do lots of stuff ? Quote
BlackBox Posted September 26, 2014 Posted September 26, 2014 Certainly you can, however I will say that when it comes to title blocks specifically, I'm a strong advocate for the use of Sheet Set Manager (SSM) Properties populating your title blocks attributes via Fields. My reason is simple - I can modify any sheet set (project), or sheet-specific value of a given title block from SSM without even opening a single sheet in the editor, and print when done. Cheers Quote
BIGAL Posted September 26, 2014 Posted September 26, 2014 Thanks blackbox will look into it more Quote
MiningDave Posted September 26, 2014 Author Posted September 26, 2014 I _really_ wish I had seen this earlier... The only thing _slower_ than performing this task manually, is saving and closing the drawing after you perform this task in each layout manually. Short of coding this in either .NET, or ObjectARX APIs (which would be faster), this is about as fast as you can get... No changing the active layout (CTAB), active Viewports are a non-issue, and supports UNDO functionality : (vl-load-com) (defun c:CopyToAllLayouts (/ *error* layouts acDoc objects) (defun *error* (msg) (if acDoc (vla-endundomark acDoc) ) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (if (= 1 (getvar 'cvport)) (progn (prompt "\nSelect object(s) to copy to all Layouts: ") (princ) (if (ssget "_:L") (progn (setq layouts (list "Model" (getvar 'ctab))) (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) ) (vlax-for x (vla-get-activeselectionset acDoc) (setq objects (cons x objects)) ) (vlax-for layout (vla-get-layouts acDoc) (if (not (vl-position (vla-get-name layout) layouts)) (vlax-invoke acDoc 'copyobjects objects (vla-get-block layout) ) ) ) ) ) ) (prompt "\n** Command not available in Model Tab ** ") ) (*error* nil) ) Cheers [Edit] - I'd be very interested to know approximately how long it took you to do manually, as compared to how long this option takes? It took me a fair old while as I had add individual detail to all the items. It was dimensions of the object on the previous sheet, so I wanted to apply the Mtext 'Shaft Dimensions', or 'Tunnel Dimensions' etc to all the pages and then just add the number on after. Thanks for the help and the code though! Might well use that next time! Quote
BlackBox Posted September 26, 2014 Posted September 26, 2014 Thanks blackbox will look into it more Always happy to help a friend ; if you don't find what you're after in other threads, and\or would simply like to discuss more, let me know. Cheers Quote
BlackBox Posted September 26, 2014 Posted September 26, 2014 Thanks for the help and the code though! Might well use that next time! You're welcome, MiningDave. Quote
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.