For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Problem with BRepFeat_SplitShape

Macedo's picture
Forums: 

Hi,

I'm having problems with BRepFeat_SplitShape. I'm trying to Split one face in two.
I have a face and a curve that lays down on it entirely. (It's not a circle or a closed curve, just a curve like a line)
Method Build (from BRepFeat_SplitShape) is returning 110 as Error Status.

Could someone help me with this problem or give a hint how to do in a other way?

Thanks in advace!
Regards

Macedo's picture

Sorry I wrote fool things above...

My problem is... Build() method is Raising a exception when I've tried to split the FACE from (face.brep that comes with OpenCascade) and a Curve ((0.0; 0.0; 0.0);(1000.0;1000.0;1000.0)).
When I changed the face by another one, created by me (just a square), worked fine!

Could someone help me?

Thanks in advance!
Regards

Bearloga's picture

BRepFeat_SplitShape is a very capricious functionality. The input data for it must be thoroughly prepared. It requires that:
- every splitting edge had pcurve on underlying surface. For that you can manually project 3D curve on surface, restrict the result by boundaries and put the result pcurve into edge, or you can allow ShapeFix classes to do it for you.
- on each face that is to be split, all edges must form a closed contour inside the face boundaries, or if the chain of edges is open then it must be started and ended on the face boundaries.
When you use a simple planar face existence of pcurves is not necessary, as in OCC shapes is used not to store pcurves on planes, they are created anew each time on request to BRep_Tool::CurveOnCurface.
Good luck

Macedo's picture

Hello Bearloga,

Thanks for your help! =)
In this example (face.brep) I have 4 EDGES connected and 2 CIRCLES making 2 holes.
What should I have to do?

Is there another way to split a face? (or a easier way? =D )

Thanks in Advance,
Regards.

Bearloga's picture

More simple way (and more expensive) is to use boolean operations. Create a cutting tool by extrusion of your edges in direction nearly perpendicular to the face (using MakePrism algorithm) and cut it from your face.

Gheorghiu's picture

Hello Bearloga and hello all,

I suppose that you have some experience with BRepFeat_SplitShape and maybe you can give me some good advice.

I have to split a shell (obtained using BRepOffsetAPI_ThruSections, not a planar surface), with a curve (the points are given).

First, I will explain what I did:
1) First, I made from points a new shell, get the section between this new shell and the first one (using BRepAlgoAPI_Section) and made the split using BRepFeat_SplitShape. All ok.

But, I would like NOT TO USE BRepAlgoAPI_Section because it takes too long for what I need.

2) Second, I tried like this: for the beginning I took the set of curves resulted from BRepAlgoAPI_Section (should be ok). Because I whant at the end to start from a set of points, I suppose the points and the curves are not exactly on the shell I what to split, and therefore I project the curves on the shell, find the corresponding face and add the set edge-face to BRepFeat_SplitShape. But this is no more ok. I have an error when calling BRepFeat_SplitShape::Build.

That is THE PROBLEM: Regrettably I still have this error and I do not kow why. That is what I tried:

You wrote:
“on each face that is to be split, all edges must form a closed contour inside the face boundaries, or if the chain of edges is open then it must be started and ended on the face boundaries.”

I verified that my edges are connected. I extended the extreme edges to be sure that the projection will be entirely on the shell (it is an open wire).

And, you wrote:
“every splitting edge had pcurve on underlying surface. For that you can manually project 3D curve on surface, restrict the result by boundaries and put the result pcurve into edge, or you can allow ShapeFix classes to do it for you.”

1)
I tried to use ShapeFix_Edge:: FixAddPCurve but I believe I did not use it right, or I did not used what I should use, because I still had the erorr by BRepFeat_SplitShape::Build.

2)
Then, I tried:

TopoDS_Edge ep;
//let say it is one edge projection on the shell to be split
TopoDS_Face face;
//this is the corresponding face
BRepFeat_SplitShape brepSplit(shellShape);
………
Handle(Geom2d_Curve) hC;
Standard_Real aToler= 1.; //big!
BOPTools_Tools2D::CurveOnSurface(ep,face,hC, aToler, true) ;
Handle(Geom_Surface) S= BRep_Tool::Surface (face);
edc= BRepBuilderAPI_MakeEdge(chdl, S);
brepSplit.Add(ep, face);

I still have the error!

What is going wrong? Where is my mistake? What should I do now?

Can you or anyone please give me a good advice?

Thanks!

Gheorghiu's picture

Hello all,

I tested:
1)
Standard_Boolean haspc = BOPTools_Tools2D::HasCurveOnSurface (edge, face); -> haspc = 1 -> the resulted edge projection has a pcurve on surface
2)
We can build a wire using the resulted edge projections.
3)Projection was made with the last parameter of the BRepProj_Projection constructor =Standard_True

Any other ideas?

I would expected to have no dificulties because the edges I use to project on the shell are allready there, on the shell (I obtained them using BRepAlgoAPI_Section)!

Thank you in advance for any suggestion!

Macedo's picture

Hello Gheorghiu

Here it's working in this way:
1- Explore the SHELL in FACES
2- Project the EDGE on each FACE
3- Use the BRepFeat_SplitShape for each projected EDGE and its respective FACE
4- Then you make 2 new SHELLs

I hope helped you!
Best Regards,

Gheorghiu's picture

Hello Thiago Macedo,

Thank you for answer.

I did the steps 1,3,4 using the edges resulted from BRepAlgoAPI_Section (without projection, the edges are allready on the faces, without using HasAncestorFaceOn1) and calculating the distance between the edge vertexes and the face, to find the corresponding face. All ok.

I did then the steps 1 to 4 using the edges resulted from BRepAlgoAPI_Section but with projection. I have error when calling BRepFeat_SplitShape::Build.

The problem, is in BRepAlgo_NormalProjection. Although the edges resulted from BRepAlgoAPI_Section are on the corresponding faces, the projected edges have the end vertices a little different and the projected edges do not reach the face boundary or are over the face boundary. And that happens for BRepProj_Projection also.

The problem is that, the projection function do not project the next connected edge such as to reach the face boundary with the projection of the next edge.
An other thing could be: what now the projection functions consider to be an edge on the face, for the BRepFeat_SplitShape is no more.

It is maybe a tolerance discordance between the projection classes and BRepFeat_SplitShape, that I do not know how to handle.

Best Regards!

Macedo's picture

Hello Gheorghiu,

I will try to explain with more details:

You may not project the EDGE, you should make a prism with that EDGE.

1- With the EDGE and the FACE, you need to get a direction between both, that cross the face, where you would like to split.
2- Now, you already have direction and the EDGE, just make the PRISM

BRepPrimAPI_MakePrism aMakePrism (aEdge, aDirection, Standard_True, Standard_False, Standard_True);

3- Now you can makes the intersection ( try to use BRepAlgoAPI_Section ;) )

BRepAlgoAPI_Section Cutter (aFace, aMakePrism.Shape() ,Standard_False);
Cutter.Approximation(Standard_True);
Cutter.ComputePCurveOn1(Standard_True);
Cutter.Build();
if (Cutter.IsDone())
{
TopoDS_Shape InterTempShape = Cutter.Shape();
.
.
.

I hope helped you! =)
Best Regards,

Macedo's picture

I forgot the main part... sorry

Use the returned shape (from BRepAlgoAPI_Section), in this case InterTempShape, to create a Wire and then add it in the BRepFeat_SplitShape;

BRepFeat_SplitShape Splitter;
gaSplitter.Init( aFace );
gaSplitter.Add(TempWire, aFace);

Sorry again
Kind Regards

Gheorghiu's picture

Hello Thiago Macedo,

Thank you very much for suggestions.

I did already that. I wrote in my message on 12.02.2009: "1) First, I made from points a new shell, get the section between this new shell and the first one (using BRepAlgoAPI_Section) and made the split using BRepFeat_SplitShape. All ok.".
My big problem is that all takes much too long.
Only for this part:
BRepAlgoAPI_Section aSection(pipeShape, thePrismShape, false);
aSection.Approximation(true);
aSection.ComputePCurveOn1(true);
aSection.Build();
TopoDS_Shape resShape= aSection.Shape();
I measured 35 seconds. I definitely need less (let say less then 5 seconds, the less the better). That is why I try to find an other method, to avoid using BRepAlgoAPI_Section.

Best Regards.

Timo Roth's picture

Hello Gheorghiu,

could you finally solve your problem and find a faster alternative to using BRepAlgoAPI_Section?

Kind regards,
Timo

zhushunlai2012's picture

Hello Gheorghiu,

have you finally solved your problem
or find a faster alternative to using BRepAlgoAPI_Section?

can you share with us£¿

Sayantam Datta's picture

Hello,

I am currently using the method  Brepfeatsplitshape to split a face into multiple faces. However problem is I am getting only one face after splitting which is quite weird. For the cutting line, I am trying to take a portion of one of the border edges, while the remaining ones are inside the face. Does anyone have any idea about it?

Warm regards,

Sayantam