I have written a program and compiled into an .exe
that automatically creates object data for text
imported from an external file that works perfect
with AutoCAD Map 2004, but when I try running it
in the machine that has 2005 it wont run.
I know what you are going to say -- you are going to
say -- well why not just edit your references from
the machine that has AutoCAD Map 2005 and compile
your code from there.
Well that would not be too easy to do, the reason
being that only the machine with AutoCAD 2004 has
Visual Basic in it. And now my boss is talking about
buying AutoCAD Map 2006 (which he told me has just been
released) -- and this has me even more concerned
and I do not want to be always scared everytime there
is a new release from AutoDesk.
I know there's got to be an easy solution to this
but right on the top of my head this one has me
stumped.
Please guide me. Thank you for all the kind help you
can give me in this regard.
Matt
Try using Late Binding for Autocad and Map. This way you don't reference
any acad libraries in your exe project. You may still run into problems if
changes are made to certian method/properties between API versions.
Example of late binding for AutoCAD.
Dim acad as Object
Set acad = GetObject(, "AutoCAD.Application.16")
you can use error trapping to look for specific versions.
On Error Resume Next
Set acad = GetObject(, "AutoCAD.Application.16") '2004
If Err Then 'no instance of 2004 is running - look for 2005
Set acad = GetObject(, "AutoCAD.Application.16.1") '2005
If Err Then ' you get the idea....
You can also use CreateObject if you can't find an instance that is running.
Set acad = CreateObject("AutoCAD.Application.16")
If Err Then '2004 not installed on machine
Set acad = CreateObject("AutoCAD.Application.16.1")
Hope That Helps,
Scott
"matt_1ca" <nos...@address.withheld> wrote in message
news:3294836.111058480...@jiveforum1.autodesk.com...
Thank you very much for your suggestion.
I have changed my code based on the Late Binding concept you mentioned I think it should work as both AutoCAD Map 2004 and AutoCAD Map 2005 seem to reference a file library by the same name. I do not have access to the machine right now with only the Map 2005 on it until after the weekend -- so I will not be able to test the code there -- but I think it would work -- thank you again.
Matt
Fresh from the weekend -- first thing I did was try it on the laptop as soon as I got to the office --- voila, yooohoooo it did work!!!
Thank you very much,
Matt