学习 CAD/CAE 文件格式的起点?
我们大学正在开发一些应力应变分析软件。 现在是时候从矩形、盒子和球体转向一些真实的模型了。 但我仍然不知道从哪里开始。
在我们的软件中,我们将构建网格然后进行计算,但如何从 CAD/CAE 软件导入实体?
1) CAD/CAE 模型如何组织?实体如何表示? DWG、DXF、IGES、STEP 格式有哪些可能性? 例如,有完整的 DXF 参考,但在不了解基本概念的情况下,我很难理解。
2) 是否有 C++ 库可以从 CAD/CAE 文件格式导入实体? 构建完整的模型以导入综合文件会不会太困难?
We are developing some stress and strain analysis software at university. Now it's time to move from rectangles and boxes and spheres to some real models. But I still have little idea where to start.
In our software we are going to build mesh and then make calculations, but how do I import solid bodies from CAD/CAE software?
1) How CAD/CAE models are organised? How solid bodies are represented? What are the possibilities of DWG, DXF, IGES, STEP formats? There is e.g. a complete DXF reference, but it's too difficult for me to understand without knowing basic concepts.
2) Are there C++ libraries to import solid bodies from CAD/CAE file formats? Won't it be too difficult to build a complete model to be able to import comprehensive file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
要导入实体,您首先需要从 CAD 系统中导出它们。 大多数 CAD 系统数据文件都是专有的(除非在我离开这个行业的几年里它们全部转移到 XML!)。 DWG 是 Autodesk 的文件格式,他们不(确实不)鼓励人们直接阅读它。 如果没记错的话,他们确实提供了一个文件读/写库,但我不知道现在是什么状态。 DXF、IGES 和 STEP 都是数据传输格式。
DXF 归 Autodesk 所有,但已发布,以便其他公司可以使用它来读取和写入模型。 DXF 参考很复杂,但只是一个参考 - 您需要先了解概念,然后才能理解它代表什么。
实体模型可以通过多种方式表示,可以通过构造实体几何 (CSG) 来表示,其中形状是通过实体图元彼此相加或相减而构成的,也可以通过边界表示 (B-Rep) 来表示,其中边缘是存储,或通过三角面(如 3D Studio MAX、WPF 和许多其他应用程序所使用的)等等。 特定的格式将取决于建模器的设计目的。
有用于读取各种文件格式的库和工具。 我不知道哪些仍然活跃,因为距离我深入参与 3D 图形已经 5 年多了。 您最好自己寻找当前的作物。 我建议从 Wikipedia 开始 - 它将有一些关于 3D 图形的文章,并且应该有大量的进一步阅读和工具/库的链接。
一旦您有了阅读器,您就需要将数据转换为您的内部格式 - 这不是一项简单的任务。 采用现有格式可能会更好。 我的工作之一是将各种来源的模型读取到我公司的数据结构中。 我的任务得到了很大的帮助,因为我们支持的建模者带有 API,可以让我们直接读取模型网格,从那里将他们的网格转换为我们的网格是一个相对简单(但绝非易事)的任务。 总是存在一些令人头疼的边缘情况和格式的细微差别。 如果我们必须自己读取文件格式(例如 DXF 或 VRML),则这些数据会成倍增加。
To import solid bodies you first need to export them from the CAD system. Most CAD system datafiles are propriety (unless they've all moved over to XML in the few years I've been out of the industry!). DWG is Autodesk's file format and they don't (well didn't) encourage people to read it directly. They did offer a file reading/writing library if memory serves, but I don't know what the state of that is now. DXF, IGES and STEP are all data transfer formats.
DXF is owned by Autodesk but is published so other companies can use it to read and write models. The DXF reference is complicated, but is just a reference - you need to know the concepts before you can understand what it represents.
Solid models can be represented in a number of ways, either by Constructional Solid Geometry (CSG) where the shape is made up from the addition or subtraction of solid primitives from each other, or by Boundary Representation (B-Rep) where the edges are stored, or by triangulated faces (as used by 3D Studio MAX, WPF and many others) and so on. The particular format will depend on what the modeller is designed to do.
There are libraries and tools for reading the various file formats. I don't know which ones are still active as it's 5+ years since I was heavily involved in 3D graphics. You'd be better off searching for the current crop yourself. I'd recommend starting with Wikipedia - it will have some articles on 3D graphics and there should be plenty of links to further reading and tools/libraries.
Once you have a reader you'll need to convert the data to your internal format - not a trivial task. You might be better off adopting an existing format. One of my jobs was the reading of models from various sources into my company's data structure. My task was greatly helped by the fact that the modellers we supported came with API's that let us read the model meshes directly and from there it was a relatively straightforward (but never easy) task to convert their mesh into ours. There were always edge cases and nuances of the format that caused headaches. These were multiplied several times over if we had to read the file format ourselves - such as for DXF or VRML.
当前 3D CAD 软件(CATIA、Pro/Engineer/Solidworks/NX)中实体模型最常见的表示方式是通过边界表示 (B-REP)。
然而,大多数导入此类 CAD 数据的库都是专有的。 有些库直接来自几何建模器(例如带有 Interop、Parasolid 或 Granite 的 ACIS),其他库则来自专门从事 CAD 数据转换市场的小型软件公司。
在开源方面,也许可以看看 OpenCascade 内核。 该内核(大部分)已开源,并且具有一些 STEP 导入和网格划分功能。
The most common way solid models are represented in current 3D CAD software (CATIA, Pro/Engineer/Solidworks/NX) is through Boundary Representation (B-REP).
However, most of libraries to import such CAD data are proprietary. Some libraries come directly from geometric modelers (such as ACIS with Interop, Parasolid, or Granite), other are from small software companies specialized on the CAD data translation market.
On the open source side, maybe have look at the OpenCascade kernel. This kernel have been open sourced (mostly), and it have some STEP import and meshing functionalities.
最好的选择是使用现有的开源 CAD 系统,例如 BRL-CAD,它支持众多导入程序和出口商。
您的直觉是,学习给定的格式将难以理解和实现支持,这是非常正确的,特别是在处理用于分析目的的实体几何格式时。 通过拓扑保证保持可靠性对于生成有效的分析非常重要,但很少通过简单的网格格式来解决。
特别是对于两个流行的国际标准(IGES 和 STEP),它们的支持过于复杂,因为它们可以包含以多种方式编码的相同实体几何形状。 考虑一个简单的球体示例。 该球体可以编码为简单的点和半径(没有显式表面信息,这是 CSG 使用中常见的隐式形式),它可以是多边形网格(有损 BREP 小平面网格格式),它可以是样条曲面(BREP NURBS ),它可以是体积的(想想 CT 扫描数据),等等。 专注于其中任何一项都涉及各种权衡(简单性、可靠性、分析保证、灵活性等)。
正如关于 BRL-CAD 所提到的,它是一个大型开源实体建模系统,在您可以利用的许多领域都有大量功能,大约有十几个功能库和 400 多个简洁的工具(大约有两打是几何转换器)。 即使它没有完全满足您的需求,您也拥有源代码,可以贡献改进并与现有社区协作,以帮助实现您的需求。
Your best bet is to work with an existing open source CAD system, such as BRL-CAD, that includes support for numerous importers and exporters.
Your intuition that learning a given format would be difficult to understand and implement support for is quite true, particularly when dealing with solid geometry formats intended for analysis purposes. Preserving solidity with topological guarantees is important for producing valid analyses, but rarely addressed by simple mesh formats.
In particular for the two prevalent international standards (IGES and STEP), they are excessively complex to support as they can contain the same solid geometry encoded in numerous ways. Consider a simple sphere example. That sphere could be encoded as a simple point and radius (with no explicit surface information, an implicit form common with CSG usage), it could be a polygonal mesh (lossy BREP facets mesh format), it could be a spline surface (BREP NURBS), it could be volumetric (think CT scan data), and more. Focusing on any one of those involves various tradeoffs (simplicity, solidity, analytic guarantees, flexibility, etc).
As mentioned regarding BRL-CAD, it's a large open source solid modeling system that has a lot of functionality in many areas you could leverage, about a dozen libraries of functionality and more than 400 succinct tools (two dozen or so being geometry converters). Even if it doesn't do exactly what you need, you have the source code and can contribute improvements back and collaborate with an existing community to help implement what you need.
重新阅读你的问题后,让我彻底改变我的答案。 如果您只需要网格,那么只需使用简单的基于网格的格式即可。
OBJ简单,好,而且非常标准。 从许多 CAD 格式到 OBJ 的转换需要一个 tessellator/meshher,无论如何您都不想编写它,只需使用 CAD 包来进行转换即可。 Moi 或 Rhino 成本低廉,并且支持多种格式。
Upon re-reading your question, let me completely change my answer. If you all need is meshes, then just use a simple mesh-based format.
OBJ is simple, good, and very standard. Conversion from many CAD formats to OBJ requires a tessellator/mesher, which you don't want to be writing anyway, just get a seat of a CAD package to do the translation. Moi or Rhino are low-cost, and support many formats.
我经常使用一款商业电磁仿真软件,该软件使用 ACIS 建模内核和 Simmetrix 的组件。 虽然我无法亲自证明这些库的易用性,但它们似乎确实像宣传的那样工作,并且可以为您节省大量工作。 它们可能不适合学术用途,但它们似乎确实是为了满足您的需求而设计的。
I regularly work with a piece of commercial software for electromagnetic simulations that uses the ACIS modeling kernel and components from Simmetrix. While I can't personally attest to the ease of using those libraries, they do seem to work as advertised and could save you a lot of work. They may not be available on suitable terms for academic use, but they do seem to be designed to do exactly what you want.
据我所知,所有 CAD/CAE 软件都支持 IGES、STEP 等几何和想法文件格式,以及网格数据的 Anysis 等。 大多数时候,我们发现 iges 不包含拓扑信息。 但STEP(产品交换标准)的开发始于1984年,作为IGES的后继者。最初的计划是“STEP应基于一个单一的、完整的、独立于实现的产品信息模型,该模型应是主模型”。集成主题和应用信息模型的记录”。 我们有一些库来读取和写入这些文件格式。 但是,当我编写代码来读取和写入几何图形以及网格时,读取或写入这些文件格式并不困难,但很无聊。
As for i know, all of CAD/CAE softwarea support IGES, STEP etc file formats for geometry and ideas, anysis etc for mesh data. Most of time, we find that iges does not contain topological information. But the development of STEP(Standard for the Exchange of Product) started in 1984 as a successor of IGES.The initial plan was that "STEP shall be based on one single, complete, implementation-independent Product Information Model, which shall be the Master Record of the integrated topical and application information models". We have some libraries to read and write these file format. But as i wrote code to read and write geometries as well as mesh, reading or writing these file formats is not difficult, but alot boring.