From AAG to A CAD file

nadjei

Looking around for some CAD
So I know with a software like Analysis Situs, I can construct an AAG of a CAD file and dump it in a JSON file. I wan to know if there is a way, we can extract the CAD file back from the AAG. Can I use the Analysis Situs Software for that, or there is another way I can go about it?
 

Quaoar

Administrator
Staff member
AAG is a supplementary data structure that does not entirely substitute your shape. Think of it as another kind of hashmap, whatsoever. Normally, we output AAG together with the shape after processing, so that you can match the AAG indices with the face indices from the model.

If you elaborate more on what you're trying to do, it might help to provide a sensible answer.
 

nadjei

Looking around for some CAD
My goal is to be able to have a sort of neutral based representation of A cad model like the json format Analysis Situ software gives me when I create a an AAG or HAG. The goal is to be able to extract the CAD file back from the Json format. So something like
CAD file --> neutral representation ---> CAD file. If you know of anyway I can do that, I will be grateful.
Thanks.
 

nadjei

Looking around for some CAD
Additional info: Final goal is to be able to perform operations on the neutral representation and it will be successfully reflected in the CAD file produced from it.
 

Quaoar

Administrator
Staff member
The goal is to be able to extract the CAD file back from the Json format. So something like
CAD file --> neutral representation ---> CAD file
AAG does not store the geometry of a part. In principle, the geometry can be serialized using the BinTools package of OpenCascade, but it will be nothing different from the BREP format, which you can save your model in (just a binary version of it). In our applications, we keep geometry separately from AAG/JSON in STEP format or, if performance is of a major concern, in XDE/XBF format.
 

nadjei

Looking around for some CAD
Thank you very much. I will look into each of them and see which one I can work with. If you also have suggestions on which one I can easily perform operations on, particularly geometrical and topological operations, please let me know.
 

Quaoar

Administrator
Staff member
If you also have suggestions on which one I can easily perform operations on, particularly geometrical and topological operations, please let me know.
All the formats mentioned just give you a tool for persistent storage of B-rep data. You can store your shape (exported in BREP/XBF) on the filesystem or as a BLOB record in a database, but to be able to "perform operations," you'll have to read it back to memory. The reason these formats are better than STEP files is because you wouldn't need to rebuild the B-rep structures when you read them. It's more like a hibernation of the existing geometry that no other application except yours (OpenCascade-based) would be able to read. And because the shape is just restored and not remodeled (like when you read a STEP/IGES file), reading such BREP/XBF files back will be way faster than reading any other format.
 

nadjei

Looking around for some CAD
Quaoar,
Thanks for the explanation but my end goal is not about storage of data. My goal based on my research is to be able to have total control over my design. What I mean is, to have that access of being able generate multiple designs from one design. So if I have that control like let us say something as simple as a box with a hole in it, where I have the ability to generate more designs by modifying the radius of the hole but making sure the dimension of the hole does not exceed the size of the box.
If my project was as simple as that, maybe I will be able to use PythonOCC to build the entire thing from the ground up and be running a simple for loop to be doing that for me, but the CAD files I work on are more complex like the hood frame of a vehicle. So I need to use a CAD software to build it, then find another way of breaking it down so I can perform these geometric operations on it to generate new designs which I will then run a performance check on. So it is kind of like a generative design thing. Please I hope you get my point.
You seem knowledgeable about these stuffs so if you think there is a better way to go about it based on what I have told you I am open to any suggestions you might have.
Thanks in advance and sorry if I am asking too much questions.
 

Quaoar

Administrator
Staff member
No need to be sorry; asking questions and sharing experiences is exactly what this forum is all about.

What you're saying sounds like parametric optimization to me. I don't have much experience on this subject other than participating in the IODA project. In any case, I don't think that AAG or HAG would be of any help to you, as these data structures are used for different purposes. AAG is essentially a topology graph to make face adjacency relations in a part more explicit. HAG is nothing but a useful abstraction over assemblies that helps to understand how they are put together.

You mentioned that your question has arisen due to your research. Do you have any research papers to read?

So I need to use a CAD software to build it, then find another way of breaking it down so I can perform these geometric operations on it to generate new designs which I will then run a performance check on.
Is it a requirement that the CAD design comes from another system that you cannot control? Starting from a "dumb" model without a feature tree is quite a strict requirement, as you basically lose control over your shape. To my understanding, in the CFD community, people try to build parametric models bottom-up, e.g., with TiGL or in systems like CAESES, as otherwise design variations would either be impossible or wouldn't satisfy the imposed design intent (like in the case with FFD techniques).
 

nadjei

Looking around for some CAD
No, it is not a requirement to use CAD design system. My thinking was that it would make my job easier in creating the base design. For papers what I am reading right now is that of my supervisor's but his work started in Solidworks so it was more of a Variant designs. This is a paper he wrote "Ramnath, Satchit, et al. "Automatically generating 60,000 CAD variants for big data applications." I have read other papers but none so far has really helped me on how to start. I am open to any suggestions on papers if you have any
 

Quaoar

Administrator
Staff member
The one you refer to seems to be publicly available as a pre-print, so I'm posting the link here: Ramnath, S., et al. Automatically Generating 60 , 000 CAD Variants for Big Data Applications. I see Jami Shah among the authors, his papers helped me a lot back in the days.

From what I understand, their idea is to generate a massive amount of CAD designs to use them for training ML networks later on. We have had a similar project with one Japanese company back in my OCC days. It was related to simple prismatic designs for predicting heat propagation over electronic components. The approach we took was to generate "families" of CAD parts as parametric models bottom-up. For that, we implemented a bunch of C++/Tcl procedure (the language does not matter) worked pretty much as black boxes: you specify the input parameters and get back your solid geometries. All manufacturability and design constraints were baked into these functions, so we did not need to further validate them geometrically.

Then, if you have access to a commercial CAD package, you can potentially use that software (its API) to put together a design generator similarly how those guys used Catia in the paper. Isn't it an option for you?
 

nadjei

Looking around for some CAD
You mean using CAD packages to create scripts that will be varying the parametrized model? So In your opinion, you think that will be much easier and efficient than let's say using PythonOCC to build everything from the ground up like the Bottle tutorial in OCC?
In your project, did you build a nominal parametric part or feature using a CAD software before using the C++ procedure for generating multiple designs?
 

Quaoar

Administrator
Staff member
You mean using CAD packages to create scripts that will be varying the parametrized model?
Yes, that's pretty much what comes to mind when you say "design variants." You can start with a baseline geometry, which has to be a parametric function, and then disturb its parameters in a meaningful way. Such a parametric function is pretty much a "black box," where it does not matter if you use C++ dark magic plus OpenCascade or just expensive Catia: as long as you can export the results to a STEP file whatsoever, the mechanics of model generation is not important.

So In your opinion, you think that will be much easier and efficient than let's say using PythonOCC to build everything from the ground up like the Bottle tutorial in OCC?
You know, there is this "Bottle tutorial" and then there's real life. If I were in your shoes, I would probably have started with a "proof of concept" to see if OpenCascade can even model the geometry that you're up to. Even without any parameters. Because if you are designing a frame assembly for a car, then I would suppose it would contain many sheet metal parts, probably with tricky geometries. You should have a clear idea of how to model them all: how you constraint a sketch, in which direction you thicken the model, where you drill holes, and so on. If you manage to build the baseline geometry with OpenCascade, then you can move on and parameterize it. If OpenCascade fails, then you know that a commercial CAD package is your only way through.

In your project, did you build a nominal parametric part or feature using a CAD software before using the C++ procedure for generating multiple designs?
Nope, we used OpenCascade alone, but we clearly understood that if we don't use it, then we don't get the project (because the customer wanted to have it done in an open source modeler). At the same time, our models were fairly simple, so we were confident they were realizable with the kernel we had.
 
Last edited:

nadjei

Looking around for some CAD
I spoke with my advisor yesterday and he said I should try OpenCascade first on primitive shapes to see how how difficult is going to be. So I will use PythonOCC to try it out for now.
 
Top