Can't Create a trimmed cone surface.

Hi guys,

need your help. I try to create a partial cone surface. And I use the following codes. I always got error .
The shape looks: a perfect cone surface trimmed by three curves, so I can get a shape similiar to a triangular shape.

Any help will be appreciated.

thanks a lot.
eric

BRepBuilderAPI_MakeEdge e0(gp_Pnt(0,100,0), gp_Pnt(0,0,100));
BRepBuilderAPI_MakeEdge e1(gp_Pnt(0,0,100), gp_Pnt(100,0,0));
BRepBuilderAPI_MakeEdge e2(circle, gp_Pnt(100,0,0), gp_Pnt(0, 100,0));

BRepBuilderAPI_MakeWire mw(e0.Edge(), e1.Edge(), e2.Edge());

bool wire_done = mw.IsDone();

gp_Pnt pp2(0,0,100);
gp_Pnt pp1(0,0,0);

GC_MakeTrimmedCone mk_cone(pp1, pp2, 100, 0);
Handle(Geom_RectangularTrimmedSurface) rect_surf = mk_cone.Value();
rect_surf->UReverse();

BRepBuilderAPI_MakeFace ff(rect_surf, mw.Wire());

bool face_done = ff.IsDone();

TopoDS_Face topo_ff = ff.Face();

BRepCheck_Face chk_ff(topo_ff);

BRepCheck_Status stat0 = chk_ff.IntersectWires ();
BRepCheck_Status stat1 = chk_ff.ClassifyWires ();
BRepCheck_Status stat2 = chk_ff.OrientationOfWires ();

Sharjith Naramparambath's picture

Hi
First create a solid cone using BRepPrimAPI_MakeCone with the angle parameters to limit the cone as per your need. Then for obtaining the conocal face, explore the topology and check for a Geom_ConicalSurface equivalence of the surface obtained with BRepTool::Surface in each iteration and retain the conical surface when found.

BRepPrimAPI_MakeCone MkCon(1,0,1); //Default
MkCon = BRepPrimAPI_MakeCone(axis, botrad, toprad, height, ang1*PI180);

Handle(Geom_Surface) aSurf;
TopoDS_Shell aShell;
BRep_Builder B;
B.MakeShell(aShell);
for(TopExp_Explorer ex(MkCon.Shape(),TopAbs_FACE); ex.More(); ex.Next())
{
TopoDS_Face Face =TopoDS::Face(ex.Current());
aSurf = BRep_Tool::Surface(Face);
if(aSurf->IsKind(STANDARD_TYPE (Geom_ConicalSurface)))
{
B.Add(aShell, Face);
break;
}
}
Handle(AIS_Shape) aShape = new AIS_Shape(aShell);

Hope this helps..

Regards
N. Sharjith.

renyu_teng's picture

this may be too complicated. I just want to build a cone with a wire defined the region I want, there should be a way to do simply.