FreeCAD Day 2023 - Report and Continued Discussion

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
randfb1
Posts: 14
Joined: Mon Dec 30, 2013 5:44 pm

Re: FreeCAD Day 2023 - Report and Continued Discussion

Post by randfb1 »

Can someone point to this guy's work,

[*] Showcase the guy who designed his house using FreeCAD
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: FreeCAD Day 2023 - Report and Continued Discussion

Post by onekk »

C_h_o_p_i_n wrote: Tue Feb 07, 2023 8:59 pm ...
The point is that TNP is related to the way OCCT is creating solids, it is primary scope is well.

Creating solids.

What you do with created solid it is responsability of the "user" in this case FreeCAD.

But as FreeCAD his very flexible it could return to the user (in this case the entity between the chair and the monitor) "topological names" of the "OCCT solid".

The error is relying on these names when changing the solid as the naming (or better the indexes) are not related to those of the old solids.

You have to store for some elements you want to utilize some consistent data that permit to name a "topologic element" the same across modifications.

And this is the sense of "TNP mitigation" as a deleted element has however no meaning so if you delete something on which you have based other "features" you have a problem even with a "TNP mitigation" up and running.

Database are Made to manage lot of data so they are "the right tool" to manipulate them not less not more.

In this sense using a database is better than using an XML file.

The fact that a database could be used to store many other things could be seen as a "side benefit" but the point is it involve a rethinking of many (maybe too much) things.

In fact at this point of development is not an option, but having this "possible future evolution" in mind could be a clever move when thinking of an implementation.

What is actually done maybe with a dictionary as example store "topological elements" named for persistency across solid modification, coulb be in future done using mayba a database either internal or distributed for collaboration on complex models.

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
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: FreeCAD Day 2023 - Report and Continued Discussion

Post by onekk »

randfb1 wrote: Wed Feb 08, 2023 2:39 am Can someone point to this guy's work,

[*] Showcase the guy who designed his house using FreeCAD
???
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/
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: FreeCAD Day 2023 - Report and Continued Discussion

Post by openBrain »

A bit late on the topic but will give some reactions. Will try to keep it short.

First thanks @chennes for the comprehensive reporting, and hope everyone there had a safe trip back to home.
chennes wrote: Sat Feb 04, 2023 5:18 pm [*] Many tools have too much dependency on the order things are selected in, with no guidance about what that order must be.
I also wish we have something like in Inkscape for example (IIRC) where when a command is selected, its basic usage is described in the status bar.
[*] Sketch selection from backside doesn't work.
That should work in the dev version. :) If it doesn't, please report a bug.
[*] Use Euler angles for rotations.
I guess the point is "standard" Euler angle in the order ZY'X''.
[*] Stop telling users they should become developers.
This is a bidirectional behavior. :)
chennes wrote: Sat Feb 04, 2023 7:04 pm [*] Rust is polarizing - what about Nim?
AFAIK Nim doesn't bring "integrated" management of concurrency, which can be a drawback in such applications.
chennes wrote: Sat Feb 04, 2023 7:23 pm Next, Wookey (whose forum handle I never did catch, so feel free to identify yourself!) presented on Thermal Modeling for construction of low-energy buildings.
For anyone having interest in FEM, I wonder if we could easily build a bridge to Salome and all side-sitting FEM softwares : https://www.edf.fr/en/the-edf-group/inv ... tion-codes
chennes wrote: Sat Feb 04, 2023 8:14 pm Probably the most anticipated session of the day came from John Dupuy, under contract to ONDSEL, who talked about "Organizing the Topo-Naming Update".
Would be cool to have a videoconference to maintainers (and key contributors) from John and Brad to introduce John and how Ondsel may interact with FreeCAD codebase.
chennes wrote: Sat Feb 04, 2023 8:22 pm Finally, Yorik van Havre (@yorik) asked "What should the FPA Fund?"
Maybe FPA could also offer small bounties for noticeable contributions (being it in code, user support, documentation). I mean not something that is planned to happen on a certain achievement, but delivered a posteriori to someone that wasn't necessarily expecting it.
Probably something in the 100~200$ range, letting one say "Hey dear, remember these days where I didn't attend the dinner with the family because I want to finish this obscure code that you never understood the meaning ? Guess what, I was rewarded some dollars for that. Let's bring the kids to a crazy good restaurant tonight".
sliptonic wrote: Sat Feb 04, 2023 9:31 pm Sorry, my friend. Nobody gets to claim a lack of skills. I, myself, have no formal training as a programmer and I have a degree in psychology. We all roll up our sleeves and get dirty on this one. :lol:
Weird. I have some qualifications as a programmer, but often feel like I would deserve some basic training about human psychology. :lol:
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: FreeCAD Day 2023 - Report and Continued Discussion

Post by keithsloan52 »

wmayer wrote: Tue Feb 07, 2023 2:12 pm
keithsloan52 wrote: Tue Feb 07, 2023 1:11 pm Out of interest, as far as I am aware all OCC objects such as Faces, Edges etc have function called hashCode(), does this not return a unique id?
or does it change after recomputes etc. i.e why could it not be used? Speed?
The hash code of a sub-shape is unique within the shape it belongs to but a recompute basically creates a new shape object and thus the hash codes change, too.

Code: Select all

doc = App.newDocument()
obj = doc.addObject("Part::Box", "Box")
doc.recompute()

obj.Shape.hashCode()
obj.Shape.Edge1.hashCode()

obj.Width=9
doc.recompute()

# Compare the values with previous ones. They should be different now
obj.Shape.hashCode()
obj.Shape.Edge1.hashCode()
So how hard would it for OCC to NOT change the hashCodes on a recompute?
Or have an extra code, IDcode for example, that was unique and did not change on a recompute.

I assume the intension of OCC is enable numerous applications to be developed with OCC as a building block, many of which will face issues similar to the Topological naming problem, so would have thought they would have a vested interested in providing functions that addressed the issue rather than having each App have to reinvent the wheel.
C_h_o_p_i_n
Posts: 225
Joined: Fri Apr 26, 2019 3:14 pm

Re: FreeCAD Day 2023 - Report and Continued Discussion

Post by C_h_o_p_i_n »

onekk wrote: Wed Feb 08, 2023 6:40 am
C_h_o_p_i_n wrote: Tue Feb 07, 2023 8:59 pm ...
The point is that TNP is related to the way OCCT is creating solids, it is primary scope is well.

Creating solids.
Carlo D.
Hi Carlo,

yes - and the problem we are faceing is common to many CAD Systems.
For a better understanding I'd like to point to RT's short explanation and more stuff:

https://github.com/realthunder/FreeCAD_ ... cal-Naming

and some papers:

https://www.sciencedirect.com/science/a ... 0015300117
https://www.researchgate.net/publicatio ... l_exchange

maybe you could store the "tree" of geometrical data in a big DB which will imho rather soon will contain dead twigs - a kind of linked list w/ many dead elements. Or you use a sheme where the addressing is made by "descriptive names" (describing the "landscape" == the solid) .

the later on is - for my understanding - already working in the RT Branch.

hopefully this makes more clear why I do not see the problem in "XML or DB".

Regards,
Stefan
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: FreeCAD Day 2023 - Report and Continued Discussion

Post by onekk »

keithsloan52 wrote: Wed Feb 08, 2023 8:09 am ...
So how hard would it for OCC to NOT change the hashCodes on a recompute?
Or have an extra code, IDcode for example, that was unique and did not change on a recompute.

I assume the intension of OCC is enable numerous applications to be developed with OCC as a building block, many of which will face issues similar to the Topological naming problem, so would have thought they would have a vested interested in providing functions that addressed the issue rather than having each App have to reinvent the wheel.
No the problem is elsewhere.

When you ask as example a Boolean operation, OCCT do the job and return a solid.

This solid has his Vertex, Edges and Faces, sotre in the BREP returned component:

As example a cut in the Document.XML, you have this:

Code: Select all

      <Object name="Cut">
            <Properties Count="9" TransientCount="1">
                <_Property name="History" type="Part::PropertyShapeHistory" status="234881024"/>
                <Property name="Base" type="App::PropertyLink">
                    <Link value="Box"/>
                </Property>
                <Property name="ExpressionEngine" type="App::PropertyExpressionEngine" status="67108864">
                    <ExpressionEngine count="0">
                    </ExpressionEngine>
                </Property>
                <Property name="Label" type="App::PropertyString" status="134217728">
                    <String value="Cut"/>
                </Property>
                <Property name="Label2" type="App::PropertyString" status="67108992">
                    <String value=""/>
                </Property>
                <Property name="Placement" type="App::PropertyPlacement" status="8388608">
                    <PropertyPlacement Px="0.0000000000000000" Py="0.0000000000000000" Pz="0.0000000000000000" Q0="0.0000000000000000" Q1="0.0000000000000000" Q2="0.0000000000000000" Q3="1.0000000000000000" A="0.0000000000000000" Ox="0.0000000000000000" Oy="0.0000000000000000" Oz="1.0000000000000000"/>
                </Property>
                <Property name="Refine" type="App::PropertyBool">
                    <Bool value="false"/>
                </Property>
                <Property name="Shape" type="Part::PropertyPartShape">
                    <Part file="PartShape2.brp"/>
                </Property>
                <Property name="Tool" type="App::PropertyLink">
                    <Link value="Cylinder"/>
                </Property>
                <Property name="Visibility" type="App::PropertyBool" status="648">
                    <Bool value="true"/>
                </Property>
            </Properties>
        </Object>

No trace of edge numbers, face number and similar but you have this:

Code: Select all

                <Property name="Shape" type="Part::PropertyPartShape">
                    <Part file="PartShape2.brp"/>
                </Property>
that is this file:
PartShape2.brp
(12.77 KiB) Downloaded 19 times
That contains the topology of the complex object created by the cut.

The order is not clear, but his managed probably reading these data and exposing the list of Vertexes, Edges, Faces, you usually rely on these indexes, but if the solid change, these indexes are recalculated, so the edge1 will maybe not edg1 anymore but it will became edge3, and you are screwed.

The problem is not easily solvable, if not creating a different format that store the Topology in some ways and pass as example a cube as six faces, that then are composed in a shell and then became a solid. (BREP paradigm).

You could easily create Faces, sending approriate commands to OCCT, and the same has to be done. for every operation, you have to map the solid in a way that will permit to have consistent names.

as example Face1 will be always Face1, but it there is a fillet it will have different dimensions, and hopefully same edges count, that remain stable, only their coordinates will change as they have to take in account the fact that they are now "filletted" and are more small.

Said that having this type of data saved in a database is better than having to read a sequential file and recreate the lists.

I have not investigated RT solution, but it is based on names, and probably is storing some relevant informations, to permit to have a consistent name, I don't know how it take trace of modifications to say that edge1.solid1.cut1 or whatever is the naming scheme is the acutal Edge3 as example in the solid returned from OCCT and permit to refer to this "OCCT topological object" being sure that is the old "Edge1" as example.

But this is a guess, don't ask how a similar thing could be implemented as you have at least to know:

- how to pass data to OCCT and find as example that what is called "Edge1" prior of having done the operation has became "Edge3" now.
- propagate the change to the model
- permit a decent Undo stack at least temporarily when modifying the file.

OCCT has "solved" probably the TNP using OCAF if I remeber well but this solution was somehwat complicated and involute and was not adopted probably because it was related to the visualization Framework that was different as FreeCAD has chosen to use OpenIventor (Coin3D).

Good or bad, the choices was done, and as FreeCAD is usable with some caveats, we have to live with it, if people are not satisfied, ehy coudl have the choice of non using FreeCAD or "fork and amend" or "rewrite from scratch", or as we are doing, trying to do some brainstorming to make FreeCAD better and thanks developers for the very good piece of software FreeCAD is despite his problems, Thanks wmayer and others developers, as it is not easy even to think to a possible solution, the fact that the problem was not ignored and a solution is in WIP, is a positive thing.

As only developers knows "how hard" is to adapt the actual code to "TNP mitigation" code, I trust on their judgment and abilities, I could however suggest a different point of view, as usual "for good " and not "for bad", if the problem will be solved in another way, I will be happy as FreeCAD will be better and maybe more usable without "having to be too careful".

Sorry for the "wall of words", my last post here on this matter, if someone is interested better to open a new topic and discuss in another place.

Kind 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
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: FreeCAD Day 2023 - Report and Continued Discussion

Post by onekk »

C_h_o_p_i_n wrote: Wed Feb 08, 2023 9:14 am ..
hopefully this makes more clear why I do not see the problem in "XML or DB".

Regards,
Stefan
This is about theory of list ordering, are inefficients, as you have to traverse all the list to find the candidate in the worst case.
An XML file is a bunch of data organized in some way, but has a sequential access, you have to read it store his data somewhere and process the data.

al this thing will be delegated to a database that his optimized to do this sort of things, right tool for the job.

Plus once you have a table and a "SQL query" to retrieve data from a table, this table could reside where you want, in an internal "Sqlite File" for "low demanding job" and "small projects", on a distributed system to be accessible by many users and so on.

The way you retrieve the data will be simply to point the location of the database, the "queries will not change" so you could retrieve (and store) data wherever you want, with "little code change" only the interface to the "db manager" will have to be modified, SQL queries are decently standardized to find a good subset that will cover some database manager.

Last post on this argument, to not pollute the thread anymore.

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/
trilbytim
Posts: 31
Joined: Mon Aug 03, 2020 5:10 pm

Re: FreeCAD Day 2023 - Report and Continued Discussion

Post by trilbytim »

Unfortunately I couldn't attend in person, although I called in one lunchtime over @JulianTodd 's robot. This thread seems to be running a bit out of control, could we perhaps start separate topics for each of the 14 items that were discussed?
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD Day 2023 - Report and Continued Discussion

Post by wmayer »

keithsloan52 wrote: Wed Feb 08, 2023 8:09 am So how hard would it for OCC to NOT change the hashCodes on a recompute?
Or have an extra code, IDcode for example, that was unique and did not change on a recompute.
In general this is not possible. The recompute creates an output shape from the given input parameters. If one of the input parameter changes its values then for the next recompute a new output shape is created.

Given the example from yesterday with the box: the input parameters are three floating-point numbers and the two created boxes of the recomputes for sure don't share any common geometry. They are two completely independent objects.

Code: Select all

def checkPartnerEdges(shape1, shape2):
  for i in shape1.Edges:
    for j in shape2.Edges:
      if i.isPartner(j):
        print ("shared edges:", i.hashCode(), j.hashCode())


box=Part.makeBox(10,10,10)
box2=Part.makeBox(10,10,10)

# Won't print any hits
checkPartnerEdges(box, box2)
Now it you have an existing box and create a fillet on one of the edges and you do this twice then the two output shapes share several edges. Their hash codes don't change:

Code: Select all

f1 = box.makeFillet(1, [box.Edge1])
f2 = box.makeFillet(1, [box.Edge1])

# Will print 7 hits
checkPartnerEdges(f1, f2)
Post Reply