• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD 2010/2011/2012 DWG Format

    Reply
    Active Member
    sjmsme
    Posts: 6
    Registered: ‎08-13-2010

    Lisp Routine fix for CTB files

    276 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

    Please use plain text.
    Distinguished Mentor
    Moshe-A
    Posts: 679
    Registered: ‎09-14-2003

    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

     

     

     

    Please use plain text.
    *Expert Elite*
    dgorsman
    Posts: 3,285
    Registered: ‎10-12-2006

    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.


    Please use plain text.
    Active Member
    sjmsme
    Posts: 6
    Registered: ‎08-13-2010

    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

    Please use plain text.
    Active Member
    sjmsme
    Posts: 6
    Registered: ‎08-13-2010

    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.

     

    Please use plain text.