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

查看:21
本文介绍了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.JNA 与 JNI 结合可能会有所帮助,但太丑了.另一方面,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# 一起工作以及将 Jstring 转换为 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.

我们之前使用的是由 AutoCAD 插件调用的 COM 对象,因此这是另一种方法.

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

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

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