Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Apply Plot style table to all layout
« previous
next »
Print
Pages: [
1
] |
Go Down
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]
; (defun c:PLOTHORY ()
(
vla-put-StyleSheet
(
vla-get-ActiveLayout
(
vla-get-ActiveDocument
(
vlax-get-acad-object
)
)
)
"monochrome.ctb"
)
)
But it still works only in current layout.
Could you possily help me to modify for all layout setting?
Thanks in advanced,
Miquan
Logged
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]
(
vlax-map-collection
(
vla-get-Layouts
(
vla-get-ActiveDocument
(
vlax-get-acad-object
)
)
)
'
(
lambda
(
x
)
(
vla-put-StyleSheet
x
"monochrome.ctb"
)
)
)
Logged
#iCAD
https://www.facebook.com/uxtek
https://www.facebook.com/iCADvn/
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 »
Funny I was just trying to do the same thing.
I love this place!
Thanks!.
Logged
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
Logged
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
Logged
#iCAD
https://www.facebook.com/uxtek
https://www.facebook.com/iCADvn/
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]
(
vl-load-com
)
(
defun
_foo1
(
ctb
)
(
vlax-map-collection
(
vla-get-Layouts
(
vla-get-ActiveDocument
(
vlax-get-acad-object
)
)
)
'
(
lambda
(
x
)
(
vla-put-StyleSheet
x ctb
)
)
)
)
(
defun
_foo2
(
ctb
)
(
vlax-for
x
(
vla-get-layouts
(
vla-get-activedocument
(
vlax-get-acad-object
)
)
)
(
vla-put-stylesheet
x ctb
)
)
)
... And the results from console:
Code - Auto/Visual Lisp:
[Select]
_$
(
bench '
(
_foo1 _foo2
)
'
(
"FOO.ctb"
)
10000
)
_FOO1
Elapsed:
4774
Average:
0.4774
_FOO2
Elapsed:
3791
Average:
0.3791
Logged
"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
Logged
"How we think determines what we do, and what we do determines what we get."
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Apply Plot style table to all layout