Author Topic: set a default page setup for all drawing in folder  (Read 4998 times)

0 Members and 1 Guest are viewing this topic.

stevedallas

  • Guest
set a default page setup for all drawing in folder
« on: July 29, 2014, 12:38:14 PM »
Frequently I get drawings in a job folder that multiple peaple have been in...fine.
When I go to plot the job as pdf's, some pages are 30", some are 11x17.
I would like to find something that can set each layout tab of each drawing in the folder to the same page setup so that all sheet sizes, settings, etc are all the same.

I saw a feature in trueview that can import a page setup into multiple drawings, but it does not set it as the default.

Basically, it would make publishing easier.

I though about sheetlists, but seem to have trouble getting them to get arranged like I want, even adding layouts to lists.

So, I figured setting each page setup the same and doing a publish would be better.
Perhaps a lisp that I can select the proper folder, then select a page setup, then it would go into each dwg and set it as default.

BlackBox

  • King Gator
  • Posts: 3770
Re: set a default page setup for all drawing in folder
« Reply #1 on: July 29, 2014, 01:36:08 PM »
Firstly, PUBLISH automagically applies a named page setup to multiple drawings from the dialog; simply import your sheets, select all, and set the top sheet's page setup accordingly and they'll all use the same named page setup. This is not persistent; only for the publish process.

That said, if you're still determined to literally import the page setup into each drawing, and then set it active, give this old post a try.

Quote from: BlackBox

vla-SetActivePageSetup

Sets a named page setup active for a given layout by name

(vla-SetActivePageSetup layoutName pageSetupName)



Arguments

layoutName

A string specifying the name of a layout to apply the named page setup.


pageSetupName

A string specifying the page setup to apply to the layout.



Return Values

Nil if either the layoutName, or pageSetupName cannot be found. Otherwise, T if successful.

 

Example

Code - Auto/Visual Lisp: [Select]
  1. (foreach layoutname (layoutlist)
  2.   (vla-SetActivePageSetup layoutname “YourPageSetupName”)
  3. )
  4.  
« Last Edit: July 29, 2014, 01:43:24 PM by BlackBox »
"How we think determines what we do, and what we do determines what we get."

stevedallas

  • Guest
Re: set a default page setup for all drawing in folder
« Reply #2 on: July 29, 2014, 02:40:30 PM »
Can you post the autoloader bundle from previous posts?
I tried the augi link and others, would not let me get to it.
I am running Autocad 2012.

BlackBox

  • King Gator
  • Posts: 3770
Re: set a default page setup for all drawing in folder
« Reply #3 on: July 29, 2014, 03:05:39 PM »
Can you post the autoloader bundle from previous posts?
I tried the augi link and others, would not let me get to it.
I am running Autocad 2012.

Here you go (see attached); this .bundle could use a great deal of updating, and will need to be recompiled to support 2015, but currently supports 2012-2014 as-is.

HTH



[Edit] - Attachment(s) removed; see this post for replacement.
« Last Edit: July 30, 2014, 05:19:02 PM by BlackBox »
"How we think determines what we do, and what we do determines what we get."

stevedallas

  • Guest
Re: set a default page setup for all drawing in folder
« Reply #4 on: July 29, 2014, 03:08:10 PM »
Thank you.

BlackBox

  • King Gator
  • Posts: 3770
Re: set a default page setup for all drawing in folder
« Reply #5 on: July 29, 2014, 03:08:58 PM »
Thank you.

You're welcome; I hope this helps.

Cheers
"How we think determines what we do, and what we do determines what we get."

stevedallas

  • Guest
Re: set a default page setup for all drawing in folder
« Reply #6 on: July 29, 2014, 05:31:02 PM »
OK, CRAZY QUESTION.
How do I unstall?

BlackBox

  • King Gator
  • Posts: 3770
Re: set a default page setup for all drawing in folder
« Reply #7 on: July 29, 2014, 05:32:32 PM »
OK, CRAZY QUESTION.
How do I unstall?

Simple - Remove the .bundle you placed in your ..\ApplicationPlugins\ folder.
"How we think determines what we do, and what we do determines what we get."

stevedallas

  • Guest
Re: set a default page setup for all drawing in folder
« Reply #8 on: July 30, 2014, 08:25:43 AM »
oops, I meant to say "install" on my previous message, not "unstall".
But, I dropped it in the applications plugin folder.
Now, How do I use it?
It there a way of testing it, such as dropping

(foreach layout1 (layoutlist) (vla-SetActivePageSetup layoutname “pdf 24-36”))

on the command line?

BlackBox

  • King Gator
  • Posts: 3770
Re: set a default page setup for all drawing in folder
« Reply #9 on: July 30, 2014, 08:29:17 AM »
oops, I meant to say "install" on my previous message, not "unstall".

No worries.



But, I dropped it in the applications plugin folder.
Now, How do I use it?
It there a way of testing it, such as dropping

Code: [Select]
(foreach layout1 (layoutlist) (vla-SetActivePageSetup layoutname “pdf 24-36”))
on the command line?

You can test it at the command line, as you've noted above, so long as the named page setup exists within that drawing... Or you can paste same in VLIDE and you should see that the custom LispFunction Method is a 'native' function (unlike your own Defun, presuming you're not using Pragma on your custom LISP).
"How we think determines what we do, and what we do determines what we get."

stevedallas

  • Guest
Re: set a default page setup for all drawing in folder
« Reply #10 on: July 30, 2014, 03:30:57 PM »
Is there a way that I can tell if the plugin loaded successfully?

BlackBox

  • King Gator
  • Posts: 3770
Re: set a default page setup for all drawing in folder
« Reply #11 on: July 30, 2014, 04:07:39 PM »
Is there a way that I can tell if the plugin loaded successfully?

What happens when you try either of these?

You can test it at the command line, as you've noted above, so long as the named page setup exists within that drawing... Or you can paste same in VLIDE and you should see that the custom LispFunction Method is a 'native' function (unlike your own Defun, presuming you're not using Pragma on your custom LISP).



[Edit] - What is reported to the command line when you invoke the APPAUTOLOADER Command?
"How we think determines what we do, and what we do determines what we get."

stevedallas

  • Guest
Re: set a default page setup for all drawing in folder
« Reply #12 on: July 30, 2014, 04:15:14 PM »
Command: (foreach layoutname (layoutlist) (vla-SetActivePageSetup layoutname
“pdf 30-42”))

; error: LispException: too many arguments
; error: LispException: too many argumentsnil

stevedallas

  • Guest
Re: set a default page setup for all drawing in folder
« Reply #13 on: July 30, 2014, 04:17:59 PM »
Is "layoutname" a variable that (layoutlist)  dumps into?

My drawings usually have multiple layout tabs.

BlackBox

  • King Gator
  • Posts: 3770
Re: set a default page setup for all drawing in folder
« Reply #14 on: July 30, 2014, 05:17:19 PM »
Not sure what's happened on your end  :?, but at the risk something got messed up in downloading/posting the .bundle here, I've just debugged this plug-in in 2012, 2014, and 2015 using Client Hyper-V & Visual Studio 2013 (see respective images attached).

As a result, I've subsequently revised the app .bundle to now support 2012-2015, so simply delete the earlier copy, and see the bottom of this post for a replacement .bundle.zip file.

Cheers



« Last Edit: July 30, 2014, 05:20:26 PM by BlackBox »
"How we think determines what we do, and what we do determines what we get."

stevedallas

  • Guest
Re: set a default page setup for all drawing in folder
« Reply #15 on: July 30, 2014, 09:37:15 PM »
Am using it correctly?
(foreach layoutname (layoutlist) (vla-SetActivePageSetup layoutname “pdf 30-42”))

layoutlist gets the list of all layouts in the drawing and puts in the variable layoutname.
"for each" layout in that list run vla-setactivepasetup using the names in the "layoutname" variable and set the active page setup to "pdf 30-42".

When I installed it, unzipped it into appdata/roaming/autodesk/.../applicationplugins
mapped the subfolder under the bundle content/windows/2012/... to the support folders.
and to acaddoc.lsp I added the .net command that maps the dll file.

BlackBox

  • King Gator
  • Posts: 3770
Re: set a default page setup for all drawing in folder
« Reply #16 on: July 31, 2014, 08:41:31 AM »
Am using it correctly?
(foreach layoutname (layoutlist) (vla-SetActivePageSetup layoutname “pdf 30-42”))

layoutlist gets the list of all layouts in the drawing and puts in the variable layoutname.
"for each" layout in that list run vla-setactivepasetup using the names in the "layoutname" variable and set the active page setup to "pdf 30-42".

When I installed it, unzipped it into appdata/roaming/autodesk/.../applicationplugins
mapped the subfolder under the bundle content/windows/2012/... to the support folders.
and to acaddoc.lsp I added the .net command that maps the dll file.

The first thing I noticed yesterday, when copying your test code from here (assuming you mean layoutname in foreach), is that the characters included as your quote symbol is not accepted; I had to delete those characters and re-type the quote symbol as part of my named page setup string and all worked just fine.



As for a crash course on how to properly handle Autoloader .bundles... Start by removing everything you added to Support File Search Path (SFSP), and AcadDoc.lsp file, as these are not necessary.

The aptly named Autoloader mechanism automatically loads all of the necessary components for you, and is essentially plug-and-play.

Simply extract the .bundle.ZIP file to ../ApplicationPlugins/ directory... Just be mindful that the ./Contents/ folder and PackageContents.xml file are located within the .bundle's top folder, some extraction tools will place the extracted .bundle within a folder of same name, i.e., ../ApplicationPlugins/foo.bundle/foo.bundle/Contents/, if that makes sense? (see image below)

Start AutoCAD... That's it. You're done. The .bundle is loaded automagically, and the custom LispFunction is available for use.



Also worthy of note, is that .bundles who's Components are set LoadOnAutoCADStartup="true" (as this plug-in is), the dependent .NET assembly is loaded prior to any Acad* files in the startup sequence... Which in this case means you can add a call to the custom LispFunction within AcadDoc.lsp to always set your desired named page setup active (for all layouts) at drawing open as I've been doing for the past few years.
"How we think determines what we do, and what we do determines what we get."