Topological Naming, My Take

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!
FRIEND OF GOD
Posts: 12
Joined: Wed May 04, 2022 6:01 pm

Re: Topological Naming, My Take

Post by FRIEND OF GOD »

@user1234
user1234 wrote: Sat May 07, 2022 6:26 pm
FRIEND OF GOD wrote: Sat May 07, 2022 6:09 pm Response: If I can provide a viable solution to the topographical naming issue that has been an issue for years, then I was just suggesting that the bugs and features I suggest can get a priority review ?
Your suggestion solves nothing. You do not understand the real problem of the TNP.
I was only guessing because of the shifting names, such as line001 shifting to line002;

Is there a post somewhere that describes all the details of the TNP ?
FRIEND OF GOD
Posts: 12
Joined: Wed May 04, 2022 6:01 pm

Re: Topological Naming, My Take

Post by FRIEND OF GOD »

@chrisb
chrisb wrote: Sat May 07, 2022 6:06 pm If there is no need I don't see any advantage to have a DatumPlane. It just crowds the tree.
That is what I Am indicating... the combining of the New Sketch button with the DatumPlane button, and only showing a New Sketch in the Comboview Tree.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: Topological Naming, My Take

Post by chrisb »

It is very easy to make things stable by attaching them only to the origin or main planes, and that seems to be what your approach leads to. But the problems arise when you talk about the link points between Sketches. Things can then break if you change the thing where the link goes.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Topological Naming, My Take

Post by adrianinsaval »

Sorry to say this but half of what you say doesn't make sense once you have more knowledge of what the actual problem is. Please read the wiki page for Topological naming problem although I'm not sure if it covers all the nuances of the problem.

The names given to geometries are out of FreeCAD's control because it's done by OCCT a third party geometric kernel, your "solution" would have to be done at the OCCT level so you would have to propose it to them and they have no interest in changing that, plus it's suboptimal really. Because of this FreeCAD needs it's own naming scheme for geometries in parallel to the names given by OCCT, since this parallel naming scheme is under FreeCAD control there is absolutely no need to make it consecutive numbers or to insert one in the middle of the list instead of at the end, so your method becomes unnecessary and a waste of memory by assigning hundreds of empty spaces. Anyways, like I said there is working code pending merge approval for this parallel naming scheme and for figuring out it's correlation to the OCCT given names so you're a little late to the party.

Sketcher does have it's own FreeCAD controlled naming scheme that's very flawed because it uses consecutive numbers but there isn't an issue of inserting new elements in the middle of the list but rather that empty spaces are not allowed and when deleting a geometry/constraint the ones with a higher number are moved back, this would not be solved by pre-allocating empty spaces though.

Regarding datum planes, you appear to believe their only meaningful use is to use as an intermediary for placing single sketches but this is not the case but in fact the opposite, creating a single datum plane to place a single sketch is unnecessary because a sketch has all the placement options that a datum plane has. Still, datum objects aren't just a workaround for TNP, they are useful features on their own and should not be removed even if the TNP was fully solved.

Also I'm confused by your use of the word hash, it seems you are using it interchangeably with array and I don't see how this would be the case, are you sure you understand the correct meaning of a hash? Or is it just me that is confused?
If I can provide a viable solution to the topographical naming issue that has been an issue for years, then I was just suggesting that the bugs and features I suggest can get a priority review ?
First off, bug report and feature requests are judged and given priority based on their own merits not based on who submitted them, and then they are tackled according to the devs availability and interests as they are all volunteers, at most you could offer a bounty for solving your issues and hope someone takes it on. Secondly your idea was a shot in the dark and superficial, even if it was the right idea that doesn't give you special privileges, as I often say here in the forum we are not short of ideas, we are short of manpower, so your idea is of very little use if you don't code it.

Don't get me wrong if you have actual useful things to contribute we welcome it but please take the time to understand things before pretending to give a solution, read the wiki pages and don't be afraid to ask for clarification on the appropriate places.
User avatar
DeeJayOne
Posts: 332
Joined: Thu Sep 05, 2019 9:18 am

Re: Topological Naming, My Take

Post by DeeJayOne »

Hi Everyone :)

As a kind of workaround, most of the time, I try to copy sketches to keep references from the main 3D space.
The draw back is it needs more time to do the same work (mainly if you need to do lot of modifications because you need to update lot of sketches).

It could be usefull, if we could have a clone feature for sketches.
PS : I didn't check if it is planned in a next release.
L'important est de ne pas arrêter de poser des questions. La curiosité a sa propre raison d'exister
The important thing is not to stop questioning. Curiosity has its own reason for existing.
Albert Einstein
ruiseixas
Posts: 3
Joined: Mon Nov 22, 2021 6:04 pm

Just changing values on a Spreadsheet triggers this!

Post by ruiseixas »

Hi,

I'm puzzled with this so trivial problem in FreeCAD, is it that hard to give an absolute references to geometric objects? I mean, programming speaking, just set a big hexadecimal number (64 bits) randomly generated, then check it if already exists (1 in billion), if not, set that reference as writings on a stone. BAM!, Problem solved! :idea: :idea: :idea:

This is unbelievable! :lol: :lol: :lol:
tom
Posts: 165
Joined: Sun Mar 29, 2015 9:20 pm

Re: Just changing values on a Spreadsheet triggers this!

Post by tom »

ruiseixas wrote: Mon May 23, 2022 6:52 pm BAM!, Problem solved! :idea: :idea: :idea:

This is unbelievable! :lol: :lol: :lol:
You did not understand the problem.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Just changing values on a Spreadsheet triggers this!

Post by adrianinsaval »

ruiseixas wrote: Mon May 23, 2022 6:52 pm I'm puzzled with this so trivial problem in FreeCAD, is it that hard to give an absolute references to geometric objects? I mean, programming speaking, just set a big hexadecimal number (64 bits) randomly generated, then check it if already exists (1 in billion), if not, set that reference as writings on a stone. BAM!, Problem solved! :idea: :idea: :idea:
Great, you found a solution! I'm happy that we finally got someone with a bright mind here unlike all the other people involved in the project. I'll wait for your PR ;)

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

Re: Just changing values on a Spreadsheet triggers this!

Post by onekk »

ruiseixas wrote: Mon May 23, 2022 6:52 pm Hi,

I'm puzzled with this so trivial problem in FreeCAD, is it that hard to give an absolute references to geometric objects? I mean, programming speaking, just set a big hexadecimal number (64 bits) randomly generated, then check it if already exists (1 in billion), if not, set that reference as writings on a stone. BAM!, Problem solved! :idea: :idea: :idea:

This is unbelievable! :lol: :lol: :lol:
This is not a problem of hexadecimal numbers, it simply a problem of references.

In great approximation with TNP we are dealing with solids, and with references to a particular face of a solid.

If you modify the solid and you are using a "reference" to a face, it is not guaranteed that this face (with the same reference) will exist in the modified solid.

There is a workaround in phase of implmentation that will assign a "complex name" the the face instead of "Face1" "Face2" "Face3" (as example) so you could refer to this "complex name" that will survive to a "solid modification" provided that the "referenced face" still exist.

This involve in changing many aspect of FC in a deep way, so it is a "delicate task".

As here there are some programmers that work on FC from the start 0.20 means that is about 20 years old (but his more than 20 years old as some version needed more than an year to be released), if there is simply a reference to a number, I suspect that it will be already solved.

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/
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Topological Naming, My Take

Post by Zolko »

I have some time during the summer break (I'm inside during the peek hot temperatures) and I'm reading on the topological naming thing all over, and stumbled upon this very important peice (I think):

adrianinsaval wrote: Sat May 07, 2022 9:25 pm The names given to geometries are out of FreeCAD's control because it's done by OCCT a third party geometric kernel
...
Sketcher does have it's own FreeCAD controlled naming scheme ...
can you please point where in the code this is done ? I tried and failed to find the relevant files.

adrianinsaval wrote: Sat May 07, 2022 9:25 pm ... that's very flawed because it uses consecutive numbers [...] empty spaces are not allowed and when deleting a geometry/constraint the ones with a higher number are moved back
If that's the only problem then the solution to the topological problem for sketches is easy: simply add a new entry into the GeometryMode in file /src/Mod/Sketcher/App/SketchGeometryExtension.h, called "Deleted":

Code: Select all

namespace GeometryMode {
        enum GeometryMode {
            Blocked                 = 0,
            Construction            = 1,
*****       Deleted                 = 2,
            NumGeometryMode        // Must be the last
        };
    }
(this I tested and it compiles and runs without error), and then, when:
  • creating new things, increment the index. This means that SketchObject::addGeometry() should look for all internal objects (getInternalGeometry()), including those flagged Deleted, so it doesn't create a new object on top of a deleted one
  • looking for stuff to create constraints, don't include those with GeometryMode 2 (getInternalGeometry())
  • deleting things, in SketchObject::delGeometry(), set the GeometryMode to 2, and adjust constrainst as currently, but omitting geometries that are flagged Deleted
  • looking for stuff to export, don't include those that are GeometryMode 1 and 2 ==> I didn't find this one
this probably means that the function getInternalGeometry() should have an option to return or not deleted geometries. But this would also mean that the exported geometries ID wouldn't be consecutive, there might be "holes" in the indices, and I didn't find where these indices are created.


As a top-level note, I think that solving/improving the topological naming is a big goal for v0.21, but we could do this in steps: first do it for Sketches only in v0.21, and THEN do it for other things for v0.22. My fear is that solving the TNP for EVERYTHING in 1 giant step in v0.21 might be a very long road, and having solved it for sketches would solve many MasterSketch / DatumObjects combinations (you might see where this is coming from)
try the Assembly4 workbench for FreCAD — tutorials here and here
Post Reply