Toponaming mitigation - discussion and questions

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Toponaming mitigation - discussion and questions

Post by onekk »

Hello, hoping not hijacking no one.

When speaking about Toponaming and TNP it seems that is not very clear how it is and hoe the "TNP mitigation" will solve issues, and seems that discussion were scattered around.

I open this topic.

https://wiki.freecad.org/Topological_naming_problem

Other relevant links are at bottom of page linked above under Links.

I have some idea that TNP mitigation could be a good place were integrate a different way of storing the model (intended as the operation that will create solids and eventually compose them in a more complex thing.) using a database.

This could be integrated without the need to add anything to FreeCAD as the stock Python offers SQLite library in his standard library packs, so no need for big additions.

iintegrating SQL tabels and queries to retrieve "model data" instead of relying of the XML file structure, that with big models is slowing down things.

Once integrated and set up correctly it will be even possible to use an external SQL database to store model data and this will permit things like:
  • distribuited model hosting, as example an enterprise could have his models in a centralized database.
  • extending SQL tables will permit to manage things like PDM and similar as you can store data in the database even if FreeCAD wil not use them, provided SQL queries will not alter table structure.
  • Hopefully doing searches in a SQL database is optimized in case of big data
  • SQLite permit to store even binary blobs so adding other things will not be a big hassle, like images and similar things, or even OCCT produce brp files (that however are text files, but maybe in future will not be)
Most important however is to spread some knowledge and make maybe a centralized post where some question ans answer should be found, so the above discourse about SQl and so on will be not the main matters of this thread, it is only a "one of the many" possible "algorithms" to mitigate TNP, as it seems to be that there will not be a simple integration of RT "TNP mitigation" in stock FreeCAD.

Some thing:

- be polite, strong opinion could lead to some harsh answers, don't be too reactive.
- we are in an international contest, so think that maybe misunderstanding could be done because the writer is not a "native English writer" and some subtle difference between terms could be not known, so prior to start a flame war, ask the real meaning of the "offending phrases".
- It is a discussion, so it is in the "nature of the thing" that there will be different opinions, usually changing the point of view could be interesting and lead to big ideas.

Kind Regards to all the partecipants.

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Toponaming mitigation - discussion and questions

Post by adrianinsaval »

your idea is more about how to store the data, this is important but storing data isn't the real problem, the core of it is how to generate that data and how to reconcile it with regenerated geometry.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Toponaming mitigation - discussion and questions

Post by onekk »

It seems that OCCT has solved the problem using OCAF and probably his solution could be inspected as it seems to be documented and probably underlying code inspected.

The problem are generated by the same culprit (OCCT) so probably solution could be "similar".

I know that probably some difficulties could be related to the different Visualization Toolkit as wmayer has explained is some posts.

But apparently we have two working solutions.

RT algo and OCAF, why not try to take idea from both?

Once implemented it will remain in FreeCAD for a long time and as OCAF his made but the same guys (hopefully) that made OCCT it is very probable if something could change in OCCT sorce code to ease TNP mitigation it should be related to the way OCAF is working.

But this is said not having a real idea how OCAF is linking his topology data with OCCT returned data.

What data is really returning OCCT is another thing to be documented somewhere, but this question has been asked many times and a real documentation is lacking.

This is one of the area that FreeCAD developers should improve to permit a better code knowledge.

This could greatly help new developers to get on boards.

But this is is OT.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Toponaming mitigation - discussion and questions

Post by GeneFC »

onekk wrote: Sun Feb 12, 2023 8:35 am It seems that OCCT has solved the problem using OCAF and probably his solution could be inspected as it seems to be documented and probably underlying code inspected.
I think you are misunderstanding OCAF. What the description says is that OCC does not scramble the naming internally, but it also says the application needs to keep track of the naming.

This has been discussed at length, of course, but the consensus of experts in both FreeCAD and OCC is that the TN problem is mostly the responsibility of FreeCAD. It is popular on the forum to blame OCC for all flaws, but in this case the problem is more local. The folks working on this problem understand that.

Gene
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Toponaming mitigation - discussion and questions

Post by onekk »

GeneFC wrote: Sun Feb 12, 2023 4:03 pm ...
This has been discussed at length, of course, but the consensus of experts in both FreeCAD and OCC is that the TN problem is mostly the responsibility of FreeCAD. It is popular on the forum to blame OCC for all flaws, but in this case the problem is more local.
...
What I want is not to create futile polemics, as in my point of view FreeCAD is performing quite well and every improvement is welcomed, but as I know that developers are usually careful to not break things, there is not rush, but maybe a more broad and clear discussion will avoid some criticizing from some users.

But as the matter is scattered around, probably having an unique place where a discussion could be done instead of bringing the "matter" in every post where TNP is involved.

To remain consistent.

I'm perfectly aware that the problem is not created by OCCT as OCCT is doing what has been designed for, creating solids and operate on them.

What's OCAF is doing, is to maintain a reference key, consistent "for what is possible" across solid changements, or that I've guessed from:

https://dev.opencascade.org/doc/overvie ... _ocaf.html
Note As Topological naming is based on the reference-key and attributes such as Naming (selection information) and Shape (topology evolution information), OCAF is not coupled to the underlying modeling libraries. The only modeling services required by OCAF are the following:

Each algorithm must provide information about the evolution of the topology (the list of faces modified, updated and deleted by the algorithm)
Exploration of the geometric model must be available (a 3D model is made of faces bounded by close wires, themselves composed by a sequence of edges connected by their vertices)
It seems from this description that probably OCCT already supply something as point1:
... the evolution of the topology (the list of faces modified, updated and deleted by the algorithm)
This works, as to be done by FreeCAD, being a simple map or a more complex "topology data storing" but an extensive work on maintaining such map, could lead to the above considerations in first post, if the model is big enough you have a bunch of data to maintain.

And I'm aware that in early days something has started by wmayer et al. as I remember a post where wmayer said that OCAF was at that time a mess and will not mate well with some part of FreeCAD.

Such a big work could not take in account other problems, that have arisen, like the slowdown on managing big models and some extensibility of properties stored to make a "new FCStd" format more taylored to manage "big projects", for this I have proposed the SQL format, as a database is "made specifically" to manage big amount of data.

Or better, take in account this possible evolution when implementing things thinking that maybe the action to assign and retrieve could be abstracted to be addressed by other way to store data other than the XML structure.

Other reason of the post, is related to have some more "insight" about alternative ways or maybe "alternative naming algorithms", as it seems from some experts that have seen RT implementation that names are "far from" be friendly.

I don't care too much about friendly names, but as example for some uses calling something, base_plate.top_face and have it consistent across solid modifications for some uses (and users) should be better than having solid1.face4.exface2.exface2 or similar.

As I model with scripting, it is not a problem ,as if I could identify a face as face15656252 and have a methods that will permit to get the face using maybe gefFacebyName('face15656252') is equivalent to another.

Something like the actual use of Name and Label where for each topological element (Vertex, Edges, Faces) Name will be assigned by FreeCAD and the user could assign a more friendly Label, maybe checking for duplicates to avoid problem will suffice and probably will be enough for most users.

I will limit my intervention, as I don't want to repeat myself, countless times. Whatever developers think are good for FreeCAD will go for me, as I can't code in C++ and I have not the knowledge to criticize coding choices, so I can't argue in a consistent and constructive way about fine details of implementation.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply