Hello:
I am writing a vb.net app that needs to work with both regular AutoCAD 2011 and also Civil 3D 2011. To keep things simple I would really like to avoid having to maintain two separate versions of the code.
If I do this, will the Civil 3D references cause issues when the program is run in regular AutoCAD (without Civil 3D installed), or will they quietly be ignored unless a command is used that requires them?
Thanks
Dale
AFAIK, that wouldn't be possible.
What are you trying to do? If your app only uses plain Autocad functionallity then it will work on both platforms, if does call Civil3D functionallity then you might possibly get around the problem with late binding your references after you detect if Civil3D is installed (don't know this for a fact but I've done this with other non-Autodesk applications).
Hi Michael:
I think your suggestion using late binding might work. I want my utility to work with basic autocad geometry like lines, arcs and polylines, and if the user is running Civil 3D, I want it to work with parcels as well. I've added the Civil 3D references and it seems to run okay on a machine with only AutoCAD installed, as long as I don't try to access any Civil 3D objects. I was hoping to see if anyone else has done something similar which would back up my own findings.
Dale
Are you running external to Acad (through COM) or internal via NETLOAD?
I believe either way you can use the Application.GetInterfaceObject method to see if Civil3d is installed.
Once you get a reference to the Acad application you can see if GetInterfaceObject("AeccXUiLand.AeccApplication.8.0") returns a value (8.0 is C3D 2011, 7.0 is C3D 2010).
You should throw a Try Catch around the attempt to handle any exception.
Since you posted in the .NET forum, rather than the VBA/ActiveX forum, I assume you were talking about managed APIs, not COM.
With COM it's quite different, and you might get some additional advice in the aforementioned forum or the Civil3D customiization forum.
Actually, I'm trying to make the entire app a managed app, however, Civil 3D is not yet fully converted over to .net api yet.