Lattice2-ParaSeries weird behavior

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
matthyuz
Posts: 33
Joined: Sat Sep 16, 2017 8:01 pm

Lattice2-ParaSeries weird behavior

Post by matthyuz »

Hello everyone!
A good excuse to do mazes was to learn about the Lattice2 workbench, which I think is great, many thanks to the creators!
My idea was to create a Sketch with a single segment, with endpoint coordinates (a, b), (c, d) and then with ParaSeries make copies of that Sketch by varying those coordinates.
As you can see in the image, one segment immediately caught my attention, it's diagonal! I assumed that I had made a mistake in the list of coordinates that I passed by hand, but no, I didn't find an error. Line 26 of the coordinates is the one that produces that diagonal segment, but the values ​​of that line are correct.
Is it a bug or is there something I'm missing?
Attach the file.
Thank you.

Code: Select all

OS: Windows 8.1 Version 6.3 (Build 9600)
Word size of FreeCAD: 64-bit
Version: 0.20.2.29177 +426 (Git)
Build type: Release
Branch: (HEAD detached from 0.20.2)
Hash: 930dd9a76203a3260b1e6256c70c1c3cad8c5cb8
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: Spanish/Latin America (es_419)
Installed mods: 
  * Assembly4 0.12.5
  * lattice2 1.0.0
Attachments
maze.FCStd
(8.11 KiB) Downloaded 22 times
error.png
error.png (552.94 KiB) Viewed 889 times
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Lattice2-ParaSeries weird behavior

Post by edwilliams16 »

Looks like a bug interacting with the sketcher constraints. If I change the order of the points, or if I avoid the sketcher altogether, just creating line segments (obviously more efficient), it works fine.

@openBrain
Attachments
maze_EW.FCStd
(9.69 KiB) Downloaded 15 times
matthyuz
Posts: 33
Joined: Sat Sep 16, 2017 8:01 pm

Re: Lattice2-ParaSeries weird behavior

Post by matthyuz »

Hello edwilliams16, thank you very much for your answer.
I tried with Draft lines and it works correctly as you say (and surely more efficient).
My intention in posting the query, was to give the developer knowledge, maybe it is relevant to him.
Thank you.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Lattice2-ParaSeries weird behavior

Post by openBrain »

edwilliams16 wrote: Wed Jan 25, 2023 7:04 pm Looks like a bug interacting with the sketcher constraints. If I change the order of the points, or if I avoid the sketcher altogether, just creating line segments (obviously more efficient), it works fine.

@openBrain
Can confirm.
You can get good clues by looking at the report view where both Sketcher and Lattice2 give warnings/errors.

You can replicate such behavior with a simple series of 2 values :
* 0;4;0;3
* 1;3;1;4

Now to understand, you have to figure out that each individual value will be injected into the sketch and sketch is recomputed, so here is the sequence (default values in the sketch are 1;1;2;2)
* Init : 1;1;2;2
* ## Starting value 1
* 1.a : 0;1;2;2
* 1.b : 0;4;2;2
* 1.c : 0;4;0;2
* 1.d : 0;4;0;3 => OK, catch the shape
* ## Starting value 2
* 2.a : 1;4;0;3
* 2.b : 1;3;0;3
* 2.c : 1;3;1;3 => :!: Error in Sketcher, both points are equal. This value falls back to previous value => 1;3;0;3
* 2.d : 1;3;0;4 => :!: Here you get the faulty segment

If we want to fix the problem, we have to dig deeper, especially to now if recomputing of sketch between each individual value is launched by Lattice2 or intrinsically by Sketcher on value change.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Lattice2-ParaSeries weird behavior

Post by openBrain »

OK, had a quick check.
It's intrinsic to Sketcher. Won't be easy to fix I think.
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Lattice2-ParaSeries weird behavior

Post by edwilliams16 »

openBrain wrote: Mon Jan 30, 2023 8:32 pm
If we want to fix the problem, we have to dig deeper, especially to now if recomputing of sketch between each individual value is launched by Lattice2 or intrinsically by Sketcher on value change.
That was my guess - that the constraint changes were being processed serially, but I didn't track it down in detail like you.

Is there a way to turn off the sketcher solver until all the constraints have been changed. i.e process them in parallel? It wouldn't surprise me if there wasn't, as allowing it might make the chance of flips increase dramatically.
matthyuz
Posts: 33
Joined: Sat Sep 16, 2017 8:01 pm

Re: Lattice2-ParaSeries weird behavior

Post by matthyuz »

Excellent analysis openBrain, it is clear where the defective segment comes from. In addition to why the result changes when changing the order of the segments.
It would be great if it was fixed.
Thank you.
Post Reply