nopasaran Posted January 27, 2010 Share Posted January 27, 2010 Hello! I am looking for a lisp, that could help me with creating layout tabs. First of all I explain what situation I have. I have several similar drawings in model tab that I want to export to layouts (every drawing has it's own layout). Drawings differ only in length, so layouts have to have different length (in plot size) and height is constant. What I would like to do is have a lisp that colud create layout tabs using different plot size (it would be great if I could choose one) for every tab. Please feel free to contact me here or directly with any questions or comments. Any help or guidance will be appreciated. Thanks in advance. PS. English isn't my native language so I'm sorry for mistakes. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 27, 2010 Share Posted January 27, 2010 You can create a new layout using the vla-add method: (defun NewLay (lay) (vl-load-com) (setq *adoc* (cond (*adoc*) ((vla-get-ActiveDocument (vlax-get-acad-object))))) (if (vl-catch-all-error-p (setq lay (vl-catch-all-apply (function vla-add) (list (vla-get-layouts *adoc*) lay)))) (vl-catch-all-error-message lay) lay)) PS> Welcome to CADTutor Quote Link to comment Share on other sites More sharing options...
mdbdesign Posted January 27, 2010 Share Posted January 27, 2010 ...or use this... http://www.cadtutor.net/forum/showthread.php?t=42431 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 27, 2010 Share Posted January 27, 2010 Thanks Marek Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 27, 2010 Share Posted January 27, 2010 This will deep clone a selection of objects to a new Layout: ;; lay = New Layout Name (Will be Created if non-existent) (defun CopytoLayout (lay / ss NewLay ObjLst) (vl-load-com) ; Lee Mac ~ 27.01.10 (setq *acad* (cond (*acad*) ((vlax-get-acad-object))) *adoc* (cond (*adoc*) ((vla-get-ActiveDocument *acad*)))) (cond ( (not (snvalid lay))) ( (ssget) (vlax-for obj (setq ss (vla-get-ActiveSelectionSet *adoc*)) (setq ObjLst (cons Obj ObjLst))) (vla-delete ss) (if (vl-catch-all-error-p (setq NewLay (vl-catch-all-apply (function vla-item) (list (vla-get-Layouts *adoc*) lay)))) (setq NewLay (vla-Add (vla-get-Layouts *adoc*) lay))) (vla-CopyObjects *adoc* (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbObject (cons 0 (1- (length ObjLst)))) (reverse ObjLst))) (vla-get-Block NewLay))))) 1 Quote Link to comment Share on other sites More sharing options...
nopasaran Posted January 27, 2010 Author Share Posted January 27, 2010 Thanks for your fast reply. to: LeeMac I haven't managed to try your solution, because I'm not very good at lisp yet so i will try to look it later but Thank you for your help! to: mdbdesign Tried this programm...It is very good and I find it very useful in further work...but at the moment I am looking for a solution that could enable me to choose the plot size of each specific tab in one window. For example in this programm that you offered could be a control (for example Modify) that allows to change plot size like you do it in Page setup manager. I am not sure if it is possible...but if it is I would be very grateful if you could recomend me any solution. Thanks a lot for your reply. PS. I am a newguy in lisp programming and I have very few knowledge so could you add some explonation how it shoud be used to work correctly. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 27, 2010 Share Posted January 27, 2010 Hi, You can set the Plot size for a new layout, but you would need to use DCL (or a derivative of such), to be able to select an option from a window. To use the code that I posted above, you could run it in the Visual LISP Editor in AutoCAD (VLIDE at command-line), or you could just run it from the command-line directly. It takes one argument, the layout name, hence: (CopytoLayout "New Layout) Lee 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.