TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: rjohnson42 on August 06, 2014, 07:12:23 PM

Title: List of layouts from user-selected file
Post by: rjohnson42 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!
Title: Re: List of layouts from user-selected file
Post by: CAB on August 06, 2014, 07:47:29 PM
Dive into this routine  8)
http://www.lee-mac.com/steal.html
Title: Re: List of layouts from user-selected file
Post by: rjohnson42 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!

Title: Re: List of layouts from user-selected file
Post by: tombu 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. 
Title: Re: List of layouts from user-selected file
Post by: CAB 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]
Title: Re: List of layouts from user-selected file
Post by: CAB on August 07, 2014, 10:49:30 AM
Tom,
FYI, latest version is 
"StealV1-8.lsp"
Title: Re: List of layouts from user-selected file
Post by: Lee Mac 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-)
Title: Re: List of layouts from user-selected file
Post by: rjohnson42 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).
Title: Re: List of layouts from user-selected file
Post by: CAB on August 07, 2014, 07:01:21 PM
Take a look at this lisp 8)
 http://www.lee-mac.com/tabsort.html
Title: Re: List of layouts from user-selected file
Post by: rjohnson42 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-)
Title: Re: List of layouts from user-selected file
Post by: CAB on August 08, 2014, 09:41:30 AM
There are lots of great routines here, keep asking.  8)