Author Topic: Apply Plot style table to all layout  (Read 4501 times)

0 Members and 1 Guest are viewing this topic.

miquan

  • Guest
Apply Plot style table to all layout
« on: July 24, 2013, 06:02:51 PM »
Dear all,

I use this lisp for set plot style table of layout to specific one.
Code - Auto/Visual Lisp: [Select]
  1. ; (defun c:PLOTHORY ()
  2.     )
  3.     "monochrome.ctb"
  4.   )
  5. )

But it still works only in current layout.
Could you possily help me to modify for all layout setting?

Thanks in advanced,
Miquan

Ketxu

  • Newt
  • Posts: 109
Re: Apply Plot style table to all layout
« Reply #1 on: July 25, 2013, 12:32:22 AM »
You could try :
Code - Auto/Visual Lisp: [Select]
  1.         (vla-get-Layouts
  2.                 (vla-get-ActiveDocument (vlax-get-acad-object))
  3.     )
  4.         '(lambda(x)(vla-put-StyleSheet x "monochrome.ctb"))
  5. )

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Apply Plot style table to all layout
« Reply #2 on: July 25, 2013, 06:42:14 AM »
 :-D :-D
Funny I was just trying to do the same thing.   
I love this place!
Thanks!.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

miquan

  • Guest
Re: Apply Plot style table to all layout
« Reply #3 on: July 25, 2013, 09:06:43 PM »
Dear ketxu,

Thanks for your support.
I works fine.

PS: you're from vietnam?

Miquan

Ketxu

  • Newt
  • Posts: 109
Re: Apply Plot style table to all layout
« Reply #4 on: July 26, 2013, 02:30:47 PM »
Yeah. Im living in Ha Noi

BlackBox

  • King Gator
  • Posts: 3770
Re: Apply Plot style table to all layout
« Reply #5 on: July 26, 2013, 04:43:22 PM »
FWIW -

It's actually faster to iterate the Layouts Collection, and manipulate each Layout Object directly, than it is to Map an anonymous function to same... To demonstrate, here's a quick speed test:

Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun _foo1 (ctb)
  3.     )
  4.     '(lambda (x) (vla-put-StyleSheet x ctb))
  5.   )
  6. )
  7.  
  8. (defun _foo2 (ctb)
  9.                 (vla-get-activedocument (vlax-get-acad-object))
  10.               )
  11.     (vla-put-stylesheet x ctb)
  12.   )
  13. )
  14.  



... And the results from console:

Code - Auto/Visual Lisp: [Select]
  1. _$ (bench '(_foo1 _foo2) '("FOO.ctb") 10000)
  2.  
  3. _FOO1
  4. Elapsed: 4774
  5. Average: 0.4774
  6.  
  7. _FOO2
  8. Elapsed: 3791
  9. Average: 0.3791
  10.  
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: Apply Plot style table to all layout
« Reply #6 on: July 26, 2013, 04:47:25 PM »
Also, as it is loosely related, for those who might be interested: vla-SetActivePageSetup
"How we think determines what we do, and what we do determines what we get."