Author Topic: Warning: LDD Type Library filename changed in 2006  (Read 2138 times)

0 Members and 1 Guest are viewing this topic.

sinc

  • Guest
Warning: LDD Type Library filename changed in 2006
« on: February 08, 2006, 09:32:24 PM »
For those of you that write Lisp for Land Desktop/Civil Design and register the type library in your code, you may want to be aware of a change.  The file used to be called "landauto.tlb".  In 2006, the filename was inexplicably changed to "landauto46.tlb".   :ugly:

(At least, I'm assuming it changed in 2006 - I haven't used 2005.)

So if you write any code for LDD/Civil and you register the type library, and you want to make sure it still works in 2006, you can use the following code snippit:

Code: [Select]
(setq avn (substr (getvar "ACADVER") 1 4)
      tlb (cond
            ((= avn "16.2") "landauto46.tlb")  ; LDD 2006
            ((= avn "17.0") "landauto50.tlb")  ; LDD 2007
            ; add any future versions here
            ("landauto.tlb")
          )
)
(if (null vll-kCurve)
  ; Define all LDD methods, properties, and constants as starting with "vll"
  ; It's possible I should use a different prefix for each, but as of yet I
  ;  haven't found a good reason to, and I prefer having all LDD references
  ;  start with "vll"
  (vlax-import-type-library
    :tlb-filename   tlb
    :methods-prefix     "vll-"
    :properties-prefix  "vll-"
    :constants-prefix   "vll-"
   ) ;_ vlax-import-type-library
) ;_ if
(setq
  avn nil
  tlb nil
)
« Last Edit: May 09, 2006, 09:02:40 PM by sinc »

whdjr

  • Guest
Re: Warning: LDD Type Library filename changed in 2006
« Reply #1 on: February 09, 2006, 09:06:32 AM »
I don't use LDD or C3D but I do use ADT.  I haven't had a reason to code with the ADT data yet but if I'm reading between the lines here does your statement meen that before access any of the ADT properties and methods I have to load the type library first?  I had heard there was some issues with Lisp and the verticals but I didn't know about that one.

sinc

  • Guest
Re: Warning: LDD Type Library filename changed in 2006
« Reply #2 on: February 09, 2006, 10:41:58 AM »
You don't need to, but it makes your life easier.  First of all, if you register the type library, all the Land/Civil objects/props/methods will show up in the VLIDE highlighted in blue, and you will have access to all the Land/Civil constants by their name.  If you don't register the type library, this doesn't happen.

So, if you register the type library, you can code like this:
Code: [Select]
(defun c:testfunc ()
  (setq acadObj   (vlax-get-acad-object)
        aeccApp   (vla-getInterfaceObject acadObj "Aecc.Application")
        aeccProj      (vll-get-activeProject aeccApp)
        aeccPref     (vll-get-preferences aeccProj)
        profPref     (vll-get-profile aeccPref)
        egLayer   (vll-getString profPref vll-kEgLayer)
  ) ; setq
) ;_ defun

If you don't, you must code like this:
Code: [Select]
(defun c:testfunc ()
  (setq acadObj   (vlax-get-acad-object)
        aeccApp   (vla-getInterfaceObject acadObj "Aecc.Application")
        aeccProj      (vlax-get-property aeccApp 'ActiveProject)
        aeccPref     (vlax-get-property aeccProj 'Preferences)
        profPref     (vlax-get-property aeccPref 'Profile)
        egLayer   (vlax-invoke-method profPref 'GetString 100)
  ) ; setq
) ;_ defun

Registering the type library can also make your Lisp run slightly faster, although most of the time the difference in speed isn't enough to notice in real life.

whdjr

  • Guest
Re: Warning: LDD Type Library filename changed in 2006
« Reply #3 on: February 09, 2006, 11:14:05 AM »
Thanks for the info.  I'll remember that.

sinc

  • Guest
Re: Warning: LDD Type Library filename changed in 2006
« Reply #4 on: May 09, 2006, 09:10:04 PM »
Autodesk changed the type library filename again in 2007.  Thanks, Autodesk, for doing something that serves absolutely no purpose, and at the same time breaks perfectly functional code...  :realmad:

I have edited the original post, adding a line for 2007.

Maybe someday I'll come up with a version that searches for any file matching the wildcard string "landauto*.tlb", so that the code will continue to work in future product releases...  It's pretty low on my list of priorities, though.