
Wed, 01/23/2019 - 04:30
Forums:
Hi all,
I want to convert the shape of the boolean operation result into solid, but crashed. I confirmed the shape type is solid, really don't know what is the problem. Below is the code script. Could any one help me out? Thanks in advance~
BRepAlgoAPI_Fuse fuser(outShape, midShape); //outShape and midShape are solid
fuser.SetRunParallel(1);
fuser.SetUseOBB(1);
fuser.Build();
TopoDS_Solid solid = TopoDS::Solid(fuser.Shape());//crashed here, and i confirmed fuer.shape() is a solid
Wed, 01/23/2019 - 07:55
Most likely the result is not a solid, but the compound containing solid. Use TopExp_Explorer or TopoDS_Iterator to get the solid out of the compound:
Wed, 01/23/2019 - 11:37
Thanks for your reply! I tried use TopoDS_Iterator to go through the shape ,and it only contained one shape and turned out to be a solid. Below is the code snap:
the debug result is s: 2
Wed, 01/23/2019 - 11:36
Thanks for your reply! I tried use TopoDS_Iterator to go through the shape ,and it only contained one shape and turned out to be a solid. Below is the code snap:
the debug result is s: 2
Wed, 01/23/2019 - 12:43
That's correct. Compound containing only one solid. My proposal should work. TopoDS_Iterator iterates over one-level deep sub-shapes of the shape. For solids it will be shells, for shells - faces, etc.
Wed, 01/23/2019 - 13:33
You are right! Thank you very much~