Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting point for learning CAD/CAE file formats?

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?

like image 601
Escader Avatar asked Jun 21 '09 17:06

Escader


3 Answers

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.

like image 154
ChrisF Avatar answered Oct 08 '22 04:10

ChrisF


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.

like image 24
Gabriel Cuvillier Avatar answered Oct 08 '22 04:10

Gabriel Cuvillier


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.

like image 3
brlcad Avatar answered Oct 08 '22 05:10

brlcad