TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: danny on January 19, 2006, 08:38:08 PM

Title: switching plot style paths
Post by: danny on January 19, 2006, 08:38:08 PM
I'm am using lisp to switch between client and company plot style paths.  the lisp will switch the support path correctly but requires shutting down AutoCAD for it to work properly.
Is there a way to add or change a support path/ plot style path w/o shutting down and reopenning ACAD.
Mahalo for your help
-danny
Title: Re: switching plot style paths
Post by: Chuck Gabriel on January 19, 2006, 10:07:42 PM
Are you modifying the registry directly, or are you working with the preferences object?
Title: Re: switching plot style paths
Post by: danny on January 19, 2006, 10:52:04 PM
options
file
Printer Support File Path
Plot Style Table Search Path

Code: [Select]
(setenv "PrinterStyleSheetDir" "M:\\_Cad Support\\AutoCAD 2004\\Client_CTB")
Code: [Select]

path is changed correctly but ctb wont work unless ACAD is shutdown and reopened.
Title: Re: switching plot style paths
Post by: pmvliet on January 19, 2006, 11:01:35 PM
Danny,

That works for me w/o having to get out of AutoCad.

Pieter
Title: Re: switching plot style paths
Post by: Chuck Gabriel on January 20, 2006, 07:55:02 AM
Code: [Select]
(setq prefs (vla-get-preferences (vlax-get-acad-object))
      filePrefs (vla-get-files prefs)
)
(vla-put-printerstylesheetpath filePrefs "c:/plot styles")
Title: Re: switching plot style paths
Post by: danny on January 20, 2006, 02:40:05 PM
chuck,
the code you provided works to the point of doing the plot.
example:
if I'm currently in a drawing and have my plot style path browsing to "m:/plot styles"
then I use your code,
I will now be browsing to "c:/plot styles" :-)
but when I do a plot, the ctb's will show up as color in preview and when printing. :-(
AutoCAD isn't reading the ctb correctly and takes exiting ACAD and reentering to work.

pmvliet,
when you used the code, did the plot preview show up correctly as well as the print?
Title: Re: switching plot style paths
Post by: Jeff_M on January 20, 2006, 08:24:15 PM
Danny,
Using Chuck's code, try adding
Code: [Select]
(vla-refreshplotdeviceinfo
  (vla-get-activelayout
   (vla-get-activedocument
     (vlax-get-acad-object))))
Quote from: AcadHelp
Updates the plot, canonical media, and plot style table information to reflect the current system state.

edited to fix my inadvertent "test" line, props to Tim W for finding it....
Title: Re: switching plot style paths
Post by: danny on January 27, 2006, 06:30:17 PM
jeff,
got a error message
"no function definition: VLAX-GET-ACAD-DOCUMENT"
this is the code I used
Code: [Select]
(defun c:AHLCTBD ()
(setq prefs(vla-get-preferences (vlax-get-acad-object))
      filePrefs(vla-get-files prefs))
(vla-put-printerstylesheetpath filePrefs "M:\\_Cad Support\\AHL_CTB")
(vla-refreshplotdeviceinfo
  (vla-get-activelayout
   (vla-get-activedocument
     (vlax-get-acad-document))))
(alert "Notice:\nYou are now using AHL standard CTB's")
(princ)
)
Title: Re: switching plot style paths
Post by: T.Willey on January 27, 2006, 06:46:29 PM
Edit

Change it to
(vlax-get-Acad-Object)
instead of
(vlax-get-Acad-Document)
Title: Re: switching plot style paths
Post by: Jeff_M on January 27, 2006, 07:26:55 PM
Oops!  :oops: Tim caught the "test" I put in there...... :roll:
Title: Re: switching plot style paths
Post by: T.Willey on January 27, 2006, 07:36:14 PM
Oops! :oops: Tim caught the "test" I put in there...... :roll:
Almost got by me.  I put the standard reply to that type of error
Quote
Add (vl-load-com), that should fix it.

Then I saw that it didn't look right.

Nice test Jeff.   :evil:
Title: Re: switching plot style paths
Post by: danny on January 30, 2006, 03:40:00 PM
thanks guys,
The search path is changed correctly but I'm still having to close and reopen ACAD for the ctb's to work correctly. 
It must be something ACAD is doing @ startup.
Title: Re: switching plot style paths
Post by: deegeecees on January 30, 2006, 03:43:59 PM
<guess> convertpstyles </guess>
Title: Re: switching plot style paths
Post by: T.Willey on January 30, 2006, 03:55:04 PM
thanks guys,
The search path is changed correctly but I'm still having to close and reopen ACAD for the ctb's to work correctly.
It must be something ACAD is doing @ startup.

I have heard this happening when you change things in the registry.  I haven't heard of a fix/workaround yet. :cry:  I will keep my ears (eyes) open for any suck fix/workaround.
Title: Re: switching plot style paths
Post by: danny on January 30, 2006, 04:12:38 PM
(vl-registry-read)????
Title: Re: switching plot style paths
Post by: GDF on January 30, 2006, 04:20:48 PM
Tim

(setenv "PrinterConfigDir" (strcat ARCH#CUSF "PlotCFG"))
(setenv "PrinterDescDir" (strcat ARCH#CUSF "PlotCFG")) ;correct
(setenv "PrinterStyleSheetDir" (strcat ARCH#CUSF "PlotCFG\\PlotStyles"))

This shows plotstyles found

(setenv "PrinterConfigDir" (strcat (getvar "ROAMABLEROOTPREFIX") "\\plotters"))
(setenv "PrinterDescDir" (strcat (getvar "ROAMABLEROOTPREFIX") "\\PMP Files"))
(setenv "PrinterStyleSheetDir" (strcat (getvar "ROAMABLEROOTPREFIX") "\\Plot Styles"))

This shows missing plotstyles

Toggleing back and forth in 2006 seems to work fine...without retarting.
Gary
Title: Re: switching plot style paths
Post by: T.Willey on January 30, 2006, 05:01:55 PM
(vl-registry-read)????
That is just to read what is in the registry, not to update it so that it works correctly in the current session.  At least that is my understanding.  But then again I don't mess with the registry unless I have to, and that doesn't happen too oftern.

Toggleing back and forth in 2006 seems to work fine...without retarting.
Gary
That doesn't seem to have worked for the Danny though per below.
chuck,
the code you provided works to the point of doing the plot.
example:
if I'm currently in a drawing and have my plot style path browsing to "m:/plot styles"
then I use your code,
I will now be browsing to "c:/plot styles" :-)
but when I do a plot, the ctb's will show up as color in preview and when printing. :-(
AutoCAD isn't reading the ctb correctly and takes exiting ACAD and reentering to work.

pmvliet,
when you used the code, did the plot preview show up correctly as well as the print?

I still don't have an answer.  What version are you using Danny?
Title: Re: switching plot style paths
Post by: danny on January 30, 2006, 05:36:08 PM
acad version 2004
I'm still looking around for a solution.  Almost ready to give up though... :|
I've seen topics on switching plot paths, but those lisp are very similar. don't know if they ran into the same problem.
Title: Re: switching plot style paths
Post by: pmvliet on January 30, 2006, 06:27:10 PM
I guess it doesn't switch the colortables correctly.
I know that was one reason why you couldn't change profiles during a session of AutoCad.

I bet it has to do when AutoCad reads in that information. It only does it upon startup.
Once it is read, it no longer looks at that information.

So somehow we need to figure out how to get AutoCad to re-read that variable...

 :|

Pieter