AutoCAD 2010/2011/2012

AutoCAD 2010/2011/2012

Reply
Active Member
sjmsme
Posts: 6
Registered: ‎08-13-2010
Message 1 of 5 (524 Views)

Lisp Routine fix for CTB files

524 Views, 4 Replies
01-19-2012 10:33 AM

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!

 

Thanks!

 

Shaun

Distinguished Mentor
Moshe-A
Posts: 829
Registered: ‎09-14-2003
Message 2 of 5 (508 Views)

Re: Lisp Routine fix for CTB files

01-19-2012 01:52 PM in reply to: sjmsme

hi,

 

here is a correction to your lisp function

 

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

 

cheers

Moshe

 

 

 

*Expert Elite*
dgorsman
Posts: 5,698
Registered: ‎10-12-2006
Message 3 of 5 (500 Views)

Re: Lisp Routine fix for CTB files

01-19-2012 03:05 PM in reply to: sjmsme

Odds are, you are missing a call to (vl-load-com) 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.  Give it a long descriptive name and then use the PGP to shorten it up to GC or whatever works for you.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
Adopt. Adapt. Overcome. Or be overcome.
A good question will be halfway to a good answer.


Active Member
sjmsme
Posts: 6
Registered: ‎08-13-2010
Message 4 of 5 (490 Views)

Re: Lisp Routine fix for CTB files

01-20-2012 03:53 AM in reply to: Moshe-A

Moshe-A,

 

Thanks but no cigar. Same error.

 

Shaun

Active Member
sjmsme
Posts: 6
Registered: ‎08-13-2010
Message 5 of 5 (488 Views)

Re: Lisp Routine fix for CTB files

01-20-2012 03:54 AM in reply to: dgorsman

dgorsman,

 

thanks. I changed the "defun" to getctb and will change the quickkey stroke. Not too sure how to look into my registry on 64 bit.

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.