1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-05 11:24:17 +03:00

0030146: Visualization - exception during attempt to display Edge without geometry

StdPrs_ToolRFace no skips curves with NULL curves.
Code has been cleaned up from duplicated checks, redundant casts
and dummy Adaptor2d_Curve2dPtr typedef.

StdSelect_BRepSelectionTool::GetSensitiveForFace() now catches
Standard_NullObject exception to skip invalid Edges.
This commit is contained in:
kgv 2018-09-20 11:40:19 +03:00 committed by bugmaster
parent c39bb31bac
commit 4ba5491a50
17 changed files with 188 additions and 208 deletions

View File

@ -1,23 +0,0 @@
// Created on: 1992-10-08
// Created by: Isabelle GRIGNON
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Adaptor2d_Curve2dPtr_HeaderFile
#define _Adaptor2d_Curve2dPtr_HeaderFile
class Adaptor2d_Curve2d;
typedef Adaptor2d_Curve2d* Adaptor2d_Curve2dPtr;
#endif // _Adaptor2d_Curve2dPtr_HeaderFile

View File

@ -1,6 +1,5 @@
Adaptor2d_Curve2d.cxx Adaptor2d_Curve2d.cxx
Adaptor2d_Curve2d.hxx Adaptor2d_Curve2d.hxx
Adaptor2d_Curve2dPtr.hxx
Adaptor2d_GenHCurve2d.gxx Adaptor2d_GenHCurve2d.gxx
Adaptor2d_GenHCurve2d.lxx Adaptor2d_GenHCurve2d.lxx
Adaptor2d_HCurve2d.cxx Adaptor2d_HCurve2d.cxx

View File

@ -74,6 +74,18 @@ BRepAdaptor_Curve::BRepAdaptor_Curve(const TopoDS_Edge& E,
Initialize(E,F); Initialize(E,F);
} }
//=======================================================================
//function : Reset
//purpose :
//=======================================================================
void BRepAdaptor_Curve::Reset()
{
myCurve.Reset();
myConSurf.Nullify();
myEdge.Nullify();
myTrsf = gp_Trsf();
}
//======================================================================= //=======================================================================
//function : Initialize //function : Initialize
//purpose : //purpose :

View File

@ -86,7 +86,10 @@ public:
//! is raised if the edge does not have a pcurve on //! is raised if the edge does not have a pcurve on
//! the face. //! the face.
Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E, const TopoDS_Face& F); Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E, const TopoDS_Face& F);
//! Reset currently loaded curve (undone Load()).
Standard_EXPORT void Reset();
//! Sets the Curve <me> to acces to the geometry of //! Sets the Curve <me> to acces to the geometry of
//! edge <E>. //! edge <E>.
Standard_EXPORT void Initialize (const TopoDS_Edge& E); Standard_EXPORT void Initialize (const TopoDS_Edge& E);

View File

@ -168,6 +168,19 @@ Geom2dAdaptor_Curve::Geom2dAdaptor_Curve(const Handle(Geom2d_Curve)& theCrv,
Load(theCrv, theUFirst, theULast); Load(theCrv, theUFirst, theULast);
} }
//=======================================================================
//function : Reset
//purpose :
//=======================================================================
void Geom2dAdaptor_Curve::Reset()
{
myTypeCurve = GeomAbs_OtherCurve;
myCurve.Nullify();
myCurveCache.Nullify();
myNestedEvaluator.Nullify();
myBSplineCurve.Nullify();
myFirst = myLast = 0.0;
}
//======================================================================= //=======================================================================
//function : Load //function : Load

View File

@ -68,7 +68,10 @@ public:
//! ConstructionError is raised if Ufirst>Ulast //! ConstructionError is raised if Ufirst>Ulast
Standard_EXPORT Geom2dAdaptor_Curve(const Handle(Geom2d_Curve)& C, const Standard_Real UFirst, const Standard_Real ULast); Standard_EXPORT Geom2dAdaptor_Curve(const Handle(Geom2d_Curve)& C, const Standard_Real UFirst, const Standard_Real ULast);
//! Reset currently loaded curve (undone Load()).
Standard_EXPORT void Reset();
void Load (const Handle(Geom2d_Curve)& C); void Load (const Handle(Geom2d_Curve)& C);
//! ConstructionError is raised if Ufirst>Ulast //! ConstructionError is raised if Ufirst>Ulast

View File

@ -124,6 +124,19 @@ GeomAbs_Shape GeomAdaptor_Curve::LocalContinuity(const Standard_Real U1,
} }
} }
//=======================================================================
//function : Reset
//purpose :
//=======================================================================
void GeomAdaptor_Curve::Reset()
{
myTypeCurve = GeomAbs_OtherCurve;
myCurve.Nullify();
myNestedEvaluator.Nullify();
myBSplineCurve.Nullify();
myCurveCache.Nullify();
myFirst = myLast = 0.0;
}
//======================================================================= //=======================================================================
//function : Load //function : Load

View File

@ -70,7 +70,10 @@ public:
//! ConstructionError is raised if Ufirst>Ulast //! ConstructionError is raised if Ufirst>Ulast
GeomAdaptor_Curve(const Handle(Geom_Curve)& C, const Standard_Real UFirst, const Standard_Real ULast); GeomAdaptor_Curve(const Handle(Geom_Curve)& C, const Standard_Real UFirst, const Standard_Real ULast);
//! Reset currently loaded curve (undone Load()).
Standard_EXPORT void Reset();
void Load (const Handle(Geom_Curve)& C); void Load (const Handle(Geom_Curve)& C);
//! ConstructionError is raised if Ufirst>Ulast //! ConstructionError is raised if Ufirst>Ulast

View File

@ -387,12 +387,7 @@ void StdPrs_Isolines::addOnSurface (const Handle(BRepAdaptor_HSurface)& theSurfa
for (anEdgeTool.Init(); anEdgeTool.More(); anEdgeTool.Next()) for (anEdgeTool.Init(); anEdgeTool.More(); anEdgeTool.Next())
{ {
TopAbs_Orientation anOrientation = anEdgeTool.Orientation(); TopAbs_Orientation anOrientation = anEdgeTool.Orientation();
if (anOrientation != TopAbs_FORWARD && anOrientation != TopAbs_REVERSED) const Adaptor2d_Curve2d* anEdgeCurve = &anEdgeTool.Value();
{
continue;
}
Adaptor2d_Curve2dPtr anEdgeCurve = anEdgeTool.Value();
if (anEdgeCurve->GetType() != GeomAbs_Line) if (anEdgeCurve->GetType() != GeomAbs_Line)
{ {
GCPnts_QuasiUniformDeflection aSampler (*anEdgeCurve, aSamplerDeflection); GCPnts_QuasiUniformDeflection aSampler (*anEdgeCurve, aSamplerDeflection);

View File

@ -12,114 +12,59 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <StdPrs_ToolRFace.hxx>
#include <Adaptor2d_Curve2d.hxx> #include <Adaptor2d_Curve2d.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BRepAdaptor_HSurface.hxx> #include <BRepAdaptor_HSurface.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <StdPrs_ToolRFace.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
//======================================================================= //=======================================================================
//function : StdPrs_ToolRFace //function : StdPrs_ToolRFace
//purpose : //purpose :
//======================================================================= //=======================================================================
StdPrs_ToolRFace::StdPrs_ToolRFace() StdPrs_ToolRFace::StdPrs_ToolRFace()
: myHasNullCurves (Standard_False)
{ {
} }
//======================================================================= //=======================================================================
//function : StdPrs_ToolRFace //function : StdPrs_ToolRFace
//purpose : //purpose :
//======================================================================= //=======================================================================
StdPrs_ToolRFace::StdPrs_ToolRFace (const Handle(BRepAdaptor_HSurface)& theSurface)
StdPrs_ToolRFace::StdPrs_ToolRFace(const Handle(BRepAdaptor_HSurface)& aSurface) : : myFace (theSurface->ChangeSurface().Face()),
myFace(((BRepAdaptor_Surface*)&(aSurface->Surface()))->Face()) myHasNullCurves (Standard_False)
{ {
myFace.Orientation(TopAbs_FORWARD); myFace.Orientation(TopAbs_FORWARD);
} }
//======================================================================= //=======================================================================
//function : IsOriented //function : next
//purpose : //purpose :
//======================================================================= //=======================================================================
void StdPrs_ToolRFace::next()
Standard_Boolean StdPrs_ToolRFace::IsOriented () const {
return Standard_True;
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void StdPrs_ToolRFace::Init()
{ {
myExplorer.Init(myFace,TopAbs_EDGE); Standard_Real aParamU1, aParamU2;
if (myExplorer.More()) { for (; myExplorer.More(); myExplorer.Next())
Standard_Real U1,U2; {
const Handle(Geom2d_Curve)& C =
BRep_Tool::CurveOnSurface(TopoDS::Edge(myExplorer.Current()),
myFace,
U1,U2);
DummyCurve.Load(C,U1,U2);
}
}
//=======================================================================
//function : More
//purpose :
//=======================================================================
Standard_Boolean StdPrs_ToolRFace::More() const
{
return myExplorer.More();
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
void StdPrs_ToolRFace::Next()
{
myExplorer.Next();
if (myExplorer.More()) {
// skip INTERNAL and EXTERNAL edges // skip INTERNAL and EXTERNAL edges
while (myExplorer.More() && (myExplorer.Current().Orientation() == TopAbs_INTERNAL if (myExplorer.Current().Orientation() != TopAbs_FORWARD
|| myExplorer.Current().Orientation() == TopAbs_EXTERNAL)) && myExplorer.Current().Orientation() != TopAbs_REVERSED)
myExplorer.Next(); {
if (myExplorer.More()) { continue;
Standard_Real U1,U2; }
const Handle(Geom2d_Curve)& C =
BRep_Tool::CurveOnSurface(TopoDS::Edge(myExplorer.Current()), if (Handle(Geom2d_Curve) aCurve = BRep_Tool::CurveOnSurface (TopoDS::Edge (myExplorer.Current()), myFace, aParamU1, aParamU2))
myFace, {
U1,U2); myCurve.Load (aCurve, aParamU1, aParamU2);
if ( !C.IsNull() ) return;
DummyCurve.Load(C,U1,U2); }
else
{
myHasNullCurves = Standard_True;
} }
} }
myCurve.Reset();
} }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
Adaptor2d_Curve2dPtr StdPrs_ToolRFace::Value() const
{
return (Adaptor2d_Curve2dPtr)&DummyCurve;
}
//=======================================================================
//function : Orientation
//purpose :
//=======================================================================
TopAbs_Orientation StdPrs_ToolRFace::Orientation () const {
return myExplorer.Current().Orientation();
}

View File

@ -24,60 +24,64 @@
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <Geom2dAdaptor_Curve.hxx> #include <Geom2dAdaptor_Curve.hxx>
#include <Standard_Boolean.hxx>
#include <Adaptor2d_Curve2dPtr.hxx>
#include <TopAbs_Orientation.hxx> #include <TopAbs_Orientation.hxx>
class BRepAdaptor_HSurface; class BRepAdaptor_HSurface;
//! Iterator over 2D curves restricting a face (skipping internal/external edges).
//! In addition, the algorithm skips NULL curves - IsInvalidGeometry() can be checked if this should be handled within algorithm.
class StdPrs_ToolRFace class StdPrs_ToolRFace
{ {
public: public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
//! Empty constructor.
Standard_EXPORT StdPrs_ToolRFace(); Standard_EXPORT StdPrs_ToolRFace();
//! Constructor with initialization.
Standard_EXPORT StdPrs_ToolRFace(const Handle(BRepAdaptor_HSurface)& aSurface); Standard_EXPORT StdPrs_ToolRFace(const Handle(BRepAdaptor_HSurface)& aSurface);
Standard_EXPORT Standard_Boolean IsOriented() const; //! Return TRUE indicating that iterator looks only for oriented edges.
Standard_Boolean IsOriented() const { return Standard_True; }
Standard_EXPORT void Init(); //! Move iterator to the first element.
void Init()
Standard_EXPORT Standard_Boolean More() const; {
myExplorer.Init (myFace, TopAbs_EDGE);
Standard_EXPORT void Next(); next();
}
Standard_EXPORT Adaptor2d_Curve2dPtr Value() const;
Standard_EXPORT TopAbs_Orientation Orientation() const;
//! Return TRUE if iterator points to the curve.
Standard_Boolean More() const { return myExplorer.More(); }
//! Go to the next curve in the face.
void Next()
{
myExplorer.Next();
next();
}
//! Return current curve.
const Adaptor2d_Curve2d& Value() const { return myCurve; }
protected: //! Return current edge orientation.
TopAbs_Orientation Orientation() const { return myExplorer.Current().Orientation(); }
//! Return TRUE if NULL curves have been skipped.
Standard_Boolean IsInvalidGeometry() const { return myHasNullCurves; }
private: private:
//! Find nearest valid item for the iterator.
Standard_EXPORT void next();
private:
TopoDS_Face myFace; TopoDS_Face myFace;
TopExp_Explorer myExplorer; TopExp_Explorer myExplorer;
Geom2dAdaptor_Curve DummyCurve; Geom2dAdaptor_Curve myCurve;
Standard_Boolean myHasNullCurves;
}; };
#endif // _StdPrs_ToolRFace_HeaderFile #endif // _StdPrs_ToolRFace_HeaderFile

View File

@ -146,8 +146,7 @@ void StdPrs_WFDeflectionRestrictedFace::Add
for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) { for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
TopAbs_Orientation Orient = ToolRst.Orientation(); TopAbs_Orientation Orient = ToolRst.Orientation();
if ( Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED ) { const Adaptor2d_Curve2d* TheRCurve = &ToolRst.Value();
Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
if (TheRCurve->GetType() != GeomAbs_Line) { if (TheRCurve->GetType() != GeomAbs_Line) {
GCPnts_QuasiUniformDeflection UDP(*TheRCurve, ddefle); GCPnts_QuasiUniformDeflection UDP(*TheRCurve, ddefle);
if (UDP.IsDone()) { if (UDP.IsDone()) {
@ -180,7 +179,6 @@ void StdPrs_WFDeflectionRestrictedFace::Add
tabP.Append(P1); tabP.Append(P1);
} }
} }
}
} }
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
else { else {
@ -385,7 +383,7 @@ Standard_Boolean StdPrs_WFDeflectionRestrictedFace::Match
UMax = VMax = RealFirst(); UMax = VMax = RealFirst();
for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) { for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value(); const Adaptor2d_Curve2d* TheRCurve = &ToolRst.Value();
u = TheRCurve->FirstParameter(); u = TheRCurve->FirstParameter();
v = TheRCurve->LastParameter(); v = TheRCurve->LastParameter();
step = ( v - u) / nbPoints; step = ( v - u) / nbPoints;
@ -438,8 +436,7 @@ Standard_Boolean StdPrs_WFDeflectionRestrictedFace::Match
gp_Pnt dummypnt; gp_Pnt dummypnt;
for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) { for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
TopAbs_Orientation Orient = ToolRst.Orientation(); TopAbs_Orientation Orient = ToolRst.Orientation();
if ( Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED ) { const Adaptor2d_Curve2d* TheRCurve = &ToolRst.Value();
Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
GCPnts_QuasiUniformDeflection UDP(*TheRCurve, Deflection); GCPnts_QuasiUniformDeflection UDP(*TheRCurve, Deflection);
if (UDP.IsDone()) { if (UDP.IsDone()) {
Standard_Integer NumberOfPoints = UDP.NbPoints(); Standard_Integer NumberOfPoints = UDP.NbPoints();
@ -462,7 +459,6 @@ Standard_Boolean StdPrs_WFDeflectionRestrictedFace::Match
cout << "Cannot evaluate curve on surface"<<endl; cout << "Cannot evaluate curve on surface"<<endl;
} }
#endif #endif
}
} }
// draw the isos // draw the isos

View File

@ -55,8 +55,8 @@ void StdPrs_WFRestrictedFace::Add
for (aToolRst.Init(); aToolRst.More(); aToolRst.Next()) for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
{ {
Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value(); const Adaptor2d_Curve2d& aRCurve = aToolRst.Value();
BndLib_Add2dCurve::Add(*aRCurve, Precision::PConfusion(), aBndBox); BndLib_Add2dCurve::Add(aRCurve, Precision::PConfusion(), aBndBox);
} }
if (!aBndBox.IsVoid()) if (!aBndBox.IsVoid())
aBndBox.Get(aUMin, aVMin, aUMax, aVMax); aBndBox.Get(aUMin, aVMin, aUMax, aVMax);
@ -116,35 +116,32 @@ void StdPrs_WFRestrictedFace::Add
for (aToolRst.Init(); aToolRst.More(); aToolRst.Next()) for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
{ {
TopAbs_Orientation anOrientation = aToolRst.Orientation(); TopAbs_Orientation anOrientation = aToolRst.Orientation();
if (anOrientation == TopAbs_FORWARD || anOrientation == TopAbs_REVERSED) const Adaptor2d_Curve2d* aRCurve = &aToolRst.Value();
anU1 = aRCurve->FirstParameter();
anU2 = aRCurve->LastParameter();
if (aRCurve->GetType() != GeomAbs_Line)
{ {
Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value(); aDU = (anU2-anU1)/(aNbPoints-1);
anU1 = aRCurve->FirstParameter(); aPoint2 = aRCurve->Value(anU1);
anU2 = aRCurve->LastParameter(); for (anI = 2; anI <= aNbPoints; ++anI)
if (aRCurve->GetType() != GeomAbs_Line)
{ {
aDU = (anU2-anU1)/(aNbPoints-1); anU = anU1 + (anI-1)*aDU;
aPoint2 = aRCurve->Value(anU1); aPoint1 = aPoint2;
for (anI = 2; anI <= aNbPoints; ++anI) aPoint2 = aRCurve->Value(anU);
{
anU = anU1 + (anI-1)*aDU;
aPoint1 = aPoint2;
aPoint2 = aRCurve->Value(anU);
if(anOrientation == TopAbs_FORWARD )
anIsoBuild.Trim(aPoint1,aPoint2);
else
anIsoBuild.Trim(aPoint2,aPoint1);
}
}
else {
aPoint1 = aRCurve->Value(anU1);
aPoint2 = aRCurve->Value(anU2);
if(anOrientation == TopAbs_FORWARD ) if(anOrientation == TopAbs_FORWARD )
anIsoBuild.Trim(aPoint1,aPoint2); anIsoBuild.Trim(aPoint1,aPoint2);
else else
anIsoBuild.Trim(aPoint2,aPoint1); anIsoBuild.Trim(aPoint2,aPoint1);
} }
} }
else {
aPoint1 = aRCurve->Value(anU1);
aPoint2 = aRCurve->Value(anU2);
if(anOrientation == TopAbs_FORWARD )
anIsoBuild.Trim(aPoint1,aPoint2);
else
anIsoBuild.Trim(aPoint2,aPoint1);
}
} }
// Draw the isos // Draw the isos
@ -243,7 +240,7 @@ Standard_Boolean StdPrs_WFRestrictedFace::Match
for (aToolRst.Init(); aToolRst.More(); aToolRst.Next()) for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
{ {
Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value(); const Adaptor2d_Curve2d* aRCurve = &aToolRst.Value();
anU = aRCurve->FirstParameter(); anU = aRCurve->FirstParameter();
aV = aRCurve->LastParameter(); aV = aRCurve->LastParameter();
if (aRCurve->GetType() != GeomAbs_Line) if (aRCurve->GetType() != GeomAbs_Line)
@ -319,32 +316,29 @@ Standard_Boolean StdPrs_WFRestrictedFace::Match
for (aToolRst.Init(); aToolRst.More(); aToolRst.Next()) for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
{ {
TopAbs_Orientation Orient = aToolRst.Orientation(); TopAbs_Orientation Orient = aToolRst.Orientation();
if (Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED) const Adaptor2d_Curve2d* aRCurve = &aToolRst.Value();
{ anU1 = aRCurve->FirstParameter();
Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value(); anU2 = aRCurve->LastParameter();
anU1 = aRCurve->FirstParameter(); if (aRCurve->GetType() != GeomAbs_Line) {
anU2 = aRCurve->LastParameter(); aDU = (anU2-anU1)/(aNbPoints-1);
if (aRCurve->GetType() != GeomAbs_Line) { aPoint2 = aRCurve->Value(anU1);
aDU = (anU2-anU1)/(aNbPoints-1); for (anI = 2; anI <= aNbPoints; anI++) {
aPoint2 = aRCurve->Value(anU1); anU = anU1 + (anI-1)*aDU;
for (anI = 2; anI <= aNbPoints; anI++) { aPoint1 = aPoint2;
anU = anU1 + (anI-1)*aDU; aPoint2 = aRCurve->Value(anU);
aPoint1 = aPoint2;
aPoint2 = aRCurve->Value(anU);
if(Orient == TopAbs_FORWARD )
anIsoBuild.Trim(aPoint1,aPoint2);
else
anIsoBuild.Trim(aPoint2,aPoint1);
}
}
else {
aPoint1 = aRCurve->Value(anU1);
aPoint2 = aRCurve->Value(anU2);
if(Orient == TopAbs_FORWARD ) if(Orient == TopAbs_FORWARD )
anIsoBuild.Trim(aPoint1,aPoint2); anIsoBuild.Trim(aPoint1,aPoint2);
else else
anIsoBuild.Trim(aPoint2,aPoint1); anIsoBuild.Trim(aPoint2,aPoint1);
} }
}
else {
aPoint1 = aRCurve->Value(anU1);
aPoint2 = aRCurve->Value(anU2);
if(Orient == TopAbs_FORWARD )
anIsoBuild.Trim(aPoint1,aPoint2);
else
anIsoBuild.Trim(aPoint2,aPoint1);
} }
} }

View File

@ -621,7 +621,16 @@ Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_
BRepAdaptor_Curve cu3d; BRepAdaptor_Curve cu3d;
for (BRepTools_WireExplorer aWireExplorer (aWire); aWireExplorer.More(); aWireExplorer.Next()) for (BRepTools_WireExplorer aWireExplorer (aWire); aWireExplorer.More(); aWireExplorer.Next())
{ {
cu3d.Initialize (aWireExplorer.Current()); try
{
OCC_CATCH_SIGNALS
cu3d.Initialize (aWireExplorer.Current());
}
catch (Standard_NullObject)
{
continue;
}
Standard_Real wf = 0.0, wl = 0.0; Standard_Real wf = 0.0, wl = 0.0;
BRep_Tool::Range (aWireExplorer.Current(), wf, wl); BRep_Tool::Range (aWireExplorer.Current(), wf, wl);
if (Abs (wf - wl) <= Precision::Confusion()) if (Abs (wf - wl) <= Precision::Confusion())

View File

@ -144,8 +144,7 @@ void VrmlConverter_WFDeflectionRestrictedFace::Add
gp_Pnt dummypnt; gp_Pnt dummypnt;
for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) { for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
TopAbs_Orientation Orient = ToolRst.Orientation(); TopAbs_Orientation Orient = ToolRst.Orientation();
if ( Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED ) { const Adaptor2d_Curve2d* TheRCurve = &ToolRst.Value();
Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
if (TheRCurve->GetType() != GeomAbs_Line) { if (TheRCurve->GetType() != GeomAbs_Line) {
GCPnts_QuasiUniformDeflection UDP(*TheRCurve, Deflection); GCPnts_QuasiUniformDeflection UDP(*TheRCurve, Deflection);
if (UDP.IsDone()) { if (UDP.IsDone()) {
@ -178,7 +177,6 @@ void VrmlConverter_WFDeflectionRestrictedFace::Add
else else
isobuild.Trim(P2,P1); isobuild.Trim(P2,P1);
} }
}
} }
// draw the isos // draw the isos

View File

@ -52,8 +52,8 @@ void VrmlConverter_WFRestrictedFace::Add
Bnd_Box2d B; Bnd_Box2d B;
for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) { for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value(); const Adaptor2d_Curve2d& TheRCurve = ToolRst.Value();
BndLib_Add2dCurve::Add(*TheRCurve, Precision::PConfusion(), B); BndLib_Add2dCurve::Add(TheRCurve, Precision::PConfusion(), B);
} }
B.Get(UMin, VMin, UMax, VMax); B.Get(UMin, VMin, UMax, VMax);
@ -97,8 +97,7 @@ void VrmlConverter_WFRestrictedFace::Add
for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) { for (ToolRst.Init(); ToolRst.More(); ToolRst.Next()) {
TopAbs_Orientation Orient = ToolRst.Orientation(); TopAbs_Orientation Orient = ToolRst.Orientation();
if ( Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED ) { const Adaptor2d_Curve2d* TheRCurve = &ToolRst.Value();
Adaptor2d_Curve2dPtr TheRCurve = ToolRst.Value();
U1 = TheRCurve->FirstParameter(); U1 = TheRCurve->FirstParameter();
U2 = TheRCurve->LastParameter(); U2 = TheRCurve->LastParameter();
if (TheRCurve->GetType() != GeomAbs_Line) { if (TheRCurve->GetType() != GeomAbs_Line) {
@ -121,8 +120,7 @@ void VrmlConverter_WFRestrictedFace::Add
isobuild.Trim(P1,P2); isobuild.Trim(P1,P2);
else else
isobuild.Trim(P2,P1); isobuild.Trim(P2,P1);
} }
}
} }

18
tests/bugs/vis/bug30146 Normal file
View File

@ -0,0 +1,18 @@
puts "============="
puts "0030146: Visualization - e x c e p t i o n during attempt to display Edge without geometry"
puts "============="
pload MODELING VISUALIZATION
restore [locate_data_file CTO904_cts20176a.rle] a
incmesh a 0.1
tclean -geom a
vclear
vinit View1
vviewparams -scale 3.69 -proj 0.30 0.94 0.14 -up -0.46 0.013 0.88 -at 103.9 -59.94 -27.08
vdisplay -dispMode 0 a
vdump ${imagedir}/${casename}_wireframe.png
vdisplay -dispMode 1 a
vdump ${imagedir}/${casename}_shaded.png