1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
ssafarov
623e17d27f 0027170: Reading STEP files produces invalid shapes
Added a new GetEdgeCurve() method that returns a 3D curve or a curve on a surface by subtracting the location of the face.
2022-02-09 11:35:21 +03:00
6 changed files with 88 additions and 32 deletions

View File

@@ -996,7 +996,6 @@ void AIS_InteractiveContext::RecomputePrsOnly (const Handle(AIS_InteractiveObjec
myMainVwr->Update();
}
}
//=======================================================================
//function : RecomputeSelectionOnly
//purpose :
@@ -1008,20 +1007,9 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
return;
}
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIO);
if (aStatus != NULL)
{
if (!myLastPicked.IsNull()
&& myLastPicked->IsSameSelectable (theIO))
{
clearDynamicHighlight();
myLastPicked.Nullify();
}
unselectOwners (theIO);
}
mgrSelector->RecomputeSelection (theIO);
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIO);
if (aStatus == NULL
|| theIO->DisplayStatus() != PrsMgr_DisplayStatus_Displayed)
{

View File

@@ -147,7 +147,6 @@ public: //! @name object display management
Standard_EXPORT void RemoveAll (const Standard_Boolean theToUpdateViewer);
//! Recomputes the seen parts presentation of the Object.
//! The object will be also unhighlighted and removed from selection.
//! If theAllModes equals true, all presentations are present in the object even if unseen.
Standard_EXPORT void Redisplay (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Boolean theToUpdateViewer,
@@ -160,14 +159,13 @@ public: //! @name object display management
const Standard_Boolean theToUpdateViewer);
//! Recomputes the displayed presentations, flags the others.
//! Doesn't update selections.
//! Doesn't update presentations.
Standard_EXPORT void RecomputePrsOnly (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Boolean theToUpdateViewer,
const Standard_Boolean theAllModes = Standard_False);
//! Recomputes the active selections, flags the others.
//! Doesn't update presentations.
//! The object will be also unhighlighted and removed from selection.
Standard_EXPORT void RecomputeSelectionOnly (const Handle(AIS_InteractiveObject)& anIObj);
//! Updates displayed interactive object by checking and recomputing its flagged as "to be recomputed" presentation and selection structures.

View File

@@ -148,14 +148,15 @@ void BRepCheck_Edge::Minimum()
BRepCheck::Add(lst,BRepCheck_InvalidRange);
}
else {
if (myCref->IsCurve3D()) {
IsCurve3D = myCref->IsCurve3D();
if (IsCurve3D) {
// eap 6 Jun 2002 occ332
// better transform C3d instead of transforming Surf upto C3d initial location,
// on transformed BSpline surface 'same parameter' may seem wrong
TopLoc_Location L = myShape.Location() * myCref->Location();
Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
(myCref->Curve3D()->Transformed
(/*myCref->Location()*/L.Transformation()));
(myCref->Curve3D()->Transformed
(/*myCref->Location()*/L.Transformation()));
Standard_Boolean IsPeriodic = C3d->IsPeriodic();
Standard_Real aPeriod = RealLast();
if(IsPeriodic)
@@ -186,9 +187,8 @@ void BRepCheck_Edge::Minimum()
}
else
{
GeomAdaptor_Curve GAC3d(C3d, C3d->TransformedParameter(First, L.Transformation()),
C3d->TransformedParameter(Last, L.Transformation()));
myHCurve = new GeomAdaptor_Curve(GAC3d);
TopoDS_Shape aShape;
myHCurve = GetEdgeCurve(aShape);
}
}
else { // curve on surface
@@ -226,11 +226,8 @@ void BRepCheck_Edge::Minimum()
}
else
{
Handle(GeomAdaptor_Surface) GAHSref = new GeomAdaptor_Surface(Sref);
Handle(Geom2dAdaptor_Curve) GHPCref =
new Geom2dAdaptor_Curve(PCref,First,Last);
Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
myHCurve = new Adaptor3d_CurveOnSurface(ACSref);
TopoDS_Shape aShape;
myHCurve = GetEdgeCurve(aShape);
}
}
}
@@ -301,6 +298,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
return;
}
// Modified by skv - Tue Apr 27 11:48:14 2004 End
myHCurve = GetEdgeCurve(S);
Standard_Real First = myHCurve->FirstParameter();
Standard_Real Last = myHCurve->LastParameter();
@@ -372,7 +370,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
Handle(Geom_Surface) Sb = cr->Surface();
Sb = Handle(Geom_Surface)::DownCast
// (Su->Transformed(L.Transformation()));
(Su->Transformed(/*L*/(Floc * TFloc).Transformation()));
(Su->Transformed(/*L*/TFloc.Transformation()));
Handle(Geom2d_Curve) PC = cr->PCurve();
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(Sb);
Handle(Geom2dAdaptor_Curve) GHPC = new Geom2dAdaptor_Curve(PC,f,l);
@@ -440,7 +438,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
// plan en position
if (myGctrl) {
P = Handle(Geom_Plane)::
DownCast(P->Transformed(/*L*/(Floc * TFloc).Transformation()));// eap occ332
DownCast(P->Transformed(/*L*/TFloc.Transformation()));// eap occ332
//on projette Cref sur ce plan
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(P);
@@ -548,6 +546,64 @@ Standard_Boolean BRepCheck_Edge::GeometricControls() const
return myGctrl;
}
//=======================================================================
//function : GetEdgeCurve
//purpose :
//=======================================================================
Handle(Adaptor3d_Curve) BRepCheck_Edge::GetEdgeCurve(const TopoDS_Shape& theShape)
{
Handle(Adaptor3d_Curve) aLocalCurve;
Handle(BRep_GCurve) GCref(Handle(BRep_GCurve)::DownCast(myCref));
Standard_Real First, Last;
GCref->Range(First, Last);
if (IsCurve3D)
{
TopLoc_Location L = myShape.Location() * myCref->Location();
Handle(Geom_Curve) C3d;
if (!theShape.IsNull())
{
C3d = Handle(Geom_Curve)::DownCast
(myCref->Curve3D()->Transformed
(/*myCref->Location()*/L.Predivided(theShape.Location()).Transformation()));
}
else
{
C3d = Handle(Geom_Curve)::DownCast
(myCref->Curve3D()->Transformed
(/*myCref->Location()*/L.Transformation()));
}
GeomAdaptor_Curve GAC3d(C3d, C3d->TransformedParameter(First, L.Transformation()),
C3d->TransformedParameter(Last, L.Transformation()));
aLocalCurve = new GeomAdaptor_Curve(GAC3d);
}
else
{
Handle(Geom_Surface) Sref = myCref->Surface();
if (!theShape.IsNull())
{
Sref = Handle(Geom_Surface)::DownCast
(Sref->Transformed(myCref->Location().Predivided(theShape.Location()).Transformation()));
}
else
{
Sref = Handle(Geom_Surface)::DownCast
(Sref->Transformed(myCref->Location().Transformation()));
}
const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
Handle(GeomAdaptor_Surface) GAHSref = new GeomAdaptor_Surface(Sref);
Handle(Geom2dAdaptor_Curve) GHPCref =
new Geom2dAdaptor_Curve(PCref, First, Last);
Adaptor3d_CurveOnSurface ACSref(GHPCref, GAHSref);
aLocalCurve = new Adaptor3d_CurveOnSurface(ACSref);
}
return aLocalCurve;
}
//=======================================================================
//function : SetStatus
//purpose :

View File

@@ -45,6 +45,11 @@ public:
Standard_EXPORT Standard_Boolean GeometricControls() const;
//! Creates a 3d curve or surface on a curve by subtracting the location of the face
//! @param[in] theShape input shape to get the location from it
//! @return a 3d curve or curve on a surface
Standard_EXPORT Handle(Adaptor3d_Curve) GetEdgeCurve(const TopoDS_Shape& theShape);
Standard_EXPORT void GeometricControls (const Standard_Boolean B);
Standard_EXPORT Standard_Real Tolerance();
@@ -81,6 +86,7 @@ private:
Handle(Adaptor3d_Curve) myHCurve;
Standard_Boolean myGctrl;
Standard_Boolean myIsExactMethod;
Standard_Boolean IsCurve3D;
};
#endif // _BRepCheck_Edge_HeaderFile

View File

@@ -5238,8 +5238,6 @@ static int VDisplay2 (Draw_Interpretor& theDI,
}
}
// invalidate picking cache
ViewerTest::CurrentEventManager()->ResetPreviousMoveTo();
return 0;
}

10
tests/bugs/heal/bug27170 Normal file
View File

@@ -0,0 +1,10 @@
puts "============"
puts "0027170: Reading STEP files produces invalid shapes"
puts "============"
restore [locate_data_file bug27170_f.brep] f
fixshape result f
ttranslate result 9.68119149294e-13 217.938944319 299.700009766
checkshape result