Hi,
i can determine the installed Version with:
Autodesk.AutoCAD.Runtime.SystemObjects.DynamicLinker.ProductKey="Software\Autodesk\AutoCAD\R18.1\ACAD-9000:407"
but this key is also by running Civil as AutoCAD.
How i can determine between "Civil" and "Civil runing as AutoCAD" ?
regards Mario
Solved! Go to Solution.
Solved by mario.rosenbohm. Go to Solution.
Hi,
try to connect to any AECC-based lib, if you get an error it's the wrong profile for useing any Civil-API
Quick&dirty to check the availability of Civil-API:
Dim tCivilAPI_active as Boolean = false Try
Dim tActiveX_ProgID as String = "AeccXUiLand.AeccApplication.9.0" 'use your version-nr Dim tObj As Object = pAcadAppCOM.GetInterfaceObject(tActiveX_ProgID) tCivilAPI_active = (tObj IsNot Nothing) 'TODO release the COM-object here Catch ex As Exception tCivilAPI_active = false 'just to make sure End Try
- alfred -
Hi alfred,
;-( ... dont work for me.
pAcadAppCOM.GetInterfaceObject("AeccXUiLand.AeccApplication.8.0") (Civil3d 2011) is never null (c# for Nothing).
even with the official start parameters Civil3D as AutoCAD "/ P AutoCAD"
Hello,
i have found a solution that works fine.
If someone has a diferent version he can post so times.
regards Mario
public static Boolean isCivilRunning() { Boolean result = false; try { foreach (System.Reflection.Assembly item in AppDomain.CurrentDomain.GetAssemblies()) { if (item.FullName.StartsWith("AeccUiWindows")) { result = true; break; } } } catch { // return false; } return result; }
@Mario,
First of all, thanks... but, this is not reliable for me .
I don't know CIVIL but I suppose it is exactly like MECHANICAL.
What you can try is :
- Start AutoCAD, in <<VANILLA>> profile.
- Change the profile to your <<CIVIL>> one.
- Your code will say: "Civil is running" , but If you try manually to use a CIVIL command, you will get something like "unknown command" .
You know, when you develop an application that has to be deployed on thousands of computers and used daily by many users all over the world, you must be prepared to evrything 😉
@Alfred
As I said previously, even with a "Try... Catch", you can sometimes get a fatal error on the GetInterfaceObject.
That's why we are looking to be sure, BEFORE, to be in the correct release.
Regards,