Author Topic: Set default page setup  (Read 4270 times)

0 Members and 1 Guest are viewing this topic.

BlackBox

  • King Gator
  • Posts: 3769
Re: Set default page setup
« Reply #15 on: May 24, 2022, 12:48:31 PM »
No worries; do what's best for you.

Updating the XML is easy, and part of the Autoloader mechanism, which has been Autodesk's method for supporting apps since +/- 2012 version. It's also how I implement custom system variables, etc in a host of other apps.

You don't have to compile anything, I just offered source code for those that prefer to. The .NET API can do a lot of things, so offering the source code was just a way of building other's trust in what I post.

Happy coding! :beer:

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

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4067
Re: Set default page setup
« Reply #16 on: April 03, 2023, 02:31:15 PM »
Try the following:
Code - Auto/Visual Lisp: [Select]
  1. (defun applypstolayouts ( cfg / doc rtn )
  2.     (if
  3.         (setq rtn
  4.             (not
  5.                 (vl-catch-all-error-p
  6.                     (setq cfg
  7.                         (vl-catch-all-apply 'vla-item
  8.                             (list
  9.                                 (vla-get-plotconfigurations
  10.                                     (setq doc
  11.                                         (vla-get-activedocument
  12.                                             (vlax-get-acad-object)
  13.                                         )
  14.                                     )
  15.                                 )
  16.                                 cfg
  17.                             )
  18.                         )
  19.                     )
  20.                 )
  21.             )
  22.         )
  23.         (vlax-for lay (vla-get-layouts doc)
  24.             (if (= :vlax-false (vla-get-modeltype lay))
  25.                 (vla-copyfrom lay cfg)
  26.             )
  27.         )
  28.     )
  29.     rtn
  30. )

Call with name of Page Setup:
Code - Auto/Visual Lisp: [Select]
  1. (applypstolayouts "mypagesetup")

Will return T if Page Setup is valid, else nil; excludes Model tab.

Hey Lee, I am running it, and it returns T, but the layout is not updating.  Any ideas?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4067
Re: Set default page setup
« Reply #17 on: April 03, 2023, 02:34:10 PM »
Picture
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)