Proposal of some Loft and Pipe refactoring

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Fat-Zer
Posts: 176
Joined: Thu Oct 30, 2014 10:38 pm

Proposal of some Loft and Pipe refactoring

Post by Fat-Zer »

As for now Loft and Pipe features are considered to be ProfileBased features that leads to their quite unnatural structure: they both have a single base Profile and several additional Sections. This could make some sense for a pipe, because it could have only one section, but it's very confusing for lofts where sections considered to be more or less equal. Besides that, such structure leads to that Loft and Pipe has additional properties like "MidPlain" and "Reverse" which don't make any sense for them either.


I want to propose to refactor them:
- Make them direct descendent of AddSubFeature
- Move some common code Loft&Pipe utilize from ProfileBased into static methodes
- Add automatic migration for Loft&Pipe themself (shouldn't be hard)
- Refactor UI accordingly

As consequence those features will look much more straight forward from both user POV and internal structure.
Forward compatibility will be somewhat lost, but backward (with silent convert upon opening) should be intact.

Your thoughts?
chrisb
Veteran
Posts: 54155
Joined: Tue Mar 17, 2015 9:14 am

Re: Proposal of some Loft and Pipe refactoring

Post by chrisb »

Moved from Part Design module development forum.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 54155
Joined: Tue Mar 17, 2015 9:14 am

Re: Proposal of some Loft and Pipe refactoring

Post by chrisb »

Fat-Zer wrote: Mon Mar 06, 2023 1:27 am As for now Loft and Pipe features are considered to be ProfileBased features that leads to their quite unnatural structure: they both have a single base Profile and several additional Sections. This could make some sense for a pipe, because it could have only one section, but it's very confusing for lofts where sections considered to be more or less equal.
I don't understand this. When a loft has equal sections, a pad should be used instead.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Fat-Zer
Posts: 176
Joined: Thu Oct 30, 2014 10:38 pm

Re: Proposal of some Loft and Pipe refactoring

Post by Fat-Zer »

chrisb wrote: Mon Mar 06, 2023 7:26 am I don't understand this. When a loft has equal sections, a pad should be used instead.
I meant "equal" as in "equal rights" =). i.e. the first section is just the first one of its peers; there is nothing intrinsically different about it from other sections.
chrisb
Veteran
Posts: 54155
Joined: Tue Mar 17, 2015 9:14 am

Re: Proposal of some Loft and Pipe refactoring

Post by chrisb »

Fat-Zer wrote: Mon Mar 06, 2023 8:45 am I meant "equal" as in "equal rights" =). i.e. the first section is just the first one of its peers; there is nothing intrinsically different about it from other sections.
Aah, I understand. That's indeed an imbalance. And it is more than just an aesthetic thing, because it is possible to reorder the sections, but the first one remains always the first. I use this reordering very rarely but I remember that I once wanted to exchange the first section with another one which was not as straight forward as expected.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
adrianinsaval
Veteran
Posts: 5544
Joined: Thu Apr 05, 2018 5:15 pm

Re: Proposal of some Loft and Pipe refactoring

Post by adrianinsaval »

sounds like a good idea to me, the nonsensical properties could be just made to be hidden properties here I think, but the argument about the first profile not being any different from the rest is a very good argument, unifying them could also allow for reordering of profiles I think. @chrisb Part design development was a correct place to put this IMO, did you move this for visibility? In any case it should go into developers corner I think, I don't know if many devs lurk in open discussions as there can be many many post around here. @Fat-Zer I suggest creating a github issue for this and later mention that in a PR if you make one.

Since ProfileBased is also a good description for these features, could it make more sense to just extend or modify it so that it can have a profile list too and just hide the not relevant properties?
chrisb
Veteran
Posts: 54155
Joined: Tue Mar 17, 2015 9:14 am

Re: Proposal of some Loft and Pipe refactoring

Post by chrisb »

adrianinsaval wrote: Mon Mar 06, 2023 12:33 pm @chrisb Part design development was a correct place to put this IMO, did you move this for visibility? In any case it should go into developers corner I think, I don't know if many devs lurk in open discussions as there can be many many post around here.
I had indeed pondered a while over the correct place: PartDesign seemed inappropriate, because there is also Part->Loft, and they should both be considered. As it is not purely an implementation detail I didn't place it in the developers forum, but here in Open discussion, where the impact on the user interface can also be discussed.
@Fat-Zer I suggest creating a github issue for this and later mention that in a PR if you make one.
+1
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
adrianinsaval
Veteran
Posts: 5544
Joined: Thu Apr 05, 2018 5:15 pm

Re: Proposal of some Loft and Pipe refactoring

Post by adrianinsaval »

Implementation wise PD loft and pipe are independent of their Part WB counterpart AFAIK, furthermore this:
Besides that, such structure leads to that Loft and Pipe has additional properties like "MidPlain" and "Reverse" which don't make any sense for them either.

I want to propose to refactor them:
- Make them direct descendent of AddSubFeature
- Move some common code Loft&Pipe utilize from ProfileBased into static methodes
is exclusively related to PD
chrisb
Veteran
Posts: 54155
Joined: Tue Mar 17, 2015 9:14 am

Re: Proposal of some Loft and Pipe refactoring

Post by chrisb »

adrianinsaval wrote: Mon Mar 06, 2023 4:09 pm Implementation wise PD loft and pipe are independent of their Part WB counterpart AFAIK,
You are right, in Part workbench all sections are in the same list "Sections", nothing distinguishes the first sketch - except the position in the list.
As there are no other user comments, I move the topic back to PartDesign development.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply