Author Topic: StyleSheet property for layouts  (Read 4088 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
StyleSheet property for layouts
« on: January 11, 2006, 06:25:01 PM »
I am reworking my batch plot routine.  I have run into a problem that has existed for a while in my old one, but didn't know about until I started rewriting it.  For some reason I can set the "StyleSheet" property in some drawing instances, but not all.  The help says that it is read/write, so I'm really lost now.  Has anyone else seen this?  Here is a quote from the command line to show what I mean.
Thanks for any help.
Quote
Command: (findfile (strcat (getenv "PrinterStyleSheetDir") "\\" "3m-a-b-tim.ctb"))
"C:\\ACADSUPP2004\\Plot Styles\\3m-a-b-tim.ctb"

Command: (progn
(_> (setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(_>     (setq ActLayout (vla-get-ActiveLayout ActDoc))
(_> )
#<VLA-OBJECT IAcadLayout 0ec3bbc4>

Command: (vlax-property-available-p actlayout 'stylesheet)
T

Command: (vla-put-stylesheet actlayout "3m-a-b-tim.ctb")
; error: Automation Error. Invalid input

Command: (vlax-property-available-p actlayout 'stylesheet T)
T

Command: (vla-put-stylesheet actlayout "3m-a-b-tim.ctb")
; error: Automation Error. Invalid input
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: StyleSheet property for layouts
« Reply #1 on: January 11, 2006, 06:45:26 PM »
Tim, I can duplicate this by trying to set the stylesheet property to "acad.ctb" when PSTYLEMODE is 0, as it is expecting a type of .stb.


T.Willey

  • Needs a day job
  • Posts: 5251
Re: StyleSheet property for layouts
« Reply #2 on: January 11, 2006, 06:53:23 PM »
Thanks Jeff, but this happens when I have pstylemode set to 1.  You have given me a place to start though.  I didn't think to check all the system variables.  I will do that now.  Here is the error from the command line.  Post back if I find anything.
Quote
Command: pstylemode

PSTYLEMODE = 1 (read only)
Command: (progn
(_> (setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(_>     (setq ActLayout (vla-get-ActiveLayout ActDoc))
(_> )
#<VLA-OBJECT IAcadLayout 02a995e4>

Command: (vla-put-stylesheet actlayout "3m-a-b-tim.ctb")
; error: Automation Error. Invalid input

Command: (vla-put-stylesheet actlayout "acad.ctb")
; error: Automation Error. Invalid input
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: StyleSheet property for layouts
« Reply #3 on: January 11, 2006, 07:02:56 PM »
Could you email a drawing to me that this occurs in? miff@sonic.net
What does (vla-get-stylesheet actlayout) return?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: StyleSheet property for layouts
« Reply #4 on: January 11, 2006, 07:17:27 PM »
Just sent it.  Here is from the command line.

Command: (vla-get-stylesheet actlayout)
"z-3M-FERE-Mechanical-Default.ctb"

I have read other post that have had the same problem when trying to do this with VBA.  I didn't see any real solution.  I will continue to look.

Thanks again.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: StyleSheet property for layouts
« Reply #5 on: January 11, 2006, 07:36:14 PM »
Looks like the answer was you have to refres the plot device first.  After that it seems to work.  In my code I just added this line before setting the StyleSheet.

(vla-RefreshPlotDeviceInfo ActLayout)

It worked on the drawings that it was erroring on before.  I will continue to use it, and post back if it errors still.

Thanks Jeff for the help.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: StyleSheet property for layouts
« Reply #6 on: January 11, 2006, 07:46:13 PM »
The error occurs when you try to put a ctb style in a stb drawing.
perhaps?
Code: [Select]
(if (= 0 (getvar "pstylemode")) ; STB - Named plot styles
« Last Edit: January 11, 2006, 07:53:32 PM by CAB »
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.

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: StyleSheet property for layouts
« Reply #7 on: January 11, 2006, 07:58:27 PM »
Tim, I was just about to post about using the RefreshPlotDeviceInfo. I'm glad you found it. I saw someone else mention that this error will occur if the PlotDevice is set to "None", but I could not duplicate this.

Alan, that's what I suggested in my first post up above..... :P

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: StyleSheet property for layouts
« Reply #8 on: January 11, 2006, 08:13:35 PM »
Sorry Jeff I see it now :-o
I think I need to get some sleep, the deprivation has caught up to me. :|
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.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: StyleSheet property for layouts
« Reply #9 on: January 13, 2006, 05:23:30 PM »
Just an update.  This also looks as if it fixed my other problem, in which I couldn't use extents with scale to fit, but now it seems to work correctly.

If anyway wants the code I can post it.  It allows one to print from one directory with different ctb files.  I have all my page setups in one drawing file, and I reference that through ObjectDBX, and put that into a list to be able to select.  Then you can select multiple ctb files to print with.  I don't know how many others would want it, but if so then I can post it.  It's not super pretty, but it works.

Thanks again.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

deegeecees

  • Guest
Re: StyleSheet property for layouts
« Reply #10 on: January 13, 2006, 07:08:41 PM »
Tim,
I'd have a look at it.

I have a VBA batch plot macro that is VERY unstable when plotting many files (like 200 or so). I get mixed results with different puters so I'm guessing that some of the lesser ones run out of RAM.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: StyleSheet property for layouts
« Reply #11 on: January 13, 2006, 10:22:30 PM »
Tim,
I would like to take a look.
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.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: StyleSheet property for layouts
« Reply #12 on: January 16, 2006, 11:35:10 AM »
Okay.  Here you go.  I have (hopfully) included all the subs that are needed.  In the "GetPlotStyles" sub you will have to change this line (and this is how it is labeled in the lisp file) to find where you store all your page setups.
Code: [Select]
(vla-Open dbxApp "C:/Custom/Drawings/3M-DIMv02.dwg");<------ CHANGE TO LOCATION OF DRAWING WITH ALL THE PLOT CONFIGURATIONS.

Let me know anything.  Comments, improvements.. whatever.
Thanks.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

deegeecees

  • Guest
Re: StyleSheet property for layouts
« Reply #13 on: January 16, 2006, 12:06:43 PM »
Thanks Tim.