Page 1 of 1

Lisp Routine fix for CTB files

PostPosted: Thu Jan 19, 2012 6:34 pm
by monksjm
We work with a large number of CTB files, or at least we used to. Trying to streamline the problem. But, as a result of the way things used to be done, we have CTB files for drawings located in the folder of the drawing. Until now, this lisp routine, added to the end of the acad.lsp file, worked just fine for repathing the location autocad looks for the ctb. On my new machine, Windows 7, 64 bit with 2012, it will not work. Any ideas?

here's the lisp routine we use:

(defun C:GC ()
(setq printerstylesheetdir (getvar "dwgprefix"))
acadLocation (vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\"
(vlax-product-key)) "AcadLocation")
(setenv "PrinterStyleSheetDir" printerstylesheetdir)
(princ)
)

Here's the error i get now...

Command: GC
no function definition: VLAX-PRODUCT-KEY :error#2*Cancel*

Help!

Currently running Carlson Civil Suite 2012 on top of Civil 3D 2012, Windows 7, 64 bit.

Thanks!



Shaun

PostPosted: Thu Jan 19, 2012 8:42 pm
by site admin
Other than moving these files to the default location that the Acad is looking for them, I am at a loss.

You may want to post this in an Acad forum as well since others may be seeing the same thing on the newer acad.

PostPosted: Thu Jan 19, 2012 8:49 pm
by monksjm
I did. Like I said, it works fine on a 32 bit system with Acad 2009 and earlier...I'm assuming it has to do with the registry setup in Windows 7 on a 64-bit

PostPosted: Thu Jan 19, 2012 9:28 pm
by R Stillwell
This might make it work.

(defun C:GC ()
(VL-LOAD-COM)
(setq printerstylesheetdir (getvar "dwgprefix"))
acadLocation (vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\"
(vlax-product-key)) "AcadLocation")
(setenv "PrinterStyleSheetDir" printerstylesheetdir)
(princ)
)

Honestly though the code you posted could accomplish what it is doing with one line of code.

(defun C:GC ()
(setenv "PrinterStyleSheetDir" (getvar "dwgprefix"))
)

Or the code you pasted is incomplete because the following piece of the code does nothing but return a string to the command line.

acadLocation (vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\"
(vlax-product-key)) "AcadLocation")

thanks!

PostPosted: Fri Jan 20, 2012 12:22 pm
by monksjm
RStillwell

each one of you fixes did the trick. BIG THANK YOU!

Shaun

PostPosted: Wed Feb 29, 2012 7:30 am
by mathewines
You are missing a call to in your new system. You should also verify that registry path - it might be different for 64 bit applications. Also, there is a LISP function (gc) which you might end up conflicting with if not careful with the C: prefix.