
Tue, 04/19/2011 - 00:53
Forums:
I have the following code to build a fillet on an edge of a shape:
1. BRepFilletAPI_Make_Fillet mkFillet(aShape);
2. mkFillet.Add(radius, aEdge);
3. mkFillet.Build();
4. newShape=mkFillet.Shape();
If for some reason, the information in step 2 is wrong, it crashes on step 3. How can I detect the error on step 2, so that it won't reach step 3?
Thanks.
Sean
Tue, 04/19/2011 - 11:06
Hi Sean,
You may check whether the specified Edge belongs to the context shape.
If not - it is wrong parameter. Also you may protect step 3 with try/catch.
Regards
Tue, 04/19/2011 - 16:14
Hi Sergey:
Thank you for your reply.
The edge belongs to the context shape. When I said "the information in step 2 is wrong", I meant the edge cannot be used to build a fillet. For example, the edge is an neutral edge (meaning it is not convex or concave).
Also, could you explain more about "Also you may protect step 3 with try/catch"?
Thanks in advance.
Sean
Wed, 04/20/2011 - 16:37
Hi Sean,
1.Sorry, probably I didn't understand your idea.
The mentioned is not convex or concave (according you).
Do you mean ordinary linear edge?
In any case the requirement is single: the edge should belong to the context shape.
2. step 3 (fillet building) may be protected with ordinary C++
try { mkFillet.Build(); ...} catch {} construction to catch exception.
Regards
Wed, 04/20/2011 - 18:33
Hi Sergey:
Sorry for being not clear. Attached please find the picture to show the edge is selected and it crashes in mkFillet.Build().
Thanks again.
Sean
Wed, 04/20/2011 - 19:22
Hi,
Ok. It is clear. You mean seam edge.
If you will check it in debug mode you will get message like next:
"... Standard_Failure: There are no suitable edges for chamfer or fillet"
Algorithm identified that list of suitable edges is empty.
It is not a bug. It is expected reaction of the algorithm to wrong conditions.
Regards
Thu, 04/21/2011 - 17:51
Hi Sergey:
That's a great hint. Thank you so much.
Is there a way that I can get this message after mkFillet.Add(radius, aEdge)is called so that I can stop the program?
Thanks again.
Sean
Thu, 04/21/2011 - 19:13
Hi Sean,
It is better detect a problem before than it will appear.
Avoid adding seam edges to fillet function.
ShapeAnalysis package may help you.
Regards
Mon, 04/25/2011 - 18:54
Hi Sergey:
Great! Thank you so much.
Sean