PDA

View Full Version : How to "reinitilize" my plot style table search path?



Dave Lewis
2007-03-08, 12:48 AM
I am using this code to append my plot style table search paths
Say I have a set of drawings at C:\Plot and there is a ctb there.
Once ran my path will be C:\Plot;X:\ACAD Support\PCP
In the plot dialog box AutoCAD will find the the C: drive pen table
But when doing a print preview or plotting AutoCAD will not correctly use
the .ctb file.
If I goto options file support paths and change something then AutoCAD will
always find
the files correctly.

I don't understand whats going wrong here. All I know is from time to time
all my print previews
show up in color because AutoCAD is not finding the pen tables properly.

Any ideas?



;;;
;;;begin reactor code
;;;Reset Plot Styles folder when drawing is switched
;;;
(defun TrapActivateDwg (reactor callbackData)
(setq dwgprefix (strcase (getvar "dwgprefix")))
(setenv "PrinterStyleSheetDir"
(STRCAT
(IF (WCMATCH DWGPREFIX "~C:\\DOCUMENTS AND SETTINGS*")
(STRCAT DWGPREFIX ";")
""
)
NetworkSupportRoot "PCP"
)
)
(princ)
)

;;;
;;; TrapActivateDwg reactor - catch focus changes between open drawings
;;;
(vlr-docmanager-reactor
nil
'((:vlr-documentBecameCurrent . TrapActivateDwg))
)
;;end reactor code

;;;
;;; run at load
;;;
(setq dwgprefix (strcase (getvar "dwgprefix")))
(setenv "PrinterStyleSheetDir"
(STRCAT
NetworkSupportRoot "PCP"
(IF (WCMATCH DWGPREFIX "~C:\\DOCUMENTS AND SETTINGS*")
(STRCAT ";" DWGPREFIX)
""
)
)
)

Opie
2007-03-08, 12:56 AM
The plot style search path can only point to one directory. Place a shortcut link within your plot style search path to have AutoCAD search additional directories you specify for plot styles.

Dave Lewis
2007-03-08, 01:00 AM
not true
try out the code I posted

A shortcut would not work as each folder / project would have its own .ctb files
you need something that can on the fly add paths.

Its either this or you end up with a plot sytle table on the network that has thousands of .ctb files.

Opie
2007-03-08, 01:05 AM
not true
try out the code I posted

A shortcut would not work as each folder / project would have its own .ctb files
you need something that can on the fly add paths.

Its either this or you end up with a plot sytle table on the network that has thousands of .ctb files.
You've already said it doesn't work 100%. How many of these CTB files are the same?

Dave Lewis
2007-03-08, 01:11 AM
It does work
There are no duplicate .ctb files.
Its like this
A client or sub consultant sends you an etransmit
You unzip everything into one folder and go to hit print
Normally you have to copy the .ctb files to your network plot style table folder so that you can plot the drawings. This is an additional step plus it clutters the folder.

The code uses the SETENV function.

It does work, like I said the problem is that it does not work 100% of the time for some reason. What I do now for a work around is if it is not working to open the options dialog box and then hit OK. This will make the 2 folders work properly.

Try the code if you do not believe me.

Opie
2007-03-08, 01:41 AM
Instead of adding the second folder to the path, why not replace it? Have you tried that?

Dave Lewis
2007-03-08, 03:36 PM
If there was no .ctb in the folder then plotting would not work

How could I do an IF autocad finds a .ctb to use that path
otherwise use the standard location

Mike.Perry
2007-03-09, 05:11 AM
The plot style search path can only point to one directory. Place a shortcut link within your plot style search path to have AutoCAD search additional directories you specify for plot styles.Hi

As far as I am aware, Richard is totally correct with his above statement.

The following post contains some links that you may find helpful / useful...

RE: Look Plot Styles in Multiple Directories

Have a good one, Mike

Mike.Perry
2007-03-09, 05:14 AM
The plot style search path can only point to one directory.

[ SNIP ]Hi

ID: TS1057343 - Using multiple directories with Plot Style tables (http://usa.autodesk.com/adsk/servlet/ps/item?siteID=123112&id=8048124&linkID=2475323)

Have a good one, Mike

Dave Lewis
2007-03-09, 03:26 PM
WOW I thought this was a AutoLISP forum?
Can no one modify my routine?
Thats all I asked for
all those other posts do NOT address my issue
All they do is provide a fixed solution to a few locations.

kennet.sjoberg
2007-03-10, 12:54 PM
WOW I thought this was a AutoLISP forum?
Can no one modify my routine?
Thats all I asked for
all those other posts do NOT address my issue
All they do is provide a fixed solution to a few locations.

Do your .ctb files have static names ?
(if (findfile "Myctb" ) (do this) (else to that ))

: ) Happy Computing !

kennet

BTW, it may be a "registry update delay".
When the reactor has triggered your function and it looks bad,
what happens if you open one more drawing from the same location and try to plot again ?

AND, try to run your code for setenv manually, will it work ?

Dave Lewis
2007-03-24, 03:51 PM
Ok finallly I have some working code that replaces the .ctb search paths.
A friend of mine sugested (vla-RefreshPlotDeviceInfo ALA)
I am not always able to replicate the problem of AutoCAD finding the .ctb file but plot previewing in color. So for now I have deployed the solution and have told users that if they get a color print preview to open the options dialog box and then close it and that will make autocad preview in b/w


(VL-LOAD-COM)
(SETQ AOBJ (vlax-get-acad-object)
APREF (vla-get-Preferences AOBJ)
AFILES (vla-get-Files APREF)
AOUTPUT (vla-get-output APREF)
ASYSTEM (vla-get-system APREF)
ADISP (vla-get-Display APREF)
AOPENSAVE (vla-get-OpenSave APREF)
ADOC (vla-get-ActiveDocument AOBJ)
ALA (vla-get-ActiveLayout ADOC)
)

;;;
;;;begin reactor code
;;;Reset Plot Styles folder when drawing is switched
;;;
(defun TrapActivateDwg (reactor callbackData)
(setq dwgprefix (getvar "dwgprefix"))
(if (member T (mapcar '(lambda (x) (wcmatch x "*.ctb"))
(vl-directory-files DWGPREFIX)) ; mapcar
) ; member
(vla-put-PrinterStyleSheetPath AFILES (getvar "dwgprefix"))
(vla-put-PrinterStyleSheetPath AFILES (strcat NetworkSupportRoot "PCP"))
) ; if
(vla-RefreshPlotDeviceInfo ALA)
(princ)
)

;;;
;;; TrapActivateDwg reactor - catch focus changes between open drawings
;;;
(vlr-docmanager-reactor
nil
'((:vlr-documentBecameCurrent . TrapActivateDwg))
)
;;end reactor code

;;;
;;; run at load
;;;
(setq dwgprefix (getvar "dwgprefix"))
(if (member T (mapcar '(lambda (x) (wcmatch x "*.ctb"))
(vl-directory-files DWGPREFIX)) ; mapcar
) ; member
(vla-put-PrinterStyleSheetPath AFILES (getvar "dwgprefix"))
(vla-put-PrinterStyleSheetPath AFILES (strcat NetworkSupportRoot "PCP"))
) ; if

(vla-RefreshPlotDeviceInfo ALA)[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]