I was curious to know if anyone knows of a LISP routine that can create multiple paper space layout tabs and can name them incrementally. Your help is greatly appreciated.
|
|
|
I was curious to know if anyone knows of a LISP routine that can create multiple paper space layout tabs and can name them incrementally. Your help is greatly appreciated.
Welcome to AUGI!
This should get you started (case-sensitive):
Code:(vl-load-com) (defun c:LAYOUT+ (/ *error* prefix i n acDoc oLayouts layoutName) (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 (and (setq prefix (getstring "\nEnter layout name prefix: ")) (setq i (getint "\nEnter starting index number: ")) (setq n (getint "\nEnter ending index number: ")) (< i n) (princ "\nWorking, please wait... ") (princ) ) (progn (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) ) (setq oLayouts (vla-get-layouts acDoc)) (setq i (1- i)) (while (< i n) (setq layoutName (strcat prefix (itoa (setq i (1+ i))))) (if (not (vl-position layoutName (layoutlist))) (progn (princ (strcat "\nCreating layout \"" layoutName "\"... ")) (princ) (vla-add oLayouts layoutName) (princ "Done. ") ) (progn (princ (strcat "\nLayout \"" layoutName "\" already exists. ") ) (princ) ) ) ) ) (cond (n (prompt "\n** Invalid indexes entered ** ")) (i (prompt "\n** Must enter an ending index ** ")) (prefix (prompt "\n** Must enter a starting index ** ")) ) ) (*error* nil) )
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
Also, I've moved this thread to the LISP forum.
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
The Lisp worked perfect. However I should have been more specific as far as content. I have a template set up and I wanted to copy the content on let's just say tab2 10 more times and name them incrementally. This would have worked perfect if it could have copied the content included in the layout from tab2 to be specific.
@BB
If the user pressed ENTER with the function GETSTRING it would return an empty string "" which means a value to AND function
... And then?
augi.layout+.png
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
Last edited by Tharwat; 2013-11-27 at 11:19 AM. Reason: one typo corrected
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000