PR link: https://github.com/FreeCAD/FreeCAD/pull/4752
This is the first batch of patches for the new Topological Naming. It introduces a few new classes, and some new APIs for existing classes (mostly in ComplexGeoData, TopoShape, and various Property links with sub names). There is also some new features introduced in Base::Reader and Writer, for more efficient embedding of arbitrary binary and unicode text inside XML file, which is required for topo naming persistence. These Reader and Writer changes are also the precursor for supporting saving FreeCAD document as an uncompressed directory. I'll submit a separate PR for that later.
For an overview of new APIs (excluding TopoShape), please check out the wiki article here
. These APIs are for storing, retrieving, and updating user defined text based topological names for index based geometry elements. The actual implementation is changed a bit since the article is written, but the basic idea still remains. The current implementation makes considerable effort to reuse existing topological names for speed and compact storage.
For the actual topological naming algorithm, i.e. how the text based names are generated, please check out the article here
. Again, due to the aforementioned changes, the actual text of topo names is different. The algorithm largely remains the same.
There is one important factor that is not mentioned in either of the articles is the fact that the new topo naming is rather sensitive to the modeling algorithm, e.g. whether to cut first and then fuse, or the other way round. It also depends on how OCCT reports the generated and modified shapes. This means potential problems on name stability with each OCCT version and FC modeling code changes. This problem was eventually solved by using geometrical search. A new API, Part::Geometry::isSame() is added for comparing two geometries, either surface or curve, and another API TopoShape::searchSubShape() to look for an unrelated sub shape among sub shapes of a given OCC shape that has the exact same location and geometry. Before a recompute happens for any geometrical object, it will store all referenced geometry elements (i.e. sub shapes referenced by various property links), and perform a search after recompute for each missing elements (due to topo naming changes). This is based on the assumption that the changes in OCCT and FC modeling code will try best to make sure to produce the exact same shape.
The current PR only introduced the framework. No actual modeling code uses the framework yet. So there isn't much you can test. There will be at least three more follow up PRs, one for Sketcher, one for Part (i.e. make use of the framework in various Part features), and finally PartDesign. I have already prepare the branch TopoNamingSketch
, and TopoNamingPart
, which contain the future PR for Sketcher and Part. These two PRs can be applied independently with each other. I have made a merged branch TopoNamingSketchPart
for those who want to test it before hand. All features in Part workbench should be working there.
The final PartDesign changes contains quite a few other changes in visual and modeling. I may split it further if necessary.