Tue, 08/02/2022 - 13:31
Forums:
Dear OCCT Community,
I'm trying to split an .STL file with BRepAlgoAPI_Section class and I've implement below code blocks for creating a planar splitter:
BRepAlgoAPI_Section OCCTShapeHealer::createSplitterWithGivenHeight(TopoDS_Shape shape, float height)
{
BRepAlgoAPI_Section splitter_section (shape, gp_Pln(gp_Pnt(0.0, 0.0, height), gp::DZ()), Standard_False);
splitter_section.ComputePCurveOn1(Standard_True);
splitter_section.Approximation(Standard_True);
splitter_section.Build();
return splitter_section;
}
If the Z-coordinate of the origin point of my STL is not at 0, the splitting does not take place where I expected because it accepts Z as 0 during the cutting process. I will give a few examples below so I can explain better with images:
STL File Name | Preview Full STL File on Free CAD Application | Original Height of STL File (as milimeter) | Given Height for Splitting (as milimeter) | After Splitting, Preview of Top Component | After Splitting, Preview of Bottom Component |
57 mm
Bottom point is: (0,0,-57) |
17.0 | did not split because it has a Z- value less than 0 |
did not split because it has a Z- value less than 0. As a consequence, shape is same:
|
||
57 mm
Bottom point is: (0,0, 0) |
17.0 |
As a result, what I would like to ask is that: If I know the value of bottom (for example, let it be -37), how do I give this value to the splitter? Which method should I use for this?
Thank you in advance,
Best regards.
Thu, 08/04/2022 - 08:23
Hello Nezihe!
If I understand your question correctly, you should take bottom position of part and + height.
But It is so simple and I am not sure I have understood you. In other way, please describe the problem more transparently)
With respect, Eugene.
Fri, 08/05/2022 - 09:57
Hello Eugene, Thank you for your reply. Actually, you're right about finding bottom/corner point and translate/relocate the TopoDS_Shape is so simple:
However; if I invoke the splitter method without implementing the above methods, the splitting does not work correctly.
I would like to share my implementation better intelligibility:
How I can import an STL file?
How I can split the TopoDS_Shape (imported from an STL file) ?
One more last word, my expectation is that if my stl file's top point 0,0,0 and bottom point 0,0,-58 and if I give the height -37.0, method should split the shape as two part: (0,0,0 <-> 0,0,-37) and (0,0,-37 <-> 0,0,-58 ). I am not able to overcome this problem.
Thank you!
Nezihe
Tue, 08/09/2022 - 09:55
No, transforming original shape cannot be a solution. Is it possible for you to put here only code, which trys to cut model by height position from very start call with height value.