Substract a face from a volume

Hi everyone! I'm just getting the hang of the Open Cascade Technology, and I need a bit of help. I'd like to know how to substract a face from a given solid. E.g: I have an intersection of two orthogonal cylinders (glued with the bopfuse command), but I want to to remove some of the tapes of the final geometry. If I use the explode command, I can find the tapes I want to substract, but I don't know how to do that. Since I am interested only in a surface meshing, I don't care about the solid, but I want the shape to have the right appearance. I also tried extruding two wires from cicles to create surface cylinders (so I don't have the tapes from the beginning), but the bopfuse just put them together and doesn't create the appropiate union of the two geometries that I want.

I think there must be a way to simply remove a surface from a given volume, could anyone help me out?

Thanks in advance

Paul Jimenez's picture

I think you mean "caps" by "tapes", am I right? You must speak Spanish then.

Thing is, a Solid is defined as a closed volume. The same shape without the caps would be just a Shell. You can extract the Shell out of the Solid using TopExp_Explorer or BRepTools::OuterShell and remove the Faces you want [the caps] using BRep_Builder::Remove. Just be sure the Shell is not Frozen [TopoDS_Shape::Free].

fjapesol's picture

Thanks for the advice for "caps", I just thought of the word "tapes" without checking :P.

About your answer, I didn't mention that I was using the Test Harness implementation with the env_DRAW program, not the OCC commands themselves. The problem is that I don't find there a procedure that is equivalent to your tip, I cannot (or at least I don't know how to do) extract the shell of the compound I have and then remove the caps. Do I need to start from zero using the OCC functions, or can I just use them together with the Test Harness code I already have, or is there some way to do my operation using directly the Test Harness commands (which is what I wanted from the start, but I don't see how)?.

Paul Jimenez's picture

Could you copy & paste the DRAW commands you used to create your fused shape? Most things you can do using the API can be done using the Test Harness, but it would be nice to have a starting point to see if I can help you further.

fjapesol's picture

Ok, I simplified the code in order to have it in few lines, the idea is to create a couple of cylinders, one along Z and the other along X, and fuse them

pload ALL
# First Cylinder (along "Z" direction)
pcylinder c1 0.001 0.006
# Second Cylinder (along "X" direction)
plane p2 0 0 0 1 0 0 0 1 0
pcylinder c2 p2 0.0005 0.003
ttranslate c2 0 0 0.004
# Fuse of the two cylinders
bop c1 c2
bopfuse csum

Now, the next step is to find and remove the desired caps. As I have learned so far, with the command

explode csum f

I can obtain the different surfaces of the shape csum, namely csum_1, csum_2, csum_3... A couple of these elements will be the caps I want to discard from the compound.

Paul Jimenez's picture

I couldn't find a command to remove a shape from a shape in DRAW, so I just created a new shape and added all faces I wanted instead.

explode csum f
shape r Sh
add csum_1 r
add csum_2 r
add csum_4 r

Additionally, you could also use the following command:

explode csum f
sewing r csum_1 csum_2 csum_4

fjapesol's picture

Ok, it worked perfectly!! Now I have a better idea of the way this library works.... thanks a lot.