AutoCAD与JAVA的接口 [英] Interfacing AutoCAD with JAVA

查看:148
本文介绍了AutoCAD与JAVA的接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过JAVA程序与AutoCAD连接的任何想法。我正在寻找一种解决方案,它可以直接与AutoCAD会话(甚至启动一个)进行交互,它与AutoCAD的.NET扩展一起使用。或者通过JAVA使用ObjectARX的任何方式,绝对不要在它上面写一个完整的JNI包装。

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.

补充:我们正在寻找开源的东西。如果没有,我们准备在开源中创建一个,如果有人可以伸出援助之手解释如何做到这一点。我们看了JNA和JaWin。与JNI合作的JNA可能有所帮助,但太难看了。另一方面,JaWin在过去的4年里没有更新,所以有点怀疑使用它。

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.

推荐答案

我们正在努力在类似的项目上。我们正在做的是用C#编写集成代码,用Java编写项目的业务逻辑。

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

我们正在利用一个C ++网桥,利用JNI将Java调用转换为C ++,然后将它们转换回C#,反之亦然。需要从C#到Java的每个函数都必须在桥代码中实现。这是相当复杂的,并且使得非托管C ++代码与C#一起工作存在一些问题,以及将Jstrings转换为C#字符串等的标准开销。在我们做了一些优化以确保我们没有为每次调用Java层启动和停止JVM之后,结果相对较快。

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.

我们之前使用过COM AutoCAD插件调用的对象,这将是另一种方法。

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

这篇关于AutoCAD与JAVA的接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆