IsCurveOnSurface?

Hi,

I wonder if anyone knows anything about this. I am trying to build a conical shell
which may not necessarily have its ends square to the axis of the cone. To start with
I built a conical surface and a wire. The wire had 4 edges chosen to limit the cone
to a quarter of the cone (90 degrees about its axis). 2 edges were quarter circles,
the others were straight line segments. I made a wire from the edges and made the
face from the surface and wire. All worked fine until I tried to display it when
the following trace lead me to BRep_CurveRepresentation::IsCurveOnSurface which
appears to have no code to determine that a circle might lie in a conical surface.

Thanks in advance,

Jon G

//=======================================================================
//function : IsCurveOnSurface
//purpose :
//=======================================================================

Standard_Boolean BRep_CurveRepresentation::IsCurveOnSurface
(const Handle(Geom_Surface)& , const TopLoc_Location& )const
{
return Standard_False;
}

BRep_CurveRepresentation::IsCurveOnSurface(const Handle_Geom_Surface & {...}, const Handle_Geom_Surface & {...}) line 72
BRep_Tool::CurveOnSurface(const TopoDS_Edge & {...}, const Handle_Geom_Surface & {...}, const TopLoc_Location & {...}, double & 8.4073799709354e-296, double & 2.6096049603872e-308) line 269 + 48 bytes
BRep_Tool::CurveOnSurface(const TopoDS_Edge & {...}, const TopoDS_Face & {...}, double & 8.4073799709354e-296, double & 2.6096049603872e-308) line 243 + 29 bytes
BRepMesh_FastDiscret::Add(const TopoDS_Edge & {...}, const TopoDS_Face & {...}, const Handle_BRepAdaptor_HSurface & {...}, const double 2.1647844805848) line 1396 + 34 bytes
BRepMesh_FastDiscret::Add(const TopoDS_Face & {...}) line 418
BRepMesh_IncrementalMesh::Update(const TopoDS_Face & {...}) line 383
BRepMesh_IncrementalMesh::Update(const TopoDS_Shape & {...}) line 176
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(const TopoDS_Shape & {...}, const double 0.20000000000000, const unsigned int 1, const double 0.52359877559830) line 88
StdSelect_BRepSelectionTool::GetSensitiveForFace(const TopoDS_Face & {...}, const Handle_StdSelect_BRepOwner & {...}, Select3D_ListOfSensitive & {...}, const unsigned int 1, const int 9, const double 500.00000000000, const unsigned int 1) line 448 + 45 bytes
StdSelect_BRepSelectionTool::ComputeSensitive(const TopoDS_Shape & {...}, const Handle_StdSelect_BRepOwner & {...}, const Handle_SelectMgr_Selection & {...}, const int 9, const double 500.00000000000, const unsigned int 1) line 212 + 35 bytes
StdSelect_BRepSelectionTool::Load(const Handle_SelectMgr_Selection & {...}, const TopoDS_Shape & {...}, TopAbs_ShapeEnum TopAbs_SHAPE, const unsigned int 1, const int -1, const int 9, const double 500.00000000000) line 114 + 33 bytes
StdSelect_BRepSelectionTool::Load(const Handle_SelectMgr_Selection & {...}, const Handle_SelectMgr_SelectableObject & {...}, const TopoDS_Shape & {...}, TopAbs_ShapeEnum TopAbs_SHAPE, const unsigned int 1, const int -1, const int 9, const double 500.00000000000) line 132 + 36 bytes
User_Quad::ComputeSelection(const Handle_SelectMgr_Selection & {...}, const int 0) line 579 + 57 bytes
SelectMgr_SelectableObject::AddSelection(const Handle_SelectMgr_Selection & {...}, const int 0) line 132
SelectMgr_SelectionManager::LoadMode(const Handle_SelectMgr_SelectableObject & {...}, const int 0) line 834
SelectMgr_SelectionManager::Activate(const Handle_SelectMgr_SelectableObject & {...}, const int 0, const Handle_SelectMgr_ViewerSelector & {...}, const unsigned int 1) line 303
AIS_InteractiveContext::Display(const Handle_AIS_InteractiveObject & {...}, const unsigned int 1) line 386
CSampleAISSelectDoc::OnUsercylinder() line 439

jonathan_gould's picture

I made this code from the AIS_Select examples.. I can't be making the shape correctly as when it tries to display I get a crash
somewhere below BrepMesh_FastDiscret() somehow the edges appear infinite? Any suggestions?.

Looking at the display it must be something to do with the fact I'm using gp_cone as instead of a conical surface I see a circle and a line.

void User_QuarterCone::MakeSingleV2()
{
TColgp_Array2OfPnt pt(1,2,1,3);

pt(1,1) = gp_Pnt( 0, 0., 600.0);
pt(1,2) = gp_Pnt( 0., 500., 600.0);
pt(1,3) = gp_Pnt( 500., 0.0, 600.0);
pt(2,1) = gp_Pnt( 0., 0.0, 1200.000);
pt(2,2) = gp_Pnt( 0., 1000.0, 1200.000);
pt(2,3) = gp_Pnt( 1000., 0.0, 1200.000);

TopoDS_Edge E1 = QuadCurveEdgeV2(pt(1,1), pt(1,2), pt(1,3), pt(2,1));
TopoDS_Edge E2 = QuadCurveEdgeV2(pt(2,1), pt(2,3), pt(2,2), pt(1,1));

// vertex for straight edge

BRepBuilderAPI_MakeVertex VV2(pt(1,2));
BRepBuilderAPI_MakeVertex VV3(pt(1,3));
BRepBuilderAPI_MakeVertex VV5(pt(2,2));
BRepBuilderAPI_MakeVertex VV6(pt(2,3));
//straight edges
BRepBuilderAPI_MakeEdge E3(VV5,VV2);
BRepBuilderAPI_MakeEdge E4(VV3,VV6);
// start wire
BRepBuilderAPI_MakeWire MW(E1);
// add the other wire bits
MW.Add(E4);
MW.Add(E2);
MW.Add(E3);

Standard_Real r1 = 250.0;
Standard_Real r2 = 1500.0;

gp_Pnt axe1(0.0, 0.0, 300.0 );
gp_Pnt axe2(0.0, 0.0, 1800.0);
gp_Pnt axe3(0.0, 500.0, 300.0);

gp_Cone cone = gce_MakeCone(axe1,axe2, r1,r2);

// make a face from the face & wire

if(MW.IsDone())
{
BRepBuilderAPI_MakeFace MF(cone);
// MF.Add(MW);
if(MF.IsDone())
{
TopoDS_Shape aShape = MF.Face();
myShape = aShape;
}
}

}

//
// Make the curved edge of a cone
//
TopoDS_Edge User_QuarterCone::QuadCurveEdgeV2(gp_Pnt P1, gp_Pnt P2, gp_Pnt P3, gp_Pnt P4)
{
Standard_Real r1 = P1.Distance(P2);
Standard_Real r2 = P1.Distance(P3);

gp_Ax2 axes1(P1, gce_MakeDir(P1,P4), gce_MakeDir(P1,P3));
gp_Circ el = gce_MakeCirc(axes1,r1);
BRepBuilderAPI_MakeVertex V2(P2);
BRepBuilderAPI_MakeVertex V3(P3);

BRepBuilderAPI_MakeEdge E1(el, V2, V3);
TopoDS_Edge E;
if(E1.IsDone())
{
return E1;
}
return E;
}

Rob's picture

Did you get an answer to this problem?

Cheers, Rob