6

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?

4

6 回答 6

7

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.

于 2009-06-21T17:10:33.123 回答
4

当前 3D CAD 软件(CATIA、Pro/Engineer/Solidworks/NX)中最常见的实体模型表示方式是通过边界表示 (B-REP)。

但是,大多数导入此类 CAD 数据的库都是专有的。一些库直接来自几何建模器(例如带有 Interop、Parasolid 或 Granite 的 ACIS),其他库则来自专门从事 CAD 数据翻译市场的小型软件公司。

在开源方面,也许看看 OpenCascade 内核。这个内核(大部分)是开源的,它有一些 STEP 导入和网格划分功能。

于 2010-03-20T17:55:27.657 回答
3

最好的办法是使用现有的开源 CAD 系统,例如BRL-CAD,它包括对众多进口商和出口商的支持。

您认为学习给定格式将难以理解和实现支持的直觉是非常正确的,尤其是在处理用于分析目的的实体几何格式时。通过拓扑保证来保持实体性对于产生有效的分析很重要,但很少通过简单的网格格式来解决。

特别是对于两个流行的国际标准(IGES 和 STEP),它们过于复杂而难以支持,因为它们可以包含以多种方式编码的相同实体几何。考虑一个简单的球体示例。该球体可以编码为一个简单的点和半径(没有显式表面信息,这是 CSG 使用中常见的隐式形式),它可以是多边形网格(有损 BREP 刻面网格格式),它可以是样条曲面(BREP NURBS ),它可能是体积的(想想 CT 扫描数据)等等。专注于其中任何一项都涉及各种权衡(简单性、可靠性、分析保证、灵活性等)。

正如关于 BRL-CAD 所提到的,它是一个大型开源实体建模系统,在您可以利用的许多领域具有很多功能,大约十几个功能库和 400 多个简洁工具(大约两打是几何转换器)。即使它不能完全满足您的需求,您也拥有源代码,并且可以回馈改进并与现有社区协作以帮助实现您的需求。

于 2009-06-21T18:58:05.723 回答
2

重新阅读您的问题后,让我完全改变我的答案。如果您只需要网格,那么只需使用简单的基于网格的格式。

OBJ 很简单,很好,也很标准。从许多 CAD 格式转换为 OBJ 需要一个 tessellator/mesher,无论如何您都不想编写它,只需获得一个 CAD 包的座位来进行翻译。Moi 或 Rhino 成本低,支持多种格式。

于 2009-08-18T19:40:48.963 回答
1

我经常使用一款用于电磁仿真的商业软件,该软件使用 ACIS 建模内核和Simmetrix的组件。虽然我无法亲自证明使用这些库的便利性,但它们似乎确实像宣传的那样工作,可以为您节省大量工作。它们可能不适用于学术用途,但它们似乎确实是为了满足您的需求而设计的。

于 2009-08-18T19:56:32.473 回答
0

据我所知,所有的 CAD/CAE 软件都支持 IGES、STEP 等文件格式的几何和想法,以及网格数据的 anysis 等。大多数时候,我们发现 iges 不包含拓扑信息。但作为 IGES 的继承者,STEP(产品交换标准)的开发始于 1984 年。最初的计划是“STEP 应基于一个单一的、完整的、独立于实施的产品信息模型,该模型应为主集成主题和应用信息模型的记录"。我们有一些库来读写这些文件格式。但是当我编写代码来读取和写入几何图形以及网格时,读取或写入这些文件格式并不困难,但很无聊。

于 2009-09-20T10:59:54.833 回答