Just to let you know the page: https://wiki.freecadweb.org/TNP_solution has been little redesigned. There is also new section:
This code above shows how to solve the example from Topological Naming Problem described at: Topological Naming Problem but exactly the same rules you can use to solve other problems. The approach is simple:
Store the key before any operation
Search for the key after operation
The specific implementation may be different. In this example the plane is XY, but you can do exactly the same for other axes. Also you can choose other key. At Woodworking project I make many operations at non-existing objects, so I had to solve the Topological Naming Problem many times.
Here I change Cube objects into PartDesign Thickness objects:
At this example below I change Cubes into PartDesign Chamfers, so I had to store key for edges:
This example below is little more complicated because as you see at the GUI screen, the references to the object and face changes automatically. But also to make a hole I call function defined in my library not directly in the tool. So, I had to use small trick with selection and deselection, to get new reference:
There are many such problems when programming in FreeCAD, but they can all be solved in a similar way. I hope, it helps.
Solution for one instance of the Topological Naming Problem
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Topological Naming, My Take
Thanks
Darek
github.com/dprojects
workbench for woodworking is available at: github.com/dprojects/Woodworking
Re: Topological Naming, My Take
stability and maintainability. FreeCAD was very buggy before v0.17 or 0.18, it crashed all the time for no apparent reason. It became very stable since v0.19, and has been very stable in v0.20 and 0.21. Bringing in a load of changes, that only a single person understands, to the core of FreeCAD could jeopardize this excellent state.adrianinsaval wrote: ↑Tue Aug 16, 2022 8:03 pmwhat exactly are your worries?The worry I'd have with the second approach is how well it behaves for very complex models with lots of history, including booleans, copies, clones, shapebinders ...
- adrianinsaval
- Veteran
- Posts: 5551
- Joined: Thu Apr 05, 2018 5:15 pm
Re: Topological Naming, My Take
Ok but that's a general worry not much to do with model complexity, could be easier to spot or more serious for more complex models but that's true for everything. I can't remember if there where crash reports related to toponaming algorithm, realthunder's code has undergone massive testing over the years and it's probably still going to be a good amount of testing of the PR itself before merge, or at least that was the stated plan.Zolko wrote: ↑Wed Aug 17, 2022 2:04 pm stability and maintainability. FreeCAD was very buggy before v0.17 or 0.18, it crashed all the time for no apparent reason. It became very stable since v0.19, and has been very stable in v0.20 and 0.21. Bringing in a load of changes, that only a single person understands, to the core of FreeCAD could jeopardize this excellent state.
- adrianinsaval
- Veteran
- Posts: 5551
- Joined: Thu Apr 05, 2018 5:15 pm
Re: Topological Naming, My Take
The wiki page is a place for documenting FreeCAD not a blog, I do not like this page. It's content is better suited to a dedicated forum post where you can share all your ideas. Your "solution" is very limited so IMO the wording is very misleading. Can we split this conversation into a post in the wiki subforum? I would like to hear the opinions of the people working on the wiki.dprojects wrote: ↑Wed Aug 17, 2022 11:27 am Just to let you know the page: https://wiki.freecadweb.org/TNP_solution has been little redesigned.
As a side note, why are you creating part containers with a single body inside them? It is redundant, putting a body inside a Part container only makes sense if it's going to be along side other objects. What you are doing in your workbench is also very unusual and not exactly what people usually understand when talking about TNP, why make a Part object only to them remove it and replace with a PD object? Why not make a PD box then just apply a thickness to that box instead.
The TNP that you are "solving" consist of recreating the exact same shape with another tool, this is trivial, just compare the old with the new and find a match. This is not equivalent to the normal circumstances where one finds the TNP.
Re: Topological Naming, My Take
+1adrianinsaval wrote: ↑Wed Aug 17, 2022 2:45 pm The wiki page is a place for documenting FreeCAD not a blog, I do not like this page. It's content is better suited to a dedicated forum post where you can share all your ideas. Your "solution" is very limited so IMO the wording is very misleading.
I have split the topic.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Topological Naming, My Take
+1adrianinsaval wrote: ↑Wed Aug 17, 2022 2:45 pm The wiki page is a place for documenting FreeCAD not a blog, I do not like this page.
Greetings
user1234