AutoCAD 2010/2011/2012

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

Lisp Routine fix for CTB files

422 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: 711
Registered: ‎09-14-2003
Message 2 of 5 (406 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: 4,730
Registered: ‎10-12-2006
Message 3 of 5 (398 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 (388 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 (386 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.

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community




Connect with AutoCAD

Twitter

Facebook

Blogs

Pinterest

Youtube