Author Topic: PlotStyle "mystyle" (vla-put-PlotStyleName)  (Read 2976 times)

0 Members and 1 Guest are viewing this topic.

vladimirzm

  • Guest
PlotStyle "mystyle" (vla-put-PlotStyleName)
« on: February 16, 2006, 01:18:56 AM »
I have MyStyles.stb and inside it "mystyle" plot style, I want to set this style to a layer through vla-put-PlotStyleName but it really don't work!

any idea?

whdjr

  • Guest
Re: PlotStyle "mystyle" (vla-put-PlotStyleName)
« Reply #1 on: February 16, 2006, 08:16:34 AM »
Theoretically this should work, however I did not test it.  I don't have any .stb files.

Code: [Select]
;I have MyStyles.stb and inside it "mystyle" plot style,
 ;I want to set this style to a layer through
 ;vla-put-PlotStyleName but it really don't work!

(defun ppsn (layername plotstylename)
  (vla-put-plotstylename
    (vla-item (vla-get-layers
(vla-get-activedocument (vlax-get-acad-object))
      )
      layername
    )
    plotstylename
  )
)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: PlotStyle "mystyle" (vla-put-PlotStyleName)
« Reply #2 on: February 16, 2006, 09:19:14 AM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

vladimirzm

  • Guest
Re: PlotStyle "mystyle" (vla-put-PlotStyleName)
« Reply #3 on: February 17, 2006, 02:58:31 AM »
whdjr, that function don't work, I did a very similiar one, but nothing happens.

CAB, the problem are my custom plot styles. ByLayer, ByBlock... and default plot styles load without problem

but finally I think, I found the answer: somebody tell me that I can load any custom plot style (with vla-put-PlotStyleName) only if before they have been loaded or applied at least once. then the function that works for me:

Code: [Select]
(defun ppsn (object stylename / cplotstyle)
  (setq cplotstyle (getvar "CPLOTSTYLE"))
  (setvar "CPLOTSTYLE" stylename)     
  (vla-put-PlotStyleName object stylename)
  (setvar "CPLOTSTYLE" cplotstyle)
)

So strange to be doing that