[PR#3775] Add Wire Orders property to Part Design Loft

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

[PR#3775] Add Wire Orders property to Part Design Loft

Post by TheMarkster »

https://github.com/FreeCAD/FreeCAD/pull/3775

In Part Design Loft where the sketches have inner wires and outer wires, example a circle inside another circle, the wires get connected based not on which is inner and which is outer, but rather based on the order of creation. This PR provides a means for the user to direct FreeCAD to use a particular wire order.

Here is an example of such a file with the wires crossed:
1590BB tayda loft test.FCStd
(87.63 KiB) Downloaded 121 times
In this image I have the Wire Orders property selected and the editor brought up. This is type App::PropertyStringList, which the code converts internally back and forth between an array of strings and a 2-dimensional array of integers.
Snip macro screenshot-74c788.png
Snip macro screenshot-74c788.png (167.33 KiB) Viewed 4446 times
The default sequence is to use the wires in the order in which they were created chronologically, that is 0;1 (wire #0 first, then wire #1 as this is 0-indexed). By switching one of the wire orders for one of the sketches around, we can resolve the issue:
Snip macro screenshot-b049bf.png
Snip macro screenshot-b049bf.png (142.97 KiB) Viewed 4446 times
We are not modifying the sketches. We are modifying how the Loft tool chooses the wire order in making the loft.

In this instance when attempting to do a subtractive loft with the same 2 sketches (subtracting from an existing Pad) the subtractive loft fails with this error message:
Snip macro screenshot-92084a.png
Snip macro screenshot-92084a.png (57.62 KiB) Viewed 4446 times
In this case we can switch to the Model tab and fix it in the same manner as with the additive loft while the Subtractive Loft tab is still open, and then return to the Task tab to finish the operation.
Snip macro screenshot-848e29.png
Snip macro screenshot-848e29.png (149.95 KiB) Viewed 4446 times
chrisb
Veteran
Posts: 53933
Joined: Tue Mar 17, 2015 9:14 am

Re: [PR#3775] Add Wire Orders property to Part Design Loft

Post by chrisb »

TheMarkster wrote: Tue Aug 04, 2020 1:52 am We are not modifying the sketches. We are modifying how the Loft tool chooses the wire order in making the loft.
Great improvement! And - considering toponaming and stability - implemented in the best way I can think of.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [PR#3775] Add Wire Orders property to Part Design Loft

Post by uwestoehr »

Great improvement!

I only have one remark because I cannot test it right now if this is already the case or not: Werner and I implemented last week for the PD pattern features that one can change the order in the dialog. The task there is the same as for lost - the order matters.
So to be consistent, it would be nice if the loft dialog could behave the same as the pattern dialogs: just drag a feature to the desired position. The loft will take the first feature in the list as the first one for the loft.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [PR#3775] Add Wire Orders property to Part Design Loft

Post by uwestoehr »

uwestoehr wrote: Wed Aug 05, 2020 12:39 am So to be consistent, it would be nice if the loft dialog could behave the same as the pattern dialogs: just drag a feature to the desired position. The loft will take the first feature in the list as the first one for the loft.
I see now that your feature is something different / independent.

What I meant are lofts with several sections. take for example this file:
loft-List.FCStd
Loft with several sections
(176.7 KiB) Downloaded 89 times
there it is important how the loft sections are ordered.
So I will change the next days that the loft dialog that it will behave like the pattern dialogs.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: [PR#3775] Add Wire Orders property to Part Design Loft

Post by TheMarkster »

There could potentially be some confusion for a user if he changes the order of the sketches in the sections because the Wire Orders property will not see that as a change requiring it to rebuild itself, and the order of the names in the Wire Orders property will not change. Those names are there only for the user's convenience. The Wire Orders will be set according to the order the sketches appear in the Sections property.

Here are the triggers that will cause the Wire Orders property to be reset to defaults:

* a change in the number of sketches used for the loft
* a change in the number of wires per sketch
* clearing out the Wire Orders property and setting back to the empty string list

Notice changing the order of the sketches isn't one of the triggers.

It might be better to remove the names of the sketches and replace them with more generic "Profile", "Section1", "Section2", "Section3", etc. "Section1" being the first sketch in the Sections property, etc. Otherwise the user could be confused into thinking the Wire Order for "Sketch005" will still be the same because "Sketch005" is still on that same line.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [PR#3775] Add Wire Orders property to Part Design Loft

Post by uwestoehr »

TheMarkster wrote: Wed Aug 05, 2020 1:32 am Notice changing the order of the sketches isn't one of the triggers.
Not yet.
I will not do anything unless our PR went in of course. Then I will play around with the feature to see the new behavior. Maybe the section ordering has to be done different from what I have in mind at the moment.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [PR#3775] Add Wire Orders property to Part Design Loft

Post by wmayer »

TheMarkster wrote: Tue Aug 04, 2020 1:52 am In this image I have the Wire Orders property selected and the editor brought up. This is type App::PropertyStringList, which the code converts internally back and forth between an array of strings and a 2-dimensional array of integers.
IMO, trying to change the order this way is very difficult because a lot of guess work is needed to get things right. In your example you have a simple sketch with only two boundaries so it's pretty easy as there are only two possibilities. But imagine a sketch with four screw holes. Here you have only five boundaries but already 120 (=5!) possibilities of different orders.

Instead of letting the user figure out the orders and type that manually I think we need a graphical utility. This can work like this:
* there is one reference section which the other sections must be consistent to
* each boundary of the reference is shown in a different color
* when editing the order of another section a list box is used. Its boundaries are shown in the colors of the reference section
* now the user manually changes the items in the list box until everything matches
* when an item in the list box is selected the boundary in the 3d view must be highlighted/selected

To save the orders of the sections it's best to replace the PropertyLinkList property with PropertyLinkSubList as there the order can be explicitly saved.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: [PR#3775] Add Wire Orders property to Part Design Loft

Post by TheMarkster »

wmayer wrote: Thu Aug 06, 2020 1:10 pm
TheMarkster wrote: Tue Aug 04, 2020 1:52 am In this image I have the Wire Orders property selected and the editor brought up. This is type App::PropertyStringList, which the code converts internally back and forth between an array of strings and a 2-dimensional array of integers.
IMO, trying to change the order this way is very difficult because a lot of guess work is needed to get things right. In your example you have a simple sketch with only two boundaries so it's pretty easy as there are only two possibilities. But imagine a sketch with four screw holes. Here you have only five boundaries but already 120 (=5!) possibilities of different orders.

Instead of letting the user figure out the orders and type that manually I think we need a graphical utility. This can work like this:
* there is one reference section which the other sections must be consistent to
* each boundary of the reference is shown in a different color
* when editing the order of another section a list box is used. Its boundaries are shown in the colors of the reference section
* now the user manually changes the items in the list box until everything matches
* when an item in the list box is selected the boundary in the 3d view must be highlighted/selected

To save the orders of the sections it's best to replace the PropertyLinkList property with PropertyLinkSubList as there the order can be explicitly saved.
I have some ideas for this.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: [PR#3775] Add Wire Orders property to Part Design Loft

Post by TheMarkster »

wmayer wrote: Thu Aug 06, 2020 1:10 pm
TheMarkster wrote: Tue Aug 04, 2020 1:52 am In this image I have the Wire Orders property selected and the editor brought up. This is type App::PropertyStringList, which the code converts internally back and forth between an array of strings and a 2-dimensional array of integers.
IMO, trying to change the order this way is very difficult because a lot of guess work is needed to get things right. In your example you have a simple sketch with only two boundaries so it's pretty easy as there are only two possibilities. But imagine a sketch with four screw holes. Here you have only five boundaries but already 120 (=5!) possibilities of different orders.

Instead of letting the user figure out the orders and type that manually I think we need a graphical utility. This can work like this:
* there is one reference section which the other sections must be consistent to
* each boundary of the reference is shown in a different color
* when editing the order of another section a list box is used. Its boundaries are shown in the colors of the reference section
* now the user manually changes the items in the list box until everything matches
* when an item in the list box is selected the boundary in the 3d view must be highlighted/selected

To save the orders of the sections it's best to replace the PropertyLinkList property with PropertyLinkSubList as there the order can be explicitly saved.
I have some working code, but I want to do some additional tweaking and testing. Here are a few screenshots:
Snip macro screenshot-d79b7c.png
Snip macro screenshot-d79b7c.png (272.06 KiB) Viewed 4024 times
With the Preview checkbox unchecked we can more easily see the wire colors:
Snip macro screenshot-4432aa.png
Snip macro screenshot-4432aa.png (185.47 KiB) Viewed 4024 times
The orange outer wire in Sketch001 (2nd from bottom) needs to be red to match the others. So we select the wire next to the orange color bar and move it up 3 positions to the red bar.
Snip macro screenshot-bab957.png
Snip macro screenshot-bab957.png (200.87 KiB) Viewed 4024 times
Snip macro screenshot-54073c.png
Snip macro screenshot-54073c.png (190.66 KiB) Viewed 4024 times
chrisb
Veteran
Posts: 53933
Joined: Tue Mar 17, 2015 9:14 am

Re: [PR#3775] Add Wire Orders property to Part Design Loft

Post by chrisb »

Very promising!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply