mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0022459: The ImportExport sample crash
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <ShapeFix_ShapeTolerance.hxx>
|
||||
#include <StepShape_ConnectedEdgeSet.hxx>
|
||||
@@ -736,7 +737,21 @@ void StepToTopoDS_Builder::Init
|
||||
TrCC.SetPrecision(preci);
|
||||
TrCC.SetMaxTol(maxtol);
|
||||
TrCC.Init( CC, TP );
|
||||
if ( TrCC.IsDone() ) res = TrCC.Value();
|
||||
if ( TrCC.IsDone() )
|
||||
{
|
||||
if (TrCC.IsInfiniteSegment())
|
||||
{
|
||||
BRep_Builder aB;
|
||||
TopoDS_Compound aComp;
|
||||
aB.MakeCompound(aComp);
|
||||
TopExp_Explorer anExp;
|
||||
for (anExp.Init (TrCC.Value(), TopAbs_EDGE); anExp.More(); anExp.Next())
|
||||
aB.Add (aComp, anExp.Current());
|
||||
res = aComp;
|
||||
}
|
||||
else
|
||||
res = TrCC.Value();
|
||||
}
|
||||
}
|
||||
else { // try other curves
|
||||
Handle(Geom_Curve) aGeomCrv;
|
||||
|
@@ -57,8 +57,13 @@ is
|
||||
---Purpose: Returns result of last translation or null wire if failed.
|
||||
---C++: return const &
|
||||
|
||||
IsInfiniteSegment (me) returns Boolean;
|
||||
---Purpose: Returns True if composite_curve contains a segment with infinite parameters.
|
||||
---C++: inline
|
||||
|
||||
fields
|
||||
|
||||
myWire: Wire from TopoDS;
|
||||
myInfiniteSegment: Boolean;
|
||||
|
||||
end TranslateCompositeCurve;
|
||||
|
@@ -87,6 +87,7 @@ Standard_Boolean StepToTopoDS_TranslateCompositeCurve::Init (const Handle(StepGe
|
||||
const Handle(Geom_Surface) &Surf)
|
||||
{
|
||||
myWire.Nullify();
|
||||
myInfiniteSegment = Standard_False;
|
||||
if ( CC.IsNull() ) return Standard_False;
|
||||
|
||||
Standard_Boolean SurfMode = ( ! S.IsNull() && ! Surf.IsNull() );
|
||||
@@ -167,7 +168,15 @@ Standard_Boolean StepToTopoDS_TranslateCompositeCurve::Init (const Handle(StepGe
|
||||
Handle(Geom_Curve) c3d;
|
||||
if (StepToGeom_MakeCurve::Convert(crv,c3d)) {
|
||||
BRepBuilderAPI_MakeEdge MkEdge ( c3d, c3d->FirstParameter(), c3d->LastParameter() );
|
||||
if ( MkEdge.IsDone() ) edge = MkEdge.Edge();
|
||||
if (MkEdge.IsDone())
|
||||
{
|
||||
if (Precision::IsNegativeInfinite (c3d->FirstParameter()) || Precision::IsPositiveInfinite (c3d->LastParameter()))
|
||||
{
|
||||
myInfiniteSegment = Standard_True;
|
||||
TP->AddWarning (CC, "Segment with infinite parameters");
|
||||
}
|
||||
edge = MkEdge.Edge();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
@@ -187,7 +196,15 @@ Standard_Boolean StepToTopoDS_TranslateCompositeCurve::Init (const Handle(StepGe
|
||||
if ( ! c2d.IsNull() ) {
|
||||
if ( edge.IsNull() ) {
|
||||
BRepBuilderAPI_MakeEdge MkEdge ( c2d, Surf, c2d->FirstParameter(), c2d->LastParameter() );
|
||||
if ( MkEdge.IsDone() ) edge = MkEdge.Edge();
|
||||
if (MkEdge.IsDone())
|
||||
{
|
||||
if (Precision::IsNegativeInfinite (c2d->FirstParameter()) || Precision::IsPositiveInfinite (c2d->LastParameter()))
|
||||
{
|
||||
myInfiniteSegment = Standard_True;
|
||||
TP->AddWarning (CC, "Segment with infinite parameters");
|
||||
}
|
||||
edge = MkEdge.Edge();
|
||||
}
|
||||
}
|
||||
else {
|
||||
BRep_Builder B;
|
||||
|
16
src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.lxx
Normal file
16
src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.lxx
Normal file
@@ -0,0 +1,16 @@
|
||||
// File: StepToTopoDS_TranslateCompositeCurve.lxx
|
||||
// Created: Jan 16 12:08:12 2012
|
||||
// Author: ANNA MASALSKAYA
|
||||
// Copyright: Open CASCADE SAS 2012
|
||||
|
||||
#include <StepToTopoDS_TranslateCompositeCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IsInfiniteSegment
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean StepToTopoDS_TranslateCompositeCurve::IsInfiniteSegment() const
|
||||
{
|
||||
return myInfiniteSegment;
|
||||
}
|
Reference in New Issue
Block a user