autocad dxf 文件在 opengl/opengl es 中显示

发布于 2024-09-17 17:27:48 字数 302 浏览 12 评论 0原文

我想知道是否有一种方法可以从 autocad .dxf 文件中提取必要的数据,以便我可以在 opengl 中可视化结构?

我发现了一些用 cpp 编写的 Windows 旧代码片段,但由于标准发生了变化,我认为 15 年前的代码有点过时了。

另外,还有一本关于 .dxf 文件标准的书,但也是 90 年代的书,除此之外,很少可用。

另一种方法可能是将其转换为其他文件格式,然后提取我需要的数据。

尝试查看 .dxf 文件也没有提供太多见解,因为一个简单的长方体已经包含大量数据!

谁能给我提示如何解决这个问题?

I'm wondering if there is a way to extract the necessary data out of an autocad .dxf file, so I can visualize the structure in opengl?

I've found some old cold snippets for windows written in cpp but since the standard changes I assume 15 yr old code is a little outdated.

Also, there is a book about the .dxf file standard but it's also from the 90's and aside that, rarely available.

Another way might be to convert it to some other file format and then extract the data I need.

Trying to look into the .dxf files didn't give too much insight either since a simple cuboid contains a lot of data already!

Can anyone give me hint on how to approach this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无敌元气妹 2024-09-24 17:27:48

这些参考资料是一个很好的起点,但如果您正在进行繁重的 3D 工作,则可能无法完成您正在尝试的任务。

我们最近完全基于这些参考资料用 JAVA 编写了一个 DXF 转换器。尽管许多实体相对简单,但许多其他实体(3DSOLID、BODY、REGION、SURFACE、Swept Surface)实际上不可能转换,因为参考文献指出这些组主要是专有数据。其他对象(拉伸曲面、旋转曲面、扫掠曲面(再次))具有大量二进制数据,其中可能包含您需要的重要信息。

这些实体对于我们的工作并不重要,但如果您希望转换为 OpenGL,这些实体可能是您特别关心的实体。

The references are a good place to start, but if you are doing heavy 3D work it may not be possible to accomplish what you are attempting..

We recently wrote a DXF converter in JAVA based entirely on the references. Although many of the entities are relatively straightfoward, many other entities (3DSOLID, BODY, REGION, SURFACE, Swept Surface) are not really possible to translate, since the reference states that the groups are primarily proprietary data. Other objects (Extruded Surface, Revolved Surface, Swept Surface (again)) have significant chunks of binary data which may hold important information you need.

These entities were not vital for our efforts, but if you are looking to convert to OpenGL, these may be the entities you were particularly concerned with.

段念尘 2024-09-24 17:27:48

Autodesk 有 DXF 的参考 AutoCAD 最新版本使用的格式。不过,我可能会再看一下 15 年前的代码。即使您不能/不按原样使用它,它也可能提供一个不错的起点。 DXF 规范足够庞大和复杂,从某些开始,只需在需要的地方添加新的片段即可提供很大帮助。作为一种交换格式,DXF 无论如何都必须相当保守,只包含基本上所有程序都可以合理直接解释的元素。

我可能更关心代码本身而不是 DXF 格式的变化。许多旧代码使用深层的、单一的类层次结构,这与您在现代 C++ 中所期望的有很大不同。

Autodesk has references for the DXF formats used by recent revisions of AutoCAD. I'd probably take a second look at that 15 year-old code though. Even if you can't/don't use it as-is, it may provide a decent starting point. The DXF specification is sufficiently large and complex that having something to start from, and just add new bits and pieces where needed can be a big help. As an interchange format, DXF has to be pretty conservative anyway, only including elements that essentially all programs can interpret reasonably directly.

I'd probably be more concerned about the code itself than changes in the DXF format. A lot of code that old uses deep, monolithic class hierarchies that's quite a bit different from what you'd expect in modern C++.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文