[finished] project: Making Part Extrude taking care of inner structure

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
davidosterberg
Posts: 529
Joined: Fri Sep 18, 2020 5:40 pm

Re: project: Making Part Extrude taking care of inner structure

Post by davidosterberg »

uwestoehr wrote: Sun Jan 16, 2022 3:47 pm As I wrote, your method should first be use for PD Loft.
Ok. I thought that you meant something else because this does not quite make sense to me. Loft will loft between two sections. Why would we want to apply a taper angle there?

Anyway. I made the PR mostly as a proof of concept. As an alternative, perhaps simpler, way to to implement FeaturePad with taper angle. I will not fight anybody over this. If FreeCAD chooses to use the Loft method I will simply close the PR. It was fun as an experiment.

Perhaps I will port Realthunders linearization methods to master instead.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: project: Making Part Extrude taking care of inner structure

Post by chrisb »

uwestoehr wrote: Sun Jan 16, 2022 3:47 pm It appears that this method leads always to splines, even if the 2 sections are e.g. rectangles.
Not sure if it helps, but that's not always the case. I was surprised that loft can even create cones.

In the attached file
- the red faces are planes
- the blue face is a BSplineSurface
- the yellow face is a cone
SnipScreenshot-58c93b.png
SnipScreenshot-58c93b.png (25.67 KiB) Viewed 1271 times
Attachments
loftedFaces_cb.FCStd
(15.52 KiB) Downloaded 25 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: project: Making Part Extrude taking care of inner structure

Post by adrianinsaval »

uwestoehr wrote: Sun Jan 16, 2022 3:47 pm As I wrote, your method should first be use for PD Loft. PD Loft takes 2 sections and builds a shell around them. It appears that this method leads always to splines, even if the 2 sections are e.g. rectangles. So let's improve the situation and use your proposal for PD Loft. This way we can also stress-test your solution with existing test cases.

If it works there well for different test cases it can be implemented also for Part Extrude.
I don't think this applies to loft, how would you make something like this using extrude+draft? it makes no sense
Attachments
randomLoft.png
randomLoft.png (18.98 KiB) Viewed 1261 times
randomLoft.FCStd
(28.75 KiB) Downloaded 21 times
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: project: Making Part Extrude taking care of inner structure

Post by chrisb »

You are right, lofts can be more complicated than anything doable with a pad. Even more so as they can have more than two sections. But as you can see from my example above, there is room for optimizations.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: project: Making Part Extrude taking care of inner structure

Post by adrianinsaval »

chrisb wrote: Sun Jan 16, 2022 9:26 pm But as you can see from my example above, there is room for optimizations.
Probably yes, not with draft though, and it definitively doesn't make sense to let david's PR in the void to somehow try and use draft on loft first :?
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: project: Making Part Extrude taking care of inner structure

Post by uwestoehr »

davidosterberg wrote: Sun Jan 16, 2022 4:23 pm Ok. I thought that you meant something else because this does not quite make sense to me. Loft will loft between two sections. Why would we want to apply a taper angle there?
It seems we have a misunderstanding. To clarify how it currently works:

PD Loft:
- take e.g. 2 sketches and build a shell between them
identified problem: the shell is always a spline -> this should be fixed

Part Extrude:
- take e.g. a single sketch, duplicate it and offset the duplicate according to the given taper angle
- do the same for the second direction and second taper angle
- take all sketches and build a shell
identified problems:
- the shell is always a spline -> this should be fixed
- inner wires are not handles

So one Extrude issue is solved by applying the Loft code and the Loft issue is hopefully resolved by your proposal.

Therefore the stages are
1. fix Loft
2. use the loft code for Part Extrude
3. make PD pad use the same code than Part Extrude
davidosterberg wrote: Sun Jan 16, 2022 4:23 pm If FreeCAD chooses to use the Loft method I will simply close the PR. It was fun as an experiment.
Please not. I hope this post makes clear what my strategy is. So when it works out well your method will be used by 3 different features.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: project: Making Part Extrude taking care of inner structure

Post by uwestoehr »

adrianinsaval wrote: Sun Jan 16, 2022 7:19 pm I don't think this applies to loft, how would you make something like this using extrude+draft? it makes no sense
A loft is built taking 2 sections and a shell is build around their wires. This is the same method used by extrude, see my previous post (it doesn't matter that for Extrude the sections are parallel or and for Lofts they are not necessarily parallel).
The used OCC function is in both cases

Code: Select all

BRepOffsetAPI_ThruSections
see https://github.com/FreeCAD/FreeCAD/blob ... n.cpp#L476
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: project: Making Part Extrude taking care of inner structure

Post by chrisb »

adrianinsaval wrote: Sun Jan 16, 2022 10:10 pm Probably yes, not with draft though, and it definitively doesn't make sense to let david's PR in the void to somehow try and use draft on loft first :?
Of course! If loft is used, it can be expected that the result is something complex.
uwestoehr wrote: Sun Jan 16, 2022 11:28 pm Part Extrude:
- take e.g. a single sketch, duplicate it and offset the duplicate according to the given taper angle
- do the same for the second direction and second taper angle
- take all sketches and build a shell
Wasn't David's approach a different one by not using Loft? If it is easy, then why not, but the cases occurring in Extrude and Pad are very limited in contrast to arbitrary lofts:

Pad/Extrude: If you have a straight line in the sketch, it will create a plane.
Loft: a straight line does not necessarily create a plane, not even if you have both sketches made solely from straight lines.

That means that the decision if a plane can be used is easier for Extrude/Pad than for Loft.
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: project: Making Part Extrude taking care of inner structure

Post by uwestoehr »

uwestoehr wrote: Sun Jan 16, 2022 11:28 pm - take e.g. 2 sketches and build a shell between them
identified problem: the shell is always a spline -> this should be fixed
@david, I had a look at your PR and this uses BRepOffsetAPI_DraftAngle
https://dev.opencascade.org/doc/refman/ ... angle.html

But this function needs an existing shape. So it cannot be used for PD Loft

It can be used for Part Extrude but then I misunderstand part of the discussion. The complaint was that PD Loft creates spline shells.

However, let's put PD Loft aside and focus in the initial post of this thread.

We have the issue that Part Extrude cannot handle inner structures. Your PR obviously can provide this. Could your therefore please make a PR that is for Part Extrude so that the whole functionality of Part Extrude is kept?

What I like with your approach is that we don't need to make wire offset operations.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: project: Making Part Extrude taking care of inner structure

Post by adrianinsaval »

uwestoehr wrote: Sun Jan 16, 2022 11:59 pm @david, I had a look at your PR and this uses BRepOffsetAPI_DraftAngle
https://dev.opencascade.org/doc/refman/ ... angle.html

But this function needs an existing shape. So it cannot be used for PD Loft

It can be used for Part Extrude but then I misunderstand part of the discussion.
I don't like to be that guy but really: this is what I've been trying to tell you and so have david and chris, this method is not applicable to Loft but you have just dismissed it every time apparently without trying to comprehend what we were proposing.
The complaint was that PD Loft creates spline shells.

However, let's put PD Loft aside and focus in the initial post of this thread.
The underlying complaint wasn't about the loft tool it was about the use of loft method in Pad/Extrude. We wanted Pads with planar faces, not necessarily lofts (although it would be nice too when it suits).

Sorry if I sound rude, it was a little frustrating having to say it over and over.
Post Reply