Extruding wires, Split solids by surfaces and collecting objects

Good day!
Please help me to understand:
1. How in Open Cascade create surface by extruding edge or wire?
2. How to cut (split) the solid into parts with the help of the surface from issue 1?
3. Is there a collection of objects, which can be combined resulting objects without turning them into compound (to return a list as a result of the function)?
I apologize for the simple questions, but working with Open Cascade for me is very new and the unknown (as well as programming in C ++ in general - I program in Pascal in Delphi).
I attach a picture with my task.

Attachments: 
Forum supervisor's picture

Dear Philipp,
We have an extensive experience in developing 3D modeling functionality. We can discuss all your problems and propose a solution acceptable for you. Please contact us via http://www.opencascade.org/about/contacts/ if you will decide to use our support services.
Training and e-learning courses are also at your disposal - http://www.opencascade.org/support/training/.
Best regards
FSR

Alexander Luger's picture

Hello Philipp!

1) See class BRepPrimAPI_MakePrism
2) To cut a solid by a face you can use the class BRepAlgoAPI_Cut

Regards,
Alex

derevenets.fn's picture

Hello Alexander!

On question 2, please give an example. My code generates an error:

TopoDS_Shape aShape1;
TopoDS_Shape aShape2;
BRepAlgoAPI_Cut tmpCutter(tmpVolume_1, tmpShell_1_1);
tmpCutter.Build();

if (tmpCutter.IsDone()) aShape1 = tmpCutter.Shape();
aShape2 = tmpShell_1_1;

Best regards,
Philipp

Alexander Luger's picture

BRepAlgoAPI_Cut works well if both inputs are volumes. Try:

BRep_Builder B;
TopoDS_Solid aSolid;
B.MakeSolid(aSolid);
B.Add(tmpShell_1_1));
BRepAlgoAPI_Cut tmpCutter(tmpVolume_1, aSolid);
...

Regards,
Alex

Alexander Luger's picture

Sorry, this is the correct line:

B.Add(aSolid,tmpShell_1_1));

derevenets.fn's picture

Thank you! The function is work. Explain only please: In order to be a function is worked I must to create a solid. But this is a kind of solid temporary body, a stub for the function? Maybe then it is better to use functions BRepFeat_SplitShape?

derevenets.fn's picture

Another very important question: how I can to find solid parts required position in space? For example, among the parts I need to find the solid with the faces (or edge, or vertices) with coordinates lie in the required range.

derevenets.fn's picture

The fact of the matter is that I need both parts of cut solid and the function returns only one. Cutting surface is a temporary, after cutting, it is no longer needed.

Alexander Luger's picture
derevenets.fn's picture

Thank you very much!
I have a polučis′ cut the solid parts. As far as I understood, the method BOPAlgo_Builder is a very common procedure. It allows allows you to divide all objects at their intersections. Am I right?

Here is the code I have is:

TopoDS_Compound cmdExtractShapes(const TopoDS_Shape varSource, TopAbs_ShapeEnum varShapeKind)
{
TopoDS_Compound tmpResult;
BRep_Builder tmpBuilder;

tmpBuilder.MakeCompound(tmpResult);
TopExp_Explorer tmpExplorer(varSource, varShapeKind);
for (; tmpExplorer.More(); tmpExplorer.Next())
{
const TopoDS_Shape& tmpItem = tmpExplorer.Current();
tmpBuilder.Add(tmpResult, tmpItem);
};

return tmpResult;
};

TopoDS_Shape cmdSplitVolumeByShell(TopoDS_Shape varVolume, TopoDS_Shape varSeparatorShell)
{
BOPAlgo_Builder tmpBuilder;

tmpBuilder.AddArgument(varVolume);
tmpBuilder.AddArgument(varSeparatorShell);
tmpBuilder.Perform();

TopoDS_Shape tmpResult = tmpBuilder.Shape();
tmpResult = cmdExtractShapes(tmpResult, TopAbs_SOLID);

return tmpResult;
};

derevenets.fn's picture

Another very important question: how I can to find solid parts required position in space? For example, among the parts I need to find the solid with the faces (or edge, or vertices) with coordinates lie in the required range.