Ticket #2187 - Unusable Wire from Section

Need help, or want to share a macro? Post here!
User avatar
DeepSOIC
Posts: 6949
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Unusable Wire from Section

Postby DeepSOIC » Sat Jun 09, 2018 11:12 pm

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
Posts: 6949
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Unusable Wire from Section

Postby DeepSOIC » Sat Jun 09, 2018 11:13 pm

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

Re: Unusable Wire from Section

Postby UR_ » Sun Jun 10, 2018 8:19 am

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
Posts: 1103
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Unusable Wire from Section

Postby Chris_G » Sun Jun 10, 2018 10:25 am

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
Posts: 1103
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Unusable Wire from Section

Postby Chris_G » Sun Jun 10, 2018 4:14 pm

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 181 times