Modifying 3D Models with the Help of ODA SDK
In the previous article, I explained that describing 3D bodies using Constructive Solid Geometry (CSG) involves significant difficulty in modifying the shape of the bodies. Yet the need for modifications arises as design is an iterative process. The reasons for model revision are extensive: new calculations, results from prototype testing, customer feedback, design improvements, and so on. Indeed, even the transition to a different manufacturing method can require changes to the shapes of parts. For these reasons, the modeler and CAD applications should allow changes to the body shape to be made easily.
The weak point of structured geometry in CSG is its need to take into account the interdependence of all properties of all original operands of Boolean operations -- or at least some of them. This is a special task for which commercial products are available. (They are known parametric kernels but are usually used to solve different design problems.) In addition, you may have to take into account the interdependence of the parameters of the original bodies and the set itself.
Fillets, Chamfers, and Thin-walled Bodies
The operation of filleting the corners of a parallelepiped is an example of a problem where the parameters of many bodies must be changed in a consistent way.
Filleting can be considered a local operation in the sense that the modification of the body occurs near the selected edges. Operations that are used to create chamfers and thin-walled bodies can also be considered local. The chamfer operation is similar to the fillet operation, the difference being that the surface between the faces adjacent to the edges is not mated tangentially but at a specified angle.
Operations to create a thin-walled bodies are based not on edges, but on faces. One face is removed from the shell, and the remaining ones are offset by the distance specified. Afterwards, the offset faces are "glued" to the faces relative to the distance they were offset.
ODA SDK provides these methods for local modifications:
OdResult filletEdges( const OdArray<OdDbSubentId>& edgeSubentIds, const OdGeDoubleArray& radius, const OdGeDoubleArray& startSetback, const OdGeDoubleArray& endSetback); OdResult chamferEdges(const OdArray<OdDbSubentId>& edgeSubentIds, const OdDbSubentId& baseFaceSubentId, double baseDist, double otherDist); OdResult shellBody(const OdArray<OdDbSubentId>& faceSubentIds, double offsetDistance);
Note that this is an incomplete list of geometric modeling operations.
Implementing Geometric Modeling Operations in ODA SDK
Modeling itself is not the primary purpose of the ODAa platform; it is designed to work with .dwg files. So the ODA platform includes functions for creating only elementary bodies. All other operations must be sourced from third parties, and are attached to the platform through modules called “adapters.”
When it comes to 3D solid modeling, the role of adapters is to get SAT streams from files, create source bodies, execute operations with specified parameters, and then generate SAT streams of the results.
Until recently, 3D modeling operations in ODA SDK could be performed with only the ACIS geometric kernel from Dassault Systemes Spatial. The Open Design Alliance supports a module that mates ODA SDK to the ACIS kernel, but the ACIS modeler itself must be licensed by each ODA member independently.
An alternative to ACIS is to use the modeling module from C3D Labs, which can be licensed directly from ODA, in one click from member portal - you no need to sign agreements with C3D Labs, and there is no royalty - just annual fee. The functionality of C3D Modeler for ODA SDK is reduced from the original C3D Toolkit, but it's enough for most tasks of developers, and we are ready to increase it on customers requests.
As the SAT format is not native to the C3D geometric kernel (unlike ACIS), a converter must be used with the modeler. Fortunately, the process of converting input data and modeling results is hidden from ODA SDK users, and so attaching the C3D Modeler to the ODA module is sufficient to make non-trivial modeling operations available. Further, the full C3D Toolkit libraries can be downloaded from the Open Design Alliance’s server, and you can request a license key via your personal ODA account with one click. C3D Labs believes that this integrated procedure for accessing 3D modeling with ODASDK is an advantage over licensing the ACIS kernel separately.
The idea behind choosing several practical examples is to reproduce the history of the construction of a model designed in any CAD system. I came across, however, two difficulties.
Firstly, I needed to find a model old enough that it was made without using construction operations not present in ODA’s API. Or, at the very least, for there to be as few operations as possible. It can be reasonably expected that CAD developers releasing new versions of their products will provide sample files, including ones that showcase new features and functions. In this regard, the most striking example I encountered was related to extrusion “to object”.
A second difficulty was purely technical: how to clearly illustrate the "before" and "after" states for each operation in the process of construction? The main contradiction that I had to overcome was that the orientation of the model and its scale are not standard, but they must be the same before and after each operation. At the same time, to select operands of Boolean operations or, for example, edges, I need to scale or rotate the model. This may exaggerate the complexity, which arises only because of an incomplete understanding of the capabilities of the test application for the ODA platform.
Nevertheless, I was able to implement a history of model construction for two demonstrations and examples.
In addition to the modeling operation itself, the function of searching for topological objects and obtaining geometry for them was implemented for the construction of the models. With the development of the test system and the expansion of the scope of practical applications, this function was further improved.