Help about BRepOffsetAPI.makePipeShell usage.

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
onekk
Veteran
Posts: 6199
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Help about BRepOffsetAPI.makePipeShell usage.

Post by onekk »

Hello, I have some problem with pipeshell, documentation is not complete,

I have found this:

https://forum.freecadweb.org/viewtopic. ... 39#p168339

But the post is very old.
And say that there is no infomration:

meanwhile, I have found this:

https://dev.opencascade.org/doc/occt-7. ... 688390c4da

and deduced something in the txt file include.
BREP_pipehell.txt
(4.2 KiB) Downloaded 48 times
It is simply a copy and paste with some deduction.

Meanwhile I'm experimenting, but having mixed results, maybe the shapes are not correct and maybe I could put a MWE (Minimal Working Example) of the errors I have.

Maybe it is outdated and substituted by more manageable method.

Anyone know something about it?.

EDIT

Here a minimal example:
test_pipe.py
(4.99 KiB) Downloaded 42 times
The problem are some artifacts left and how to tune profile or path position to cut a regular Groove following the profile, like you will do when you made a shaped frame with router.

END EDIT

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
TheMarkster
Veteran
Posts: 5512
Joined: Thu Apr 05, 2018 1:53 am

Re: Help about BRepOffsetAPI.makePipeShell usage.

Post by TheMarkster »

I did not know about this BRepOffsetAPI. That looks very interesting. Here is how I would have done, but the results are the same:

Code: Select all

    rotated = profile.rotated(FreeCAD.Vector(0,0,0),FreeCAD.Vector(1,0,0),90)
    Part.show(rotated,"rotated")
    pipe = path.makePipeShell([rotated],True, False)# solid = True, Frenet = False
    Part.show(pipe,"pipe")
    
The results using the Gui are also the same when making a solid sweep of the rotated profile along the path object. There are self intersections at the corners.
Snip macro screenshot-138852.png
Snip macro screenshot-138852.png (118.4 KiB) Viewed 1532 times
Perhaps with a larger radius the self intersection can be avoided.
Snip macro screenshot-8a2bae.png
Snip macro screenshot-8a2bae.png (97.16 KiB) Viewed 1532 times
Or by aligning the profile to the outside of the path rather than to the inside.
Snip macro screenshot-690339.png
Snip macro screenshot-690339.png (96.68 KiB) Viewed 1532 times
Snip macro screenshot-a0572c.png
Snip macro screenshot-a0572c.png (115.51 KiB) Viewed 1532 times

Then you need to reduce the path to get the same final geometry.
Attachments
pipeshell.FCStd
(31.94 KiB) Downloaded 27 times
User avatar
onekk
Veteran
Posts: 6199
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Help about BRepOffsetAPI.makePipeShell usage.

Post by onekk »

Many thanks, I've had the same thinking, about the rotation position, but stupidly I have done some experimenting, surely in the wrong way. :D

NOTE: I don't mark as solved as it will be interesting maybe have some other comments. (hoping by some developers or @wmayer, @chrisb, @Chris_G I think are the most skilled in these sort of thing.)

BRepOffsetAPI.makePipeShell I think it is used internally by many sweep tools, that maybe make some assumption, at a first glance it is very customizable, in terms of parameters.

In fact a first glance to the differences between OCCT C API and FreeCAD show that many SetMode options are explicitly set as separate options.

As I'm not very skilled in mathematics, I've not be able to guess the trihedron thing, and related.

I think that SetMaxDegree, SetMaxSegments, setToleranceand setForceApproxC1 seems to be interesting to tune the "sweep".

But this is matter of other experiments.

Many thanks again and best regards.

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
Chris_G
Veteran
Posts: 2596
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Help about BRepOffsetAPI.makePipeShell usage.

Post by Chris_G »

Hi,
As you have already experienced, I think one golden rule is to try to design the path that has the highest curvatures, that is the most in the inside of the turns, to avoid to challenge the pipe algorithm with auto-intersections.

I tested the possibilities of BRepOffsetAPI.makePipeShell(), but I am not sure I fully understood all the modes :lol:

In Curves workbench I used 2 tools :
- Pipeshell Profile is a wrapper above a profile object to add the Location, Contact, Correction properties used in the add() method of pipeShell
- Pipeshell that uses these profiles

Although it offers many options, I finally stopped playing with it before understanding it completely.
User avatar
onekk
Veteran
Posts: 6199
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Help about BRepOffsetAPI.makePipeShell usage.

Post by onekk »

Chris_G wrote: Thu Jan 20, 2022 4:08 pm Hi,
As you have already experienced, I think one golden rule is to try to design the path that has the highest curvatures, that is the most in the inside of the turns, to avoid to challenge the pipe algorithm with auto-intersections.
....
Although it offers many options, I finally stopped playing with it before understanding it completely.
Thanks for answering, it's ever a pleasure to ear something from you, (side note: I've learned many thing reading your posts, many thanks.)

Other things, like trihedron and such obscure thing, are beyond my mathematical skills.

If some math expert would try to explain to my old brain things, I will be pleased to increase my knowledge, but maybe it will take some time to have a clear idea, i'm not very young (>50) so the brain is not very "elastic".

Many Thanks, from now, I have found some things, taken from the OCCT page for 7.5.0 and put them in the txt file included in the first post.

At least some findings, about the .add() are that (obj, True, True) is not the best way to position things, as the accurate placement is vanished by
"WithContact" and "WithCorrection", as it seem to also center the shape on the spline.
.Add(Profile, WithContact = Standard_False, WithCorrection = Standard_False)

Adds the section Profile to this framework. First and last sections may be punctual, so the shape Profile may be both wire
and vertex. Correspondent point on spine is computed automatically.

- WithContact is true, the section is translated to be in contact with the spine.

- WithCorrection is true, the section is rotated to be orthogonal to the spine?s tangent in the correspondent point.
This option has no sense if the section is punctual (Profile is of type TopoDS_Vertex).
for corners, i don't know this code:
test_pipe.py
(5.76 KiB) Downloaded 34 times
gave this result:
pipsh1.png
pipsh1.png (2.5 KiB) Viewed 1399 times
pipsh2.png
pipsh2.png (15.02 KiB) Viewed 1399 times
pipsh3.png
pipsh3.png (6.15 KiB) Viewed 1399 times
It is almost perfect, a small radius on the corners help to make smooth things, and some maths around will make a decent parametric object.
Some lengths have to be added around, so there is many small amounts (like 0.1, 0.25, and so on) to avoid fails on some fillets calculations.

As the resulting has to be 3d printed, such small tolerances are not a problem.

I'm tempted to try to use similar technique to create fillets, on complex shapes, this is another experiment to be done.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply