views:

1191

answers:

5

Any idea on interfacing with AutoCAD through a JAVA program. I am looking for a solution that can directly interface with an AutoCAD session (even start one), the way it works with the .NET extensions of AutoCAD. Or any way to work with ObjectARX through JAVA, definitely not writing a complete JNI wrapper over it.

Added: We are looking for something in open-source. In case there is none, we are ready to create one in open-source if someone can lend a helping hand explaining how it can be done. We have taken a look at JNA and JaWin. JNA clubbed with JNI might help but is too ugly. JaWin on the other hand has not been updated in the past 4 years, so sort of skeptical using it.

A: 

The only thing I can think of is to use a Java <-> .Net bridge like JNBridge. I've used this in other scenarios and it works fine. Never done any work with Java and AutoCad though so there might be other cheaper solutions.

willcodejavaforfood
Thanks, but JNBridge is a commercial implementation. Second, going from Java to .NET to ARX to AutoCAD is gonna slow down things a lot. :(
Sandy
Sorry mate best I could do :)
willcodejavaforfood
Don't be sorry - Thanks a lot for the suggestion. Infact, we are now thinking of working to bridge this gap in open source. Any takers?
Sandy
+2  A: 

If you are trying to interact with the AutoCAD application you will have a tough time. If you want to interact with the dwg files themselves there is the Open Design Alliance which has libraries that allow working with dwg files without AutoCAD.

mohnston
Thanks - we are indeed looking at a way to interfacing with AutoCAD application :(
Sandy
+2  A: 

You can try to use the JavaBeans ActiveX bridge and the COM Automation to open AutoCAD and manipulate it.

That said, JavaBeans ActiveX bridge hasn't evolved in a while (I used it back in 2003) and Autodesk is seriously investing in .Net for everything related to extensions and automation in AutoCAD.

Fabio de Miranda
A: 

We are working on the a similar project. What we are doing is writing the integration code in C#, and the business logic for our project in Java.

We are utilizing a C++ bridge that utilizes JNI to take Java calls down to C++, and then translates them back up to C#, and vice versa. Each function that needs to go from C# to Java has to be implemented in the bridge code. This is fairly involved, and there are some issues with getting the unmanaged C++ code to work with the C#, as well as the standard overhead of translating Jstrings into C# Strings and the like. The result is relatively fast, after we did some optimizations to insure that we aren't starting and stopping the JVM for each call into the Java layer.

We previously used COM objects which were called by the AutoCAD plugin, so this would be another approach.

Knyphe
A: 

I met the same problem

karl