Assembly 4 + TechDraw problem on FC 0.20 weekly

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Assembly 4 + TechDraw problem on FC 0.20 weekly

Post by wandererfan »

Zolko wrote: Thu Mar 17, 2022 4:39 pm This looks like a regression in TechDraw for FreeCAD v0.20: it works as expected in v0.19, but not in v0.20. The problem comes from bad handling of datum objects: if the datum objects are visible, then the TechDraw views make that error. If the datum objects are NOT visible, the view update correctly. Interestingly, TechDraw handles correctly datum objects inside PartDesignWB Bodies (blue icon), but not inside PartWB Parts (yellow icon)
TechDraw doesn't know about datum objects or object visibility, just shapes and placements.

If LCS is invisible, Part.getShape doesn't include the LCS in its result. Without the LCS faces, OCC can project the shape.
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Assembly 4 + TechDraw problem on FC 0.20 weekly

Post by wandererfan »

Zolko wrote: Thu Mar 17, 2022 7:39 am TechDraw doesn't display things in Part containers.
Not correct. TechDraw displays anything with a valid shape.
Attachments
TDPartContainer.png
TDPartContainer.png (55 KiB) Viewed 2004 times
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 + TechDraw problem on FC 0.20 weekly

Post by Zolko »

wandererfan wrote: Fri Mar 18, 2022 7:16 pm Not a regression in TD. Seems to be a change in Part.getShape or maybe 'PartDesign::CoordinateSystem'.
I understand. TechDraw handles datum objects correctly in PartDesign Bodies, be they visible or not, therefore I don't think it comes from PartDesign::CoordinateSystem. Unfortunately, I'm not versed enough in C++ to be able to see where the regression comes from
try the Assembly4 workbench for FreCAD — tutorials here and here
aapo
Posts: 619
Joined: Mon Oct 29, 2018 6:41 pm

Re: Assembly 4 + TechDraw problem on FC 0.20 weekly

Post by aapo »

wandererfan wrote: Fri Mar 18, 2022 7:16 pm Not a regression in TD. Seems to be a change in Part.getShape or maybe 'PartDesign::CoordinateSystem'.
This bug has bothered me for a while now, so I did a git bisect and did out some digging in order to find out what has happened. Turns out it's a regression in TechDraw after all, accordind git bisect the culprit is commit https://github.com/FreeCAD/FreeCAD/comm ... 0c260c9419. And, indeed, the completely removed function std::vector<TopoDS_Shape> ShapeExtractor::extractDrawableShapes(const TopoDS_Shape shapeIn) has some logic removing infinite shapes here and there, e.g.:

Code: Select all

            if (!s.IsNull() && !Part::TopoShape(s).isInfinite()) {
                extShapes.push_back(s);
            }
I think I understand the reason why you removed the function: Most of it should not be necessary anymore, and it has been there for historical reasons, because the really old shape and toposhape stuff classes did not originally return reasonable shapes automagically when this stuff was first coded. But, nowadays, the shapes are returned automatically and no filtering is necessary, except for the isInfinite() case, which still needs to be handled within TechDraw. I would suggest reverting this commit for now, and re-writing it later so that it only checks if the sub-shapes are infinite and drops them if they are.

EDIT: Here's my simple FCStd test file, it should show a TD drawing of a cube with the bug fixed, and an empty drawing with the aforementioned commit.
Attachments
20220322 AssemblyTechDraw Test.FCStd
(25.29 KiB) Downloaded 33 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Assembly 4 + TechDraw problem on FC 0.20 weekly

Post by Kunda1 »

aapo wrote: Fri Mar 25, 2022 8:18 pm so I did a git bisect and did out some digging in order to find out what has happened
One of these days I'm going to learn git bisect :geek:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Assembly 4 + TechDraw problem on FC 0.20 weekly

Post by wandererfan »

aapo wrote: Fri Mar 25, 2022 8:18 pm I would suggest reverting this commit for now, and re-writing it later so that it only checks if the sub-shapes are infinite and drops them if they are.
If we revert that change, then shells will stop working. That was the driver for the change.

I found where getShape started including the infinite plane for the LCS: https://www.forum.freecadweb.org/viewto ... 69#p583269 but I don't understand why that change affects the shape.

If fixing getShape can't be done easily, we can add code to ShapeExtractor to dissect shapes, drop the troublesome bits and rebuild the shapes.
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Assembly 4 + TechDraw problem on FC 0.20 weekly

Post by wandererfan »

Kunda1 wrote: Sat Mar 26, 2022 4:16 pm One of these days I'm going to learn git bisect :geek:
You need to find 2 commits: a good commit (abcd) before the system broke and a bad commit (efgh) after the system broke.

Then enter this from the terminal:
git bisect start
git bisect good abcd
git bisect bad efgh

git will check out the mid point between the two commits. Build and test. If the system works, type
"git bisect good" and repeat. If the system is broken, type "git bisect bad" and repeat.

Eventually, git will tell you that wxyz is the first bad commit.

Takes a long time if good and bad are far apart.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Assembly 4 + TechDraw problem on FC 0.20 weekly

Post by Kunda1 »

Thanks I added that to Source_code_management#Bisect :D
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Syres
Veteran
Posts: 2898
Joined: Thu Aug 09, 2018 11:14 am

Re: Assembly 4 + TechDraw problem on FC 0.20 weekly

Post by Syres »

Kunda1 wrote: Sat Mar 26, 2022 8:15 pm Thanks I added that to Source_code_management#Bisect :D
Newbies will also need to know how to exit git bisect at the end of proceedings:

Code: Select all

git bisect reset
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Assembly 4 + TechDraw problem on FC 0.20 weekly

Post by Kunda1 »

Syres wrote: Wed Mar 30, 2022 1:36 pm git bisect reset
Thanks! Updated the wiki
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply