Author Topic: List of layouts from user-selected file  (Read 3004 times)

0 Members and 1 Guest are viewing this topic.

rjohnson42

  • Guest
List of layouts from user-selected file
« on: August 06, 2014, 07:12:23 PM »
Hello All,

I'm currently writing a routine that allows the user to select a window, a layout template, and then generates a new sheet with a viewport scaled to fit the window previously defined by the user. One of the issues I'm running into is allowing the user to select a layout from the template file (should it contain more than one layout). Here's a small snippet:

Code: [Select]
(and (setq filename (getfiled "\n Select template file:" "" "dwg;dwt" 0))
     (command "layout" "template" filename layname)
     )

"layname" would be the layout the user selects from a list of available layouts. I've seen lists made using dialog boxes as well as "layoutlist" (although I believe that "layoutlist" only works for the current drawing), but not for a separate file.

I've used up all of my google-fu for the day and am in need of assistance for the sake of my mental stability. Any help is much appreciated!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: List of layouts from user-selected file
« Reply #1 on: August 06, 2014, 07:47:29 PM »
Dive into this routine  8)
http://www.lee-mac.com/steal.html
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

rjohnson42

  • Guest
Re: List of layouts from user-selected file
« Reply #2 on: August 07, 2014, 10:00:47 AM »
Dive into this routine  8)
http://www.lee-mac.com/steal.html

This routine is awesome! I commented out some of the functions so that the user is restricted to importing layouts only for my particular routine, but other than that it is perfect!


tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Re: List of layouts from user-selected file
« Reply #3 on: August 07, 2014, 10:18:21 AM »
This routine is awesome! I commented out some of the functions so that the user is restricted to importing layouts only for my particular routine, but other than that it is perfect!
I've added a drop-down in my CUI called Layout from Template with macros like:
Code - Auto/Visual Lisp: [Select]
  1.  ^C^C^P(or C:Steal (load "StealV1-6.lsp"))(Steal (strcat (vl-filename-directory (getenv "QnewTemplate")) (chr 92) "Templates.dwt") '(("Layouts" "8½×11")))(if (= "1" (getenv "ShowTabs"))(progn(setenv "ShowTabs" "0")(setenv "ShowTabs" "1")))
  2.  
I just pick the layout I need from the list.  Unlike Design Center it always comes in scaled correctly.  Of course I use it to "Steal" other things you can't get with Design Center as well.  Lee's site is the first place I look for routines. 
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: List of layouts from user-selected file
« Reply #4 on: August 07, 2014, 10:48:21 AM »
Lee does quality work & is a frequent flyer here at the Swamp.
[Shameless plug]
Please support the effort of contributors by donating to TheSwamp or to Lee's site as every little bit helps keep the lights on.  :)

Some of these routines literally save hours of drafting time.
[/Shameless plug]
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: List of layouts from user-selected file
« Reply #5 on: August 07, 2014, 10:49:30 AM »
Tom,
FYI, latest version is 
"StealV1-8.lsp"
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: List of layouts from user-selected file
« Reply #6 on: August 07, 2014, 01:45:38 PM »
Dive into this routine  8)
http://www.lee-mac.com/steal.html
This routine is awesome! I commented out some of the functions so that the user is restricted to importing layouts only for my particular routine, but other than that it is perfect!
I've added a drop-down in my CUI called Layout from Template with macros like:
Code - Auto/Visual Lisp: [Select]
  1.  ^C^C^P(or C:Steal (load "StealV1-6.lsp"))(Steal (strcat (vl-filename-directory (getenv "QnewTemplate")) (chr 92) "Templates.dwt") '(("Layouts" "8½×11")))(if (= "1" (getenv "ShowTabs"))(progn(setenv "ShowTabs" "0")(setenv "ShowTabs" "1")))
  2.  
I just pick the layout I need from the list.  Unlike Design Center it always comes in scaled correctly.  Of course I use it to "Steal" other things you can't get with Design Center as well.  Lee's site is the first place I look for routines. 

Thank you both! - I'm delighted to hear that you find the program so useful!

Lee does quality work & is a frequent flyer here at the Swamp.
[Shameless plug]
Please support the effort of contributors by donating to TheSwamp or to Lee's site as every little bit helps keep the lights on.  :)

Some of these routines literally save hours of drafting time.
[/Shameless plug]

That's very kind of you to say Alan, many thanks indeed.
Of course, I learnt much of what I know from you  8-)

rjohnson42

  • Guest
Re: List of layouts from user-selected file
« Reply #7 on: August 07, 2014, 05:21:09 PM »
Would anyone be able to help me figure out how to specify the position of the imported layout? Currently, it's inserting it after the first layout, but I'd like to be able to insert it as the last layout (and it would be even better if the user could specify a position).

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: List of layouts from user-selected file
« Reply #8 on: August 07, 2014, 07:01:21 PM »
Take a look at this lisp 8)
 http://www.lee-mac.com/tabsort.html
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

rjohnson42

  • Guest
Re: List of layouts from user-selected file
« Reply #9 on: August 08, 2014, 08:34:07 AM »
Take a look at this lisp 8)
 http://www.lee-mac.com/tabsort.html

I guess I'll have to start donating  8-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: List of layouts from user-selected file
« Reply #10 on: August 08, 2014, 09:41:30 AM »
There are lots of great routines here, keep asking.  8)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.