Bug or Feature? -> Root Cause Found -> [Solved]

Report observations made with the new Toponaming branch.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
roberto.di.paolo
Posts: 7
Joined: Fri May 27, 2022 7:35 am

Bug or Feature? -> Root Cause Found -> [Solved]

Post by roberto.di.paolo »

Dear community,

I am new here and have a question regarding a difference I noticed between Realthunder and FreeCAD.
It could be related to a bug but it could also be related to a different direction, or maybe different speed, how features evolve in both worlds.
It would be nice to get a better understanding regarding this because I wouldn't like to bet on a feature which will not work in FreeCAD.

It's related to attaching Datums to a Sketch and also how Parts are added to a file in Part Design.

Here a minimum example of what I mean:
1. File created with Realthunder 20220430
2. Add Part container in Part Design
3. Add Body container
4. Add Part container in Part Design
5. Add Body container
6. Add a Sketch in one of the Bodies
7. Add in the other Body a Datum Plane
8. Attach the Sketch to the Datum Plane with XY_Plane
Here the file: -----------------------------
Result when opened with Realthunder20220430:
- Opens fine, no warnings, nor errors
- Enforce recalculation: Gives below scope warning (which I would expect)
16:47:14 <App> GeoFeatureGroupExtension.cpp(575): Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Sketch.Support(links to Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#DatumPlane) is out of scope:Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Body vs. Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Body001

-----------------------------
Result when opened with FreeCAD28909:
- Opens fine, no warnings, no errors
- Mark for recalculation:
- Same scope warning
- Many red errors "Origin" doesn't contain feature with role "XY_Plane"
- Recompute failed! warning
Screenshot from FreeCAD28909 after recalculation 2022-05-27.png
Screenshot from FreeCAD28909 after recalculation 2022-05-27.png (396.91 KiB) Viewed 2902 times

16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"

16:49:21 Sketcher::SketchObject: Link(s) to object(s) 'DatumPlane' go out of the allowed scope 'Sketch'. Instead, the linked object(s) reside within 'Part'.

16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Origin "Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part#Origin002" doesn't contain feature with role "XY_Plane"
16:49:21 Recompute failed! Please check report view.


My understanding is that Sketches need to be attached to something within the same body. Normally. If it is supposed to be attached to outside of the body, a proxy is needed, hence the need of a Shape Binder, hence the scope warning both in Realthunder and FreeCAD. At least that was so in the past, right?

However, when you have a closer look at the Origin of the Part container, you will notice that all axis and planes are missing when they were created with Realthunder. Normally, FreeCAD would create a set of axis and planes when adding a Part container. So I wonder if this is a bug in Realthunder or just continuous evolution which creates this difference.

Is Realthunder more permissive regarding referenced links than FreeCAD when it comes to handling attachments outside of a body? Attachments work fine without Shape Binder in Realthunder and besides scope warnings, I never experienced errors or recompute failed errors in even larger models.

I have also seen that FreeCAD Part Design is allowing variations at the moment of creating a Sketch -> it allows attachment from different parts or free features:
→ make independent copy
→ make dependent copy
→ create cross-reference
However, not possible to switch afterwards, as there is no parameter to choose behaviour of a Sketch regarding this feature.

So cross-reference links should also work fine for FreeCAD, the same as for Realthunder, I would assume?
Or is this simply a bug in Realthunder when creating the Origin in the Part container? Or is this about something else?

Thanks for reading!

FreeCAD:
OS: Ubuntu 20.04.4 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.28909 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 2084652)
Hash: 20846523c9d8219ec0fe33c499a64e700d2266b6
Python 3.9.12, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: English/United States (en_US)

Realthunder:
OS: Ubuntu 20.04.4 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 2022.430.28641 (Git) AppImage
Build type: Release
Branch: LinkStage3
Hash: a77045488092c24ece25d63c91f362cbd2181d36
Python version: 3.9.12
Qt version: 5.12.9
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United States (en_US)
Last edited by roberto.di.paolo on Fri Jun 03, 2022 11:26 am, edited 3 times in total.
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Re: Bug or Feature?

Post by chrisb »

You must not open a realthunder-file in master (vice versa is ok). You have to redo the same in master and you should get a similar message, "Link goes out of allowed scope".
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
roberto.di.paolo
Posts: 7
Joined: Fri May 27, 2022 7:35 am

Re: Bug or Feature?

Post by roberto.di.paolo »

chrisb wrote: Fri May 27, 2022 7:14 pm You must not open a realthunder-file in master (vice versa is ok). You have to redo the same in master and you should get a similar message, "Link goes out of allowed scope".
Sure, the expected behaviour is a simple scope warning - in both worlds. And that's what you get if you compare above both log reports (orange colour).

The question I am interested is related to the red error messages which ends with a recompute failed. Clearly, there is something fundamentally different which breaks the model.

Seems to be related to the attachment operation in Realthunder, which works smoothly to attach something (here a Sketch) to axis and planes (here Datum Plane) in another part/body, which seems to be the data structure belonging to the part container origin. However, this origin axis/planes data structure seems not to be accessible in the Master and it is also not visible in Realthunder. Hence the red error messages. Follow up question: Why that many errors?

So, it could be a bug. Or it could be feature with large background related to how the origin is supposed to evolve in the future. Maybe to a local coordinate system I read about somewhere else?

Would be nice to understand what this is about.
roberto.di.paolo
Posts: 7
Joined: Fri May 27, 2022 7:35 am

Re: Bug or Feature?

Post by roberto.di.paolo »

Okay, I went through a little experiment by creating the same model with the master.

1. Create the same model with the master (28909)
https://forum.freecadweb.org/download/f ... 207ad78359
2. Open it in Realthunder (20220430)
----------------------------------------
3a. When prompted for recalculation for migration purpose -> Yes
4b. Save it in Realthunder with different name
https://forum.freecadweb.org/download/f ... 207ad78359
5c. Reopen it with Master (28909)
----------------------------------------
3b. When prompted for recalculation for migration purpose -> No
4b. Save it in Realthunder with different name
https://forum.freecadweb.org/download/f ... 207ad78359
5b. Reopen it with Master (28909)

Result: Only orange scope warning as expected. Model is not broken.
Difference to previously, when the model is created in Realthunder: Axis and planes of part container origins are always available and visible, both in Realthunder and in the Master.

Here the result of step 5:
Attachments
Screenshot
Screenshot
Screenshot FreeCAD 28909 from 2022-05-29.png (163.63 KiB) Viewed 2717 times
Master28909_sketch_attached_to_Datum_Plane_in_different_part_body_saved_afterwards_with_Realthunder20220430_no_migration.FCStd
No when asked for recalculation for migration
(11.25 KiB) Downloaded 57 times
Master28909_sketch_attached_to_Datum_Plane_in_different_part_body_saved_afterwards_with_Realthunder20220430_with_migration.FCStd
Yes when asked for recalculation for migration
(11.33 KiB) Downloaded 61 times
Master28909_sketch_attached_to_Datum_Plane_in_different_part_body.FCStd
Created with FreeCAD28909
(9.15 KiB) Downloaded 60 times
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

Re: Bug or Feature?

Post by adrianinsaval »

@realthunder sounds like bug
roberto.di.paolo
Posts: 7
Joined: Fri May 27, 2022 7:35 am

Re: Bug or Feature? -> Root Cause Found

Post by roberto.di.paolo »

@realthunder, @adrianinsaval

Okay, root cause found. [/b]

I discovered the Python console and found as root cause, that the list of the Property App.ActiveDocument.Origin.OriginFeatures is empty. An empty list works fine in Realthunder but throws "Origin" doesn't contain feature with role "XY_Plane" and Recompute failed! warnings in the Master which breaks the model.

However, I still don't know if this is a bug or simply the consequence of an emerging feature, because I can salvage a Realthunder file with missing OriginFeatures only from within Realthunder, but not from within the Master.

Here how to salvage such a Realthunder file:
1. Open Realthunder20220430
2. Open test file
https://forum.freecadweb.org/download/f ... 5a3cc9c75e
3. View -> Python console
4. Double check the Property "OriginFeatures" in the Python console -> culprit -> list is empty
>>> print (App.ActiveDocument.Origin.Content)
...
<Property name="OriginFeatures" type="App::PropertyLinkList" status="201326592">
<LinkList count="0">
</LinkList>
</Property>
...
>>>
5. >>> print (App.ActiveDocument.Origin.OriginFeatures.__add__) -> this should populate the list
<method-wrapper '__add__' of list object at 0x7f749967bd40>
>>>
6. Double check if the Property OriginFeatures changed -> list is populated
>>> print (App.ActiveDocument.Origin.Content)
...
<Property name="OriginFeatures" type="App::PropertyLinkList" status="201326593">
<LinkList count="6">
<Link value="X_Axis002"/>
<Link value="Y_Axis002"/>
<Link value="Z_Axis002"/>
<Link value="XY_Plane002"/>
<Link value="XZ_Plane002"/>
<Link value="YZ_Plane002"/>
</LinkList>
</Property>
....
>>>
7. Repeat 4/5/6 for the other origin (Origin002) which also has an empty OriginFeatures list
8. Save file, quit Realthunder
9. Open FreeCAD28909, open previously saved file from step 8
-> no errors, just the expected orange out of scope warning which seems to be fine, model works, recalculation is possible -> see below screenshot
Attachments
Realthunder20220430_origins_with_sketch_attached_from_different_body_or_part.FCStd
Original Realthunder file which breaks the model when opened with the master
(9.71 KiB) Downloaded 36 times
Screenshot which proves that it works now in the master
Screenshot which proves that it works now in the master
Origins restored within Realthunder which works when opened with FreeCAD28909_Screenshot from 2022-06-01.png (131.8 KiB) Viewed 2536 times
Last edited by roberto.di.paolo on Sun Jun 05, 2022 2:33 am, edited 4 times in total.
roberto.di.paolo
Posts: 7
Joined: Fri May 27, 2022 7:35 am

Re: Bug or Feature? -> Root Cause Found

Post by roberto.di.paolo »

Forgive me to post yet another one.

Zooming in on this to double check behaviour without attaching something to these origin axis/planes.

1. Open Realthunder20220430
2. New document
3. Add Part container
4. Add Part container
5. Save as test file
https://forum.freecadweb.org/download/f ... 53adf91779
6. Open file in FreeCAD28909 (opens without warning or error)
7. Mark for recalculation
8. Recalculate
-> just 1 error message -> Recompute failed! -> model broken (below Screenshot)
Attachments
FreeCAD28909 recalculation failed screenshot from 2022-06-02.png
FreeCAD28909 recalculation failed screenshot from 2022-06-02.png (208.3 KiB) Viewed 2439 times
Realthunder20220430_test_file_with_just_part_containers_added.FCStd
Realthunder test file with just 2 part containers added
(3.13 KiB) Downloaded 39 times
roberto.di.paolo
Posts: 7
Joined: Fri May 27, 2022 7:35 am

Re: Bug or Feature? -> Root Cause Found -> It's a Feature

Post by roberto.di.paolo »

Opened issue #436 in the Link Branch github "Part -> Origin -> Axis/Planes missing -> the Origin property "OriginFeatures" list is empty when adding a Part container in Realthunder, which breaks the model when opening the file in FreeCAD"
https://github.com/realthunder/FreeCAD/issues/436

Realthunder wrote, that it's a branch feature, not to create the axis and planes of the Part Origin. However, this makes the file incompatible when opening with the master. In order to prevent incompatible files, there is a setting in Preferences/General/Objects -> tick -> "always create origin features in origin group".

It would be nice to understand more about the background. I searched a bit but the only hint I found in an old thread was that it saves some memory not to create them.

Anyway, I will continue with the Realthunder branch because of far better usability and will use this option for now on. However, this option does not help regarding older files. What I currently do is to find a migration path for a more or less important file. I added the origin features manually for about 20 empty origins with below OriginFeatures hack in the Python console.

Code: Select all

>>> print (App.ActiveDocument.OriginXXX.OriginFeatures.__add__) -> this should populate the list
<method-wrapper '__add__' of list object at 0x7f749967bd40>
With interesting results: FreeCAD28909 and FreeCAD28810 crashed immediately when opening this file. Only FreeCAD27936 did not crash. The report mentioned TechDraw issues -> and there it was. This action added new objects and seems to have reshuffled the references to old ones etc. which was too much to bear for TechDraw in the master. Removing these drawings solved the issue. It has a reason that it's suggested to do the TechDrawings only at the very end of a project...

Next issue: A lot of red unit mismatches, however, this one is related to other differences between Realthunder and the Master. Let's see how far this goes.
User avatar
bambuko
Veteran
Posts: 2115
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: Bug or Feature? -> Root Cause Found -> It's a Feature

Post by bambuko »

roberto.di.paolo wrote: Fri Jun 03, 2022 11:21 am ....However, this makes the file incompatible when opening with the master. In order to prevent incompatible files, there is a setting in Preferences/General/Objects -> tick -> "always create origin features in origin group".
There are quite a few things that make models created in LinkStage3 "incompatible" with Master branch FreeCAD.
That is inevitable when some of the features introduced in Link branch are not available in Master...
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
roberto.di.paolo
Posts: 7
Joined: Fri May 27, 2022 7:35 am

Re: Bug or Feature? -> Root Cause Found -> [Solved]

Post by roberto.di.paolo »

@bambuko
I am fully aware that this branch is experimental and I don't complain if things brake.

This branch works great and it's fine to use a recent version for quickly creating something.

However, in some cases I would like to be able to open a file also years later. For this I use a specific approach and go an extra mile:
- Use a stable Realthunder a few versions earlier which has proven to work for the intended purpose
- Use a versioning approach when saving/naming the file
- Always know which version was used for creating which file (and have a backup copy of the application)
- Preference for AppImage and not using Snap, because an update risks slowly contaminating your file with new features, thus the risk of endangering your work if things turn sour
- Frequently test if the file can still be read/recalculated with a new version
- Frequently test if the file can still be read/recalculated by the master
- Being aware of not using specific features. In my case I create robust parametric models with DatumPlanes in order to prevent exposure to the the topological naming problem - even if I work in Realthunder.
- Try not to mix up work benches (however, I need TechDraw, which has it's own topological issues, so doing it at the end)
- In general, it's about discovering your specific work flow for creating what you want

Obviously, a little more of an effort than just using plain vanilla a version. I could of course have chosen to work completely with the FreeCAD master. However, I still would do something similar for some important files.

Nevertheless, I doubt that I would have even been able to come so far with FreeCAD alone. The learning curve is too steep and frustrating as the more you learn the more you get exposed to really weird stuff. This probably discourages quite a lot of people to continue. The naming topology problem is just one thing of which I was aware of right from the start. Another one is the approach to dimensions which is something where I can't help but roll my eyes and say OMG. Then the clunky user interface and object manipulation behaviour. This all works in Realthunder far better and more seamlessly. The way how I do it is de facto discovering the FreeCAD shortcomings indirectly via Realthunder.

FreeCAD has a lot of potential, however it would be great if FreeCAD would move faster regarding the things which would make it more user friendly. It's amazing how good and how robust Realthunder is and furthermore, that it opens without issues all FreeCAD files.

My wish would be a controlled migration path for files between both worlds, not just in Realthunder but also in FreeCAD. It would be great to have a preference setting for centrally switching on/off important incompatibility features in a conscious way. Some of these options exist, but right now it's rather for the FreeCAD or the Realthunder insider to understand the consequences regarding compatibility. As this thread proves, I dare to say.
Post Reply