Bug was fixed by adding new constructor in ShapeAnalysis_Surface class. This constructor gets a TopoDS_Face as a parameter and bounds face with help of BRepTools:UVBounds().
Also I changed callable constructor in some places (where it looks more efficient) from ShapeAnalysis_Surface(const Handle(Geom_Surface)& S) to:
ShapeAnalysis_Surface(const TopoDS_Face& theFace)
#include <Adaptor3d_Curve.hxx>
#include <Adaptor3d_IsoCurve.hxx>
#include <Bnd_Box.hxx>
+#include <Bnd_Box2d.hxx>
#include <BndLib_Add3dCurve.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepTools.hxx>
#include <ElSLib.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BoundedSurface.hxx>
myAdSur = new GeomAdaptor_Surface(mySurf);
}
+ShapeAnalysis_Surface::ShapeAnalysis_Surface(const TopoDS_Face& theFace) :
+ myFace(theFace),
+ mySurf(BRep_Tool::Surface(theFace)),
+ myExtOK(Standard_False), //:30
+ myNbDeg(-1),
+ myIsos(Standard_False),
+ myIsoBoxes(Standard_False),
+ myGap(0.), myUDelt(0.01), myVDelt(0.01), myUCloseVal(-1), myVCloseVal(-1)
+{
+ mySurf->Bounds(myUF, myUL, myVF, myVL);
+ myAdSur = new GeomAdaptor_Surface(mySurf);
+}
+
//=======================================================================
//function : Init
//purpose :
if (mySurf.IsNull()) return;
Standard_Real su1, sv1, su2, sv2;
- // mySurf->Bounds(su1, su2, sv1, sv2);
- Bounds(su1, su2, sv1, sv2);//modified by rln on 12/11/97 mySurf-> is deleted
myNbDeg = 0; //:r3
- if (mySurf->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
+ if (mySurf->IsKind(STANDARD_TYPE(Geom_ConicalSurface)))
+ {
+ Bounds(su1, su2, sv1, sv2);
Handle(Geom_ConicalSurface) conicS =
Handle(Geom_ConicalSurface)::DownCast(mySurf);
Standard_Real vApex = -conicS->RefRadius() / Sin(conicS->SemiAngle());
myUIsoDeg[0] = Standard_False;
myNbDeg = 1;
}
- else if (mySurf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
+ else if (mySurf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface)))
+ {
+ Bounds(su1, su2, sv1, sv2);
Handle(Geom_ToroidalSurface) toroidS =
Handle(Geom_ToroidalSurface)::DownCast(mySurf);
Standard_Real minorR = toroidS->MinorRadius();
myUIsoDeg[0] = myUIsoDeg[1] = Standard_False;
myNbDeg = (majorR > minorR ? 1 : 2);
}
- else if (mySurf->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
+ else if (mySurf->IsKind(STANDARD_TYPE(Geom_SphericalSurface)))
+ {
+ Bounds(su1, su2, sv1, sv2);
myPreci[0] = myPreci[1] = 0;
myP3d[0] = mySurf->Value(su1, sv2); // Northern pole is first
myP3d[1] = mySurf->Value(su1, sv1);
myNbDeg = 2;
}
else if ((mySurf->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) ||
- (mySurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) || //:b2 abv 18 Feb 98
+ (mySurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) ||
(mySurf->IsKind(STANDARD_TYPE(Geom_OffsetSurface)))) { //rln S4135
- //rln S4135 //:r3
+ Bounds(su1, su2, sv1, sv2);
+ if (mySurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution)) && !myFace.IsNull())
+ {
+ Standard_Real aTmpU1 = 0, aTmpU2 = 0;
+ Bnd_Box2d B;
+ BRepTools::AddUVBounds(myFace, B);
+ if (!B.IsVoid())
+ {
+ B.Get(aTmpU1, myVF, aTmpU2, myVL);
+ }
+ }
myP3d[0] = myAdSur->Value(su1, 0.5 * (sv1 + sv2));
myFirstP2d[0].SetCoord(su1, sv2);
myLastP2d[0].SetCoord(su1, sv1);
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+
#ifndef _ShapeAnalysis_Surface_HeaderFile
#define _ShapeAnalysis_Surface_HeaderFile
#include <Bnd_Box.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
+#include <TopoDS_Face.hxx>
class Geom_Surface;
class Geom_Curve;
//! Creates an analyzer object on the basis of existing surface
Standard_EXPORT ShapeAnalysis_Surface(const Handle(Geom_Surface)& S);
+
+ //! Creates an analyzer object on the basis of existing face
+ Standard_EXPORT ShapeAnalysis_Surface(const TopoDS_Face& theFace);
//! Loads existing surface
Standard_EXPORT void Init (const Handle(Geom_Surface)& S);
protected:
-
+ TopoDS_Face myFace;
Handle(Geom_Surface) mySurf;
Handle(GeomAdaptor_Surface) myAdSur;
Extrema_ExtPS myExtPS;
}
Standard_Real aTol = BRep_Tool::Tolerance(anewV);
if(!hasRepr || (fromSurf != toSurf || fromLoc != toLoc)) {
- Handle(Geom_Surface) aS = BRep_Tool::Surface(toFace);
- Handle(ShapeAnalysis_Surface) aSurfTool = new ShapeAnalysis_Surface(aS);
+ Handle(ShapeAnalysis_Surface) aSurfTool = new ShapeAnalysis_Surface(toFace);
gp_Pnt2d aP2d = aSurfTool->ValueOfUV(apv,Precision::Confusion());
apar1 = aP2d.X();
apar2 = aP2d.Y();
{
myFace = face;
if(!face.IsNull())
- mySurf = new ShapeAnalysis_Surface ( BRep_Tool::Surface ( myFace ) );
+ mySurf = new ShapeAnalysis_Surface (myFace);
}
//=======================================================================
BRep_Builder B;
ShapeFix_WireSegment result;
Handle(ShapeAnalysis_Surface) aSurfTool =
- new ShapeAnalysis_Surface ( BRep_Tool::Surface (myFace) );
+ new ShapeAnalysis_Surface ( myFace );
Standard_Integer nbSplits = indexes.Length();
ShapeAnalysis_Edge sae;
Standard_Integer start = 1;
Standard_Boolean isnonmanifold = (wire.Orientation() == TopAbs_INTERNAL);
//gka correction for non-manifold vertices SAMTECH
if(wire.IsVertex()) {
- Handle(ShapeAnalysis_Surface) aSurfTool = new ShapeAnalysis_Surface ( BRep_Tool::Surface (myFace) );
+ Handle(ShapeAnalysis_Surface) aSurfTool = new ShapeAnalysis_Surface ( myFace );
TopoDS_Vertex aVert = wire.GetVertex();
gp_Pnt aP3d = BRep_Tool::Pnt(aVert);
gp_Pnt2d aP2d = aSurfTool->ValueOfUV(aP3d,Precision::Confusion());
if(wire.IsVertex()) {
TopoDS_Vertex aV = wire.GetVertex();
gp_Pnt aP3D = BRep_Tool::Pnt(aV );
- Handle(Geom_Surface) surf = BRep_Tool::Surface(face);
- Handle(ShapeAnalysis_Surface) aSurfTool = new ShapeAnalysis_Surface(surf);
+ Handle(ShapeAnalysis_Surface) aSurfTool = new ShapeAnalysis_Surface(face);
return aSurfTool->ValueOfUV(aP3D,Precision::Confusion());
}
Bnd_Box2d box;
// make pseudo-face,
TopoDS_Face pf;
B.MakeFace ( pf, surf, myLoc, ::Precision::Confusion() );
- Handle(Geom_Surface) atSurf = BRep_Tool::Surface(pf);
- Handle(ShapeAnalysis_Surface) aSurfTool = new ShapeAnalysis_Surface(atSurf);
+ Handle(ShapeAnalysis_Surface) aSurfTool = new ShapeAnalysis_Surface(pf);
TopTools_SequenceOfShape roots;
Standard_Integer i; // svv #1
for ( i = 1; i <= loops.Length(); i++ ) {
//:S4136 Standard_Real preci = BRepAPI::Precision();
//pdn to manage degenerated case
if (V1.IsSame(V2)) {
- Handle(ShapeAnalysis_Surface) stsu = new ShapeAnalysis_Surface (theSurface);
+ Handle(ShapeAnalysis_Surface) stsu = new ShapeAnalysis_Surface (myFace);
gp_Pnt2d aPt1,aPt2;
Standard_Real firstpar,lastpar;
if (stsu->DegeneratedValues(Pt1,preci,aPt1,aPt2,firstpar,lastpar)){
void ShapeFix_Face::Init (const TopoDS_Face& face)
{
myStatus = 0;
- mySurf = new ShapeAnalysis_Surface ( BRep_Tool::Surface (face) );
+ mySurf = new ShapeAnalysis_Surface ( face );
myFwd = ( face.Orientation() != TopAbs_REVERSED );
myFace = face;
myShape = myFace;
{
// find needed vertex from edge2 and split edge1 using it
ShapeAnalysis_Edge sae;
- Handle(ShapeAnalysis_Surface) sas = new ShapeAnalysis_Surface(BRep_Tool::Surface(face));
+ Handle(ShapeAnalysis_Surface) sas = new ShapeAnalysis_Surface(face);
gp_Pnt pi1 = GetPointOnEdge(edge1,sas,Crv1,param1);
BRep_Builder B;
TopoDS_Vertex V;
// step 2 : intersection of non-adjacent edges
ShapeFix_DataMapOfShapeBox2d boxes;
(void)CreateBoxes2d(sewd,face,boxes);
- Handle(ShapeAnalysis_Surface) sas = new ShapeAnalysis_Surface(BRep_Tool::Surface(face));
+ Handle(ShapeAnalysis_Surface) sas = new ShapeAnalysis_Surface(face);
NbSplit=0;
NbCut=0;
}
Standard_Boolean isDone = Standard_False; //gka 06.09.04
ShapeAnalysis_Edge sae;
- Handle(ShapeAnalysis_Surface) sas = new ShapeAnalysis_Surface (BRep_Tool::Surface (face));
+ Handle(ShapeAnalysis_Surface) sas = new ShapeAnalysis_Surface (face);
// precompute edge boxes for all wires
NCollection_Sequence<ShapeFix_DataMapOfShapeBox2d> aSeqWirEdgeBoxes;
if(!doSplit) {
//pdn try to define geometric closure.
- Handle(ShapeAnalysis_Surface) sas = new ShapeAnalysis_Surface( surf );
+ Handle(ShapeAnalysis_Surface) sas = new ShapeAnalysis_Surface( face );
Standard_Boolean uclosed = sas->IsUClosed(Precision());
Standard_Boolean vclosed = sas->IsVClosed(Precision());
Standard_Real U1, U2, V1, V2;
for (Standard_Integer ii = 1; ii <= ResPCurves.Length(); ii++)
{
const TopoDS_Face& aFace = TopoDS::Face (aFaceSeq(ii));
- Handle(Geom_Surface) aSurf = BRep_Tool::Surface (aFace);
- Handle(ShapeAnalysis_Surface) aSAS = new ShapeAnalysis_Surface (aSurf);
+ Handle(ShapeAnalysis_Surface) aSAS = new ShapeAnalysis_Surface (aFace);
ShapeConstruct_ProjectCurveOnSurface aToolProj;
aToolProj.Init (aSAS, Precision::Confusion());
Handle(Geom2d_Curve) aNewPCurve;
--- /dev/null
+puts "==================================================="
+puts "0027722: Data Exchange - STEP er-ror for Ellipse revol shape"
+puts "==================================================="
+puts ""
+
+pload MODELING XDE VISUALIZATION
+
+ellipse ge 0 0 20 10
+mkedge te ge 0 pi/2.0
+revol re te 0 0 0 0 1 0 360
+
+# save to STEP in mode: As Is.
+stepwrite a re ${imagedir}/${casename}.stp
+
+# read STEP
+stepread ${imagedir}/${casename}.stp sr *
+ttranslate sr_1 50 0 0
+checkshape sr_1
+checkprops sr_1 -equal re
+
+vinit view1
+vclear
+vdisplay -dispmode 1 -3d sr_1 re
+vtrihedron vt
+vfit
+checkview -screenshot -3d -path ${imagedir}/${test_image}.png
+
+file delete ${imagedir}/orig.stp
+++ /dev/null
-puts "TODO OCC27722 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC27722 ALL: Error : is WRONG because number of "
-
-puts "========"
-puts "OCC27722"
-puts "========"
-puts ""
-######################################
-# STEP error for Ellipse revol shape
-######################################
-
-catch {exec rm ${imagedir}/bug27722.stp}
-
-ellipse ge 0 0 20 10
-mkedge te ge 0 pi/2.0
-revol re te 0 0 0 0 1 0 360
-
-set i_Vertex 0
-set i_Edge 0
-set i_Wire 0
-set i_Face 0
-set i_Shell 0
-set i_Solid 0
-set i_CSolid 0
-set i_Compound 0
-set i_Shape 0
-set bug_info [string trim [checkshape re]]
-if {$bug_info == "This shape seems to be valid"} {
- set nb_info [string trim [nbshapes re]]
- set i_Vertex [string trim [lindex $nb_info 7]]
- set i_Edge [string trim [lindex $nb_info 10]]
- set i_Wire [string trim [lindex $nb_info 13]]
- set i_Face [string trim [lindex $nb_info 16]]
- set i_Shell [string trim [lindex $nb_info 19]]
- set i_Solid [string trim [lindex $nb_info 22]]
- set i_CSolid [string trim [lindex $nb_info 25]]
- set i_Compound [string trim [lindex $nb_info 28]]
- set i_Shape [string trim [lindex $nb_info 31]]
-} else {
- puts "ERROR: Problem of test case functionality. Should be additionally investigated."
-}
-
-stepwrite a re ${imagedir}/bug27722.stp
-
-stepread ${imagedir}/bug27722.stp sr *
-checkshape sr_1
-checknbshapes sr_1 -vertex ${i_Vertex} -edge ${i_Edge} -wire ${i_Wire} -face ${i_Face} -shell ${i_Shell} -solid ${i_Solid} -compsolid ${i_CSolid} -compound ${i_Compound} -shape ${i_Shape}