[PR#3775] Add Wire Orders property to Part Design Loft
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Veteran
- Posts: 5505
- Joined: Thu Apr 05, 2018 1:53 am
[PR#3775] Add Wire Orders property to Part Design Loft
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: 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.
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:
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:
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.
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: 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.
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:
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:
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.
Re: [PR#3775] Add Wire Orders property to Part Design Loft
Great improvement! And - considering toponaming and stability - implemented in the best way I can think of.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.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [PR#3775] Add Wire Orders property to Part Design Loft
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.
Re: [PR#3775] Add Wire Orders property to Part Design Loft
I see now that your feature is something different / independent.
What I meant are lofts with several sections. take for example this file: 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.
-
- Veteran
- Posts: 5505
- Joined: Thu Apr 05, 2018 1:53 am
Re: [PR#3775] Add Wire Orders property to Part Design Loft
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.
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.
Re: [PR#3775] Add Wire Orders property to Part Design Loft
Not yet.TheMarkster wrote: ↑Wed Aug 05, 2020 1:32 am Notice changing the order of the sketches isn't one of the triggers.
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.
Re: [PR#3775] Add Wire Orders property to Part Design Loft
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.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.
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.
-
- Veteran
- Posts: 5505
- Joined: Thu Apr 05, 2018 1:53 am
Re: [PR#3775] Add Wire Orders property to Part Design Loft
I have some ideas for this.wmayer wrote: ↑Thu Aug 06, 2020 1:10 pmIMO, 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.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.
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.
-
- Veteran
- Posts: 5505
- Joined: Thu Apr 05, 2018 1:53 am
Re: [PR#3775] Add Wire Orders property to Part Design Loft
I have some working code, but I want to do some additional tweaking and testing. Here are a few screenshots:wmayer wrote: ↑Thu Aug 06, 2020 1:10 pmIMO, 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.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.
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.
With the Preview checkbox unchecked we can more easily see the wire colors:
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.
Re: [PR#3775] Add Wire Orders property to Part Design Loft
Very promising!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.