AutoCAD 与 JAVA 的接口
关于通过 JAVA 程序与 AutoCAD 交互的任何想法。 我正在寻找一种可以直接与 AutoCAD 会话交互(甚至启动会话)的解决方案,就像它与 AutoCAD 的 .NET 扩展一起工作一样。 或者通过 JAVA 使用 ObjectARX 的任何方式,绝对不是在其上编写完整的 JNI 包装器。
补充:我们正在寻找开源的东西。 如果没有,如果有人可以伸出援手解释如何做到这一点,我们准备以开源方式创建一个。 我们已经了解了 JNA 和 JaWin。 JNA 与 JNI 结合可能会有所帮助,但太丑陋了。 另一方面,JaWin 在过去 4 年里没有更新,所以对它的使用持怀疑态度。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我唯一能想到的就是使用 Java <-> .Net 桥接器,例如 JNBridge。 我在其他场景中使用过它并且效果很好。 但从未使用过 Java 和 AutoCad 进行过任何工作,因此可能还有其他更便宜的解决方案。
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.
如果您尝试与 AutoCAD 应用程序交互,您将遇到困难。
如果您想与 dwg 文件本身进行交互,可以使用开放设计联盟,该联盟提供的库允许在不使用 AutoCAD 的情况下处理 dwg 文件。
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.
您可以尝试使用 JavaBeans ActiveX 桥和 COM 自动化来打开 AutoCAD 并对其进行操作。
也就是说,JavaBeans ActiveX 桥已经有一段时间没有发展了(我在 2003 年就使用过它),并且 Autodesk 正在认真投资 .Net,以实现与 AutoCAD 中的扩展和自动化相关的所有内容。
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.
我们正在开展一个类似的项目。 我们正在做的是用 C# 编写集成代码,并用 Java 编写项目的业务逻辑。
我们正在利用一个 C++ 桥,它利用 JNI 将 Java 调用转换为 C++,然后将它们转换回 C#,反之亦然。 每个需要从 C# 到 Java 的功能都必须在桥接代码中实现。 这相当复杂,并且使非托管 C++ 代码与 C# 一起工作存在一些问题,以及将 Jstring 转换为 C# 字符串等的标准开销。 在我们做了一些优化以确保我们不会在每次调用 Java 层时启动和停止 JVM 之后,结果相对较快。
我们之前使用由 AutoCAD 插件调用的 COM 对象,因此这是另一种方法。
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.
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 that would be another approach.