For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Points->Edges->Wires->Faces-(???)->Shell->Solid

Anonymous's picture
Forums: 

Hello,

I am trying to make a shell from faces, but the result is compound. What is wrong?

gp_Pnt p1(1,0,0);
gp_Pnt p2(1,1,0);
gp_Pnt p3(0,1,0);
gp_Pnt p4(0,0,0);
gp_Pnt p5(1,0,1);
gp_Pnt p6(1,1,1);
gp_Pnt p7(0,1,1);
gp_Pnt p8(0,0,1);

TopoDS_Edge e1 = BRepBuilderAPI_MakeEdge( p4, p1);
TopoDS_Edge e2 = BRepBuilderAPI_MakeEdge( p1, p2);
TopoDS_Edge e3 = BRepBuilderAPI_MakeEdge( p2, p3);
TopoDS_Edge e4 = BRepBuilderAPI_MakeEdge( p3, p4);
TopoDS_Edge e5 = BRepBuilderAPI_MakeEdge( p1, p5);
TopoDS_Edge e6 = BRepBuilderAPI_MakeEdge( p2, p6);
TopoDS_Edge e7 = BRepBuilderAPI_MakeEdge( p3, p7);
TopoDS_Edge e8 = BRepBuilderAPI_MakeEdge( p4, p8);
TopoDS_Edge e9 = BRepBuilderAPI_MakeEdge( p8, p5);
TopoDS_Edge e10= BRepBuilderAPI_MakeEdge( p5, p6);
TopoDS_Edge e11= BRepBuilderAPI_MakeEdge( p6, p7);
TopoDS_Edge e12= BRepBuilderAPI_MakeEdge( p7, p8);

TopoDS_Wire w1 = BRepBuilderAPI_MakeWire(e1, e2, e3, e4);
TopoDS_Wire w2 = BRepBuilderAPI_MakeWire(e5, e10,e6, e2);
TopoDS_Wire w3 = BRepBuilderAPI_MakeWire(e6, e11,e7, e3);
TopoDS_Wire w4 = BRepBuilderAPI_MakeWire(e7, e12, e8, e4);
TopoDS_Wire w5 = BRepBuilderAPI_MakeWire(e8, e9, e5, e1);
TopoDS_Wire w6 = BRepBuilderAPI_MakeWire(e12,e11,e10,e9);

TopoDS_Face f1 = BRepBuilderAPI_MakeFace(w1);
TopoDS_Face f2 = BRepBuilderAPI_MakeFace(w2);
TopoDS_Face f3 = BRepBuilderAPI_MakeFace(w3);
TopoDS_Face f4 = BRepBuilderAPI_MakeFace(w4);
TopoDS_Face f5 = BRepBuilderAPI_MakeFace(w5);
TopoDS_Face f6 = BRepBuilderAPI_MakeFace(w6);

BRepOffsetAPI_Sewing sew(0.1);
sew.Add(w1);
sew.Add(w2);
sew.Add(w3);
sew.Add(w4);
sew.Add(w5);
sew.Add(w6);
sew.Perform();

TopoDS_Shape sewedShape = sew.SewedShape();

if (sewedShape.ShapeType() == TopAbs_COMPOUND) cout if (sewedShape.ShapeType() == TopAbs_COMPSOLID)cout if (sewedShape.ShapeType() == TopAbs_SOLID)cout if (sewedShape.ShapeType() == TopAbs_SHELL)cout if (sewedShape.ShapeType() == TopAbs_FACE)cout if (sewedShape.ShapeType() == TopAbs_WIRE)cout if (sewedShape.ShapeType() == TopAbs_EDGE)cout if (sewedShape.ShapeType() == TopAbs_VERTEX)cout if (sewedShape.ShapeType() == TopAbs_SHAPE)cout

Stephane Routelous's picture

did you check how many shapes are in your compound ?
Perhaps only one ?

Peter's picture

How to check that?

Stephane Routelous's picture

TopExp_Explorer class

Peter's picture

yes, it contains this:

COMPOUND. Number = 1
COMPSOLID. Number = 0
SOLID. Number = 0
SHELL. Number = 0
FACE. Number = 0
WIRE. Number = 6
EDGE. Number = 24
VERTEX. Number = 48
SHAPE. Number = 0

and I try to convert compound into solid using:

TopoDS_Solid sol=TopoDS::Solid(sewedShape);

OR:

TopExp_Explorer Ex(sewedShape,TopAbs_COMPOUND);
while (Ex.More())
{
TopoDS_Solid sol=TopoDS::Solid(Ex.Current());

Ex.Next();
}

both time it give the :

*** Abort *** an exception was raised, but no catch was found.
... The exception is:0x40ef8cfd : Standard_TypeMismatch: TopoDS::Solid

What is wrong?

Peter's picture

... and into shell using TopoDS::Shell

what is wrong?

Peter's picture

As I understand all that my attempts of conversion are wrong and I shall not convert but extract shell from compound.
The only question why there is no shells in compound?

Peter's picture

By the way all my faces use the same edges. Is it possible to create shell directly?

Peter's picture

... and into shell using TopoDS::Shell

*** Abort *** an exception was raised, but no catch was found.
... The exception is:0x40ef8cfd : Standard_TypeMismatch: TopoDS::Shell

what is wrong?

Christian Tavernier's picture

The code should be:

---
BRepOffsetAPI_Sewing sew(0.1);
sew.Add(f1);
sew.Add(f2);
sew.Add(f3);
sew.Add(f4);
sew.Add(f5);
sew.Add(f6);
sew.Perform();
---

and not...

---
BRepOffsetAPI_Sewing sew(0.1);
sew.Add(w1);
sew.Add(w2);
sew.Add(w3);
sew.Add(w4);
sew.Add(w5);
sew.Add(w6);
sew.Perform();
---

Christian T.

Peter's picture

Thank you very much!!!