Ticket #2187 - Unusable Wire from Section

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Unusable Wire from Section

Post by DeepSOIC »

Kunda1 wrote: Sat Jun 09, 2018 1:24 pm Should we open an upstream ticket about this ?
Maybe...

Or we can just roll our own implementation, like my macro.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Unusable Wire from Section

Post by DeepSOIC »

BTW, OCC BOPs offer a method to extract section edges, so the implementation can be even simpler than mine.
UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: Unusable Wire from Section

Post by UR_ »

OCC docs shows a code snipplet, howto obtain a bspline (up to max 8th degree)

Code: Select all

Example : giving two shapes S1,S2 accessing faces, let compute the section edges R on S1,S2, performing approximation on new curves, performing PCurve on part 1 but not on part 2 : 
  
  Standard_Boolean PerformNow = Standard_False; 
  BRepBoolAPI_Section S(S1,S2,PerformNow); 
  S.ComputePCurveOn1(Standard_True);
  S.Approximation(Standard_True); 
  S.Build(); 
  TopoDS_Shape R = S.Shape();
source: https://www.opencascade.com/doc/occt-6. ... ction.html

while FreeCAD is doing only:
"...\src\Mod\Part\App\FeaturePartSection.cpp"

Code: Select all

BRepAlgoAPI_BooleanOperation* Section::makeOperation(const TopoDS_Shape& base, const TopoDS_Shape& tool) const
{
    // Let's call algorithm computing a section operation:
    return new BRepAlgoAPI_Section(base, tool);
}
Better should be tested before tickling their tracker :D
User avatar
Chris_G
Veteran
Posts: 2593
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Unusable Wire from Section

Post by Chris_G »

UR_ wrote: Sun Jun 10, 2018 8:19 am OCC docs shows a code snipplet, howto obtain a bspline (up to max 8th degree)
Good catch !
From OCC BRepAlgo_Section the intersection shape is:
analytic where possible ... or a succession of points grouped together in a BSpline curve of degree 1
So the OCC algo is not faulty. It works how it is supposed to.
But adding the Approximation option to Part.Section would indeed be pretty useful.
User avatar
Chris_G
Veteran
Posts: 2593
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Unusable Wire from Section

Post by Chris_G »

PR 1507 adds the Approximation option to Part.Section.
I hope my PR is good, because C++ is not easy for me. :oops: ... fingers crossed.
Here is the result of the sweep of the original post, with Approximation enabled on the section curve :

good_sweep.jpeg
good_sweep.jpeg (29.72 KiB) Viewed 781 times
Post Reply