Area inside a closed TopoDS_Wire on the surface of a TopoDS_Shell

Hi,

I am trying to calculate the area inside a TopoDS_Wire which is on the surface of a TopoDS_Shell. The TopoDS_Wire is always closed since it represents a border to a certain area that i need to calculate. I tried boolean operations to cut the shell with the wire but it did not work since boolean operations only works with solids, shells. If anyone can help that would be great :)

Thanks in advance ,

Benjamin Bihler's picture

Hi!

I am also interested in that question. Does OCC offer surface area computation algorithms besides computation of the surface area of a whole shell?

Isn't this a very basic and important task?

Benjamin

Daniel Neander's picture

Hello,

I have not tested the following, but it should work:
1) Project wire onto face
2) ensure wire is only on the face you want (may have to trim)
3) Use BRepFeat_SplitShape to split the face and the wire
4) Use BRepGProp::SurfaceProperties and GProp_GProps::Mass to get the area of that face
BRepGProp::SurfaceProperties(shape, props);
double aGeomArea = props.Mass();

Good luck

Forum supervisor's picture

Hello Mohamed,

A possible approach to solving your problem could consist of the following steps:
- Apply General Fuse operation to your shell and wire
- Find the wire contour inside the new shell
- Find the faces that contain edges of that contour
- Select faces that are inside the contour
- Create a new shell out of them

Here is a simple example in Draw how to apply General Fuse operation to a shell and a wire:

# Load modeling commands
pload MODELING
# Create a shell
polyline p1 0 0 0 10 0 0 10 5 0 10 10 0 0 10 0 0 0 0
prism r1 p1 0 0 10
# Create a wire
polyline p2 10 2 2 10 8 2 10 8 8 10 2 8 10 2 2
# Clear arguments (optional, only needed if calling repeatedly)
bcleartools
bclearobjects
# Apply General Fuse
baddobjects r1 p2
bapibuild r
# Show the result
axo; donly r; fit

We shall be glad to offer our additional assistance in the frames of a support program, if you are interested.
Contact us at http://www.opencascade.com/contact for more information.

Best regards,
Forum supervisor

mohamed.elsheikh's picture

Hello Sergey,

From what i know, boolean operations are only supported between solids or shells. I'm trying to use BRepAlgoAPI_Fuse to fuse the wire and the shell but it always fails with StdFail_NotDone.

Thanks,
Mohamed

Forum supervisor's picture

Hello Mohamed,

Just type 'getsource bapibuild' in Draw prompt to know in which source file this command is implemented.
Hope consulting its code can help you.

Best regards,
Forum supervisor