[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!
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

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

Post by chrisb »

adrianinsaval wrote: Mon Jan 17, 2022 12:46 am this is what I've been trying to tell you and so have david and chris, this method is not applicable to Loft
I can confirm, that this was indeed my intention. And I agree that it would be appreciated, if loft can be improved, but that's another story.
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 »

adrianinsaval wrote: Mon Jan 17, 2022 12:46 am 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.
It is not dismissing but not understanding since the thread jumps around.
I find this thread very confusing because what do we want?:

- a method to make Part Extrude handle inner wires

But here are debates about shells being splines or not. Then proposals are made which do not keep the existing functionality of Part Extrude. But the topic here is to keep all functionality of Part Extrude PLUS the inner wire handling.

I am open for every proposal but it must fulfill the goal. Now I had a closer look at David's PR and see that it cannot be used for Loft. But the Extrude feature is actually a loft through 2 or 3 sections. Since every shape can be extruded (e.g. a circular B-Spline), this functionality must be kept. There are tons of existing CAD files around using Part Extrude so an improved Extrude must be able to handle them all and cannot cut functionality.
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

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

Post by chrisb »

uwestoehr wrote: Mon Jan 17, 2022 1:45 am I am open for every proposal but it must fulfill the goal.
We completely agree on this one, and the goal is to improve Pad/Extrude.
Now I had a closer look at David's PR and see that it cannot be used for Loft. But the Extrude feature is actually a loft through 2 or 3 sections. Since every shape can be extruded (e.g. a circular B-Spline), this functionality must be kept. There are tons of existing CAD files around using Part Extrude so an improved Extrude must be able to handle them all and cannot cut functionality.
The difference between your approach and what David has made is:
  • You want to have an implementation where every pad is a special loft. That Loft would create plane faces and cones whereever possible.
    That would even allow B-spline edges in angled pads/extrudes, which is currently not possible.
  • The other approach comes from the other side: do as much as possible using methods where we know in advance that plane faces and cones can do the job. And if that's not possible, e.g. due to B-spline edges involved, then a Loft is used. David had talked about a loft fallback solution. In that case Loft could remain completely untouched.
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 »

chrisb wrote: Mon Jan 17, 2022 6:17 am
  • You want to have an implementation where every pad is a special loft.
Part Extrude does this already. We cannot change this without breaking existing documents. So it is not about what I want.
chrisb wrote: Mon Jan 17, 2022 6:17 am [*]The other approach comes from the other side: do as much as possible using methods where we know in advance that plane faces and cones can do the job. And if that's not possible, e.g. due to B-spline edges involved, then a Loft is used. David had talked about a loft fallback solution. In that case Loft could remain completely untouched.
But the topic of this thread it to take the existing Extrude feature, keep all its functionality and fix the inner wire handling. So when the loft is untouched, we don't get the inner wire handling fixed.

So we divide here into two branches:
Branch A: the initial topic
Branch B: in case we can use Drafts, do this instead of a loft

To sort this out, PR https://github.com/FreeCAD/FreeCAD/pull/5367 does Branch A. This works now :D :

FreeCAD_VRzMP3esJg.gif
FreeCAD_VRzMP3esJg.gif (406.03 KiB) Viewed 1284 times
FreeCAD_3peSPJqXL4.gif
FreeCAD_3peSPJqXL4.gif (176.72 KiB) Viewed 1284 times

When this is in, I would like if David could make a PR with his Draft method where he uses the loft as fallback. @ david, please make the PR for Part Extrude.

Concerning PD Pad/Pocket, as I agreed with wmayer, it should use the code of Part Extrude, but before an infrastructure PR is necessary. Therefore we focus here on Part Extrude purposely.
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 »

TheMarkster wrote: Tue Jan 11, 2022 5:20 pm With this change (setting solid to false on line 533) it works well for me on OCCT 7.5.2:
Not completely:
- the inner wires must get the opposite offset to make the feature useful in practice (molds etc.)
- it fails if an inner wires is a circle (single-edge wire). This is the case if e.g. a sketch is not a compound but a shape consisting of different wires.

I found now a suitable workaround and quick tests show for me that PR https://github.com/FreeCAD/FreeCAD/pull/5367 works now as it should.
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: Mon Jan 17, 2022 12:25 pm I found now a suitable workaround and quick tests show for me that PR https://github.com/FreeCAD/FreeCAD/pull/5367 works now as it should.
Thanks to @adrianinsaval I found out that my concept of taking the existing PD Loft code fails when there are several solids as results.

I implemented now the approach that also @realthunder uses - create the extrude solid by cut operations. This works also for tricky cases like this one:
Image


Please try out the PR and give feedback. (The PR contains some commented-out debug code that i will remove of course later.)
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 »

The PR is in master.

Now also nestings to several levels are supported:
FreeCAD_ThrK2pMOcg.png
FreeCAD_ThrK2pMOcg.png (32.74 KiB) Viewed 1072 times
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

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

Post by chrisb »

Nice!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
kisolre
Veteran
Posts: 4164
Joined: Wed Nov 21, 2018 1:13 pm

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

Post by kisolre »

A report shows that real sketch points are not handled: https://forum.freecadweb.org/viewtopic.php?f=3&t=65825
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 »

kisolre wrote: Sun Jan 30, 2022 6:44 pm A report shows that real sketch points are not handled: https://forum.freecadweb.org/viewtopic.php?f=3&t=65825
Please keep this thread clean to keep its focus. This thread is about making Part Extrude taking care of inner structure. Straight extrusion is not touched.
Post Reply