TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started 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
-
Are you modifying the registry directly, or are you working with the preferences object?
-
options
file
Printer Support File Path
Plot Style Table Search Path
(setenv "PrinterStyleSheetDir" "M:\\_Cad Support\\AutoCAD 2004\\Client_CTB")
path is changed correctly but ctb wont work unless ACAD is shutdown and reopened.
-
Danny,
That works for me w/o having to get out of AutoCad.
Pieter
-
(setq prefs (vla-get-preferences (vlax-get-acad-object))
filePrefs (vla-get-files prefs)
)
(vla-put-printerstylesheetpath filePrefs "c:/plot styles")
-
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?
-
Danny,
Using Chuck's code, try adding
(vla-refreshplotdeviceinfo
(vla-get-activelayout
(vla-get-activedocument
(vlax-get-acad-object))))
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....
-
jeff,
got a error message
"no function definition: VLAX-GET-ACAD-DOCUMENT"
this is the code I used
(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)
)
-
Edit
Change it to
(vlax-get-Acad-Object)
instead of
(vlax-get-Acad-Document)
-
Oops! :oops: Tim caught the "test" I put in there...... :roll:
-
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
Add (vl-load-com), that should fix it.
Then I saw that it didn't look right.
Nice test Jeff. :evil:
-
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.
-
<guess> convertpstyles </guess>
-
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.
-
(vl-registry-read)????
-
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
-
(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?
-
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.
-
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