From 42e4630ca73568d91a9369e256c65b6adfab1dc8 Mon Sep 17 00:00:00 2001 From: ama Date: Tue, 6 Mar 2012 12:10:31 +0400 Subject: [PATCH] 0022459: The ImportExport sample crash --- .../standard/01_Geometry/src/GeomSources.cpp | 24 ++++---- .../src/ISession2D/ISession_Direction.cpp | 4 +- .../standard/02_Modeling/src/ModelingDoc.cpp | 56 +++++++++---------- .../standard/03_Viewer2d/src/Viewer2dDoc.cpp | 10 ++-- .../09_Animation/src/AnimationDoc.cpp | 2 +- .../09_Animation/src/AnimationView3D.cpp | 10 ++-- .../10_Convert/src/Convert_Presentation.cpp | 6 +- .../Common/Resource2D/CircularGrid.cpp | 2 +- .../Common/Resource2D/RectangularGrid.cpp | 2 +- src/ShapeAnalysis/ShapeAnalysis_Wire.cxx | 10 ++++ src/StepToTopoDS/StepToTopoDS_Builder.cxx | 17 +++++- .../StepToTopoDS_TranslateCompositeCurve.cdl | 5 ++ .../StepToTopoDS_TranslateCompositeCurve.cxx | 21 ++++++- .../StepToTopoDS_TranslateCompositeCurve.lxx | 16 ++++++ 14 files changed, 124 insertions(+), 61 deletions(-) create mode 100644 src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.lxx diff --git a/samples/mfc/standard/01_Geometry/src/GeomSources.cpp b/samples/mfc/standard/01_Geometry/src/GeomSources.cpp index c78f8405f6..12b8f81b01 100755 --- a/samples/mfc/standard/01_Geometry/src/GeomSources.cpp +++ b/samples/mfc/standard/01_Geometry/src/GeomSources.cpp @@ -575,7 +575,7 @@ void GeomSources::gpTest8(CGeometryDoc* aDoc) Standard_Real radius = 5; Handle(Geom2d_Circle) C = new Geom2d_Circle(gp::OX2d(),radius); -Standard_Real param = 1.2*PI; +Standard_Real param = 1.2*M_PI; Geom2dLProp_CLProps2d CLP (C,param,2,Precision::PConfusion()); gp_Dir2d D; @@ -630,8 +630,8 @@ Standard_Real radius = 5; Handle(Geom2d_Circle) C = new Geom2d_Circle(gp::OX2d(),radius); Geom2dAdaptor_Curve GAC (C); -Standard_Real startparam = 10*PI180; -Standard_Real abscissa = 45*PI180; +Standard_Real startparam = 10*M_PI/180; +Standard_Real abscissa = 45*M_PI/180; gp_Pnt2d P1; C->D0(startparam,P1); // abscissa is the distance along the curve from startparam @@ -1190,7 +1190,7 @@ Standard_Real ang = D1.Angle(D2); \n\ cout<<" D1.Angle(D2) : "<GetISessionContext()->Display(aCurve, Standard_False); Handle(ISession2D_Curve) aCurve2 = new ISession2D_Curve(arc); aDoc->GetISessionContext()->Display(aCurve2, Standard_False); - TCollection_AsciiString Message2 (PI); + TCollection_AsciiString Message2 (M_PI); Message += " PI = ";Message+= Message2; PostProcess(aDoc,ID_BUTTON_Test_32,TheDisplayType,Message.ToCString()); } @@ -2656,7 +2656,7 @@ Standard_Real radius = 3; Handle(Geom_Circle) circle = GC_MakeCircle(centre,axispoint,radius); -Handle(Geom_Geometry) aRotatedEntity = circle->Rotated(gp::OZ(),PI/4); +Handle(Geom_Geometry) aRotatedEntity = circle->Rotated(gp::OZ(),M_PI/4); Standard_CString aRotatedEntityTypeName = aRotatedEntity->DynamicType()->Name(); Handle(Geom_Geometry) aMirroredEntity = aRotatedEntity->Mirrored(gp::ZOX()); @@ -2724,7 +2724,7 @@ Standard_Real value = matrix.Determinant(); DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(aScaledEntity), Quantity_NOC_GREEN,false); DisplayCurve(aDoc,Handle(Geom_Curve)::DownCast(aTranslatedEntity),Quantity_NOC_WHITE,false); - TCollection_AsciiString Message0 (PI); + TCollection_AsciiString Message0 (M_PI); Message += " PI = "; Message+= Message0; Message += "\n"; diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Direction.cpp b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Direction.cpp index bac802f6b8..9091678613 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Direction.cpp +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Direction.cpp @@ -96,13 +96,13 @@ void ISession_Direction::Compute(const Handle(PrsMgr_PresentationManager2d)& aPr myPnt.X()+myLength*myDir.X(), myPnt.Y()+myLength*myDir.Y()); - gp_Dir2d aFirstDir = gp_Dir2d(myDir.X(),myDir.Y()).Rotated (200*PI180) ; + gp_Dir2d aFirstDir = gp_Dir2d(myDir.X(),myDir.Y()).Rotated (200*M_PI/180) ; segment->Add(myPnt.X()+myLength*myDir.X(), myPnt.Y()+myLength*myDir.Y(), myPnt.X()+myLength*myDir.X()+ myLength*aFirstDir.X()/5 , myPnt.Y()+myLength*myDir.Y()+ myLength*aFirstDir.Y()/5 ); - gp_Dir2d aSecondDir = gp_Dir2d(myDir.X(),myDir.Y()).Rotated (-200*PI180) ; + gp_Dir2d aSecondDir = gp_Dir2d(myDir.X(),myDir.Y()).Rotated (-200*M_PI/180) ; segment->Add(myPnt.X()+myLength*myDir.X(), myPnt.Y()+myLength*myDir.Y(), myPnt.X()+myLength*myDir.X()+ myLength*aSecondDir.X()/5 , diff --git a/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp b/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp index 47ff40d1b2..c4f4a182cf 100755 --- a/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp +++ b/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp @@ -192,7 +192,7 @@ void CModelingDoc::OnRotate() Handle(Geom_Axis1Placement) Gax1 = new Geom_Axis1Placement(axe); Handle (AIS_Axis) ax1 = new AIS_Axis(Gax1); myAISContext->Display(ax1,Standard_False); - theTransformation.SetRotation(axe,30*PI/180); + theTransformation.SetRotation(axe,30*M_PI/180); BRepBuilderAPI_Transform myBRepTransformation(S,theTransformation); TopoDS_Shape S2 = myBRepTransformation.Shape(); Handle(AIS_Shape) ais2 = new AIS_Shape(S2); @@ -434,7 +434,7 @@ void CModelingDoc::OnCylinder() myAISContext->Display(aCyl1,Standard_False); TopoDS_Shape C2 = BRepPrimAPI_MakeCylinder (gp_Ax2(gp_Pnt(200.,200.,0.), gp_Dir(0.,0.,1.)), - 40.,110.,210.*PI180); + 40.,110.,210.*M_PI/180); Handle(AIS_Shape) aCyl2 = new AIS_Shape(C2); myAISContext->SetMaterial(aCyl2,Graphic3d_NOM_PLASTIC,Standard_False); myAISContext->SetColor(aCyl2,Quantity_NOC_MATRABLUE,Standard_False); @@ -467,7 +467,7 @@ void CModelingDoc::OnCone() myAISContext->Display(ais1,Standard_False); TopoDS_Shape C2 = BRepPrimAPI_MakeCone(gp_Ax2(gp_Pnt(100.,100.,0.), gp_Dir(0.,0.,1.)), - 60.,0.,150.,210.*PI180); + 60.,0.,150.,210.*M_PI/180); Handle(AIS_Shape) ais2 = new AIS_Shape(C2); myAISContext->SetMaterial(ais2,Graphic3d_NOM_PLASTIC,Standard_False); myAISContext->SetColor(ais2,Quantity_NOC_GREEN,Standard_False); @@ -498,19 +498,19 @@ void CModelingDoc::OnSphere() myAISContext->SetColor(ais1,Quantity_NOC_AZURE,Standard_False); myAISContext->SetMaterial(ais1,Graphic3d_NOM_PLASTIC,Standard_False); myAISContext->Display(ais1,Standard_False); - TopoDS_Shape S2 = BRepPrimAPI_MakeSphere(100.,120.*PI180); + TopoDS_Shape S2 = BRepPrimAPI_MakeSphere(100.,120.*M_PI/180); Handle(AIS_Shape) ais2 = new AIS_Shape(S2); myAISContext->SetColor(ais2,Quantity_NOC_GREEN,Standard_False); myAISContext->SetMaterial(ais2,Graphic3d_NOM_PLASTIC,Standard_False); myAISContext->Display(ais2,Standard_False); TopoDS_Shape S3 = BRepPrimAPI_MakeSphere(gp_Pnt(200.,250.,0.),100., - -60.*PI180, 60.*PI180); + -60.*M_PI/180, 60.*M_PI/180); Handle(AIS_Shape) ais3 = new AIS_Shape(S3); myAISContext->SetColor(ais3,Quantity_NOC_RED,Standard_False); myAISContext->SetMaterial(ais3,Graphic3d_NOM_PLASTIC,Standard_False); myAISContext->Display(ais3,Standard_False); TopoDS_Shape S4 = BRepPrimAPI_MakeSphere(gp_Pnt(0.,0.,-300.),150., - -45.*PI180, 45.*PI180, 45.*PI180); + -45.*M_PI/180, 45.*M_PI/180, 45.*M_PI/180); Handle(AIS_Shape) ais4 = new AIS_Shape(S4); myAISContext->SetColor(ais4,Quantity_NOC_MATRABLUE,Standard_False); myAISContext->SetMaterial(ais4,Graphic3d_NOM_PLASTIC,Standard_False); @@ -544,13 +544,13 @@ void CModelingDoc::OnTorus() myAISContext->SetMaterial(ais1,Graphic3d_NOM_PLASTIC,Standard_False); myAISContext->Display(ais1,Standard_False); TopoDS_Shape S2 = BRepPrimAPI_MakeTorus(gp_Ax2(gp_Pnt(100.,100.,0.),gp_Dir(1.,1.,1.)), - 50.,20.,210.*PI180); + 50.,20.,210.*M_PI/180); Handle(AIS_Shape) ais2 = new AIS_Shape(S2); myAISContext->SetColor(ais2,Quantity_NOC_GREEN,Standard_False); myAISContext->SetMaterial(ais2,Graphic3d_NOM_PLASTIC,Standard_False); myAISContext->Display(ais2,Standard_False); TopoDS_Shape S3 = BRepPrimAPI_MakeTorus(gp_Ax2(gp_Pnt(-200.,-150.,-100),gp_Dir(0.,1.,0.)), - 60.,20.,-45.*PI180,45.*PI180,90.*PI180); + 60.,20.,-45.*M_PI/180,45.*M_PI/180,90.*M_PI/180); Handle(AIS_Shape) ais3= new AIS_Shape(S3); myAISContext->SetColor(ais3,Quantity_NOC_CORAL,Standard_False); myAISContext->SetMaterial(ais3,Graphic3d_NOM_PLASTIC,Standard_False); @@ -721,7 +721,7 @@ void CModelingDoc::OnRevol() Handle(Geom_Axis1Placement) Gax3 = new Geom_Axis1Placement(axe); Handle (AIS_Axis) ax3 = new AIS_Axis(Gax3); myAISContext->Display(ax3,Standard_False); - TopoDS_Shape S3 = BRepPrimAPI_MakeRevol(W,axe, 210.*PI180); + TopoDS_Shape S3 = BRepPrimAPI_MakeRevol(W,axe, 210.*M_PI/180); Handle(AIS_Shape) ais5 = new AIS_Shape(W); myAISContext->Display(ais5,Standard_False); Handle(AIS_Shape) ais6 = new AIS_Shape(S3); @@ -737,7 +737,7 @@ void CModelingDoc::OnRevol() Handle(Geom_Axis1Placement) Gax4 = new Geom_Axis1Placement(axe); Handle (AIS_Axis) ax4 = new AIS_Axis(Gax4); myAISContext->Display(ax4,Standard_False); - TopoDS_Shape S4 = BRepPrimAPI_MakeRevol(F,axe, 90.*PI180); + TopoDS_Shape S4 = BRepPrimAPI_MakeRevol(F,axe, 90.*M_PI/180); Handle(AIS_Shape) ais8 = new AIS_Shape(S4); myAISContext->SetColor(ais8,Quantity_NOC_MATRABLUE,Standard_False); myAISContext->SetMaterial(ais8,Graphic3d_NOM_PLASTIC,Standard_False); @@ -1043,7 +1043,7 @@ void CModelingDoc::OnDraft() gp_Pln apln = surf->Pln(); gp_Dir dirF = apln.Axis().Direction(); if (dirF.IsNormal(gp_Dir(0.,0.,1.),Precision::Angular())) - adraft.Add(F, gp_Dir(0.,0.,1.), 15.*PI180, gp_Pln(gp::XOY())); + adraft.Add(F, gp_Dir(0.,0.,1.), 15.*M_PI/180, gp_Pln(gp::XOY())); } ais1->Set(adraft.Shape()); myAISContext->Redisplay(ais1,Standard_False); @@ -1536,7 +1536,7 @@ BRepFilletAPI_MakeFillet fillet(theCylinder); TColgp_Array1OfPnt2d TabPoint2(1,20); for (Standard_Integer i=0; i<=19; i++) { - gp_Pnt2d Point2d(i*2*PI/19,60*cos(i*PI/19-PI/2)+10); + gp_Pnt2d Point2d(i*2*M_PI/19,60*cos(i*M_PI/19-M_PI/2)+10); TabPoint2.SetValue(i+1,Point2d); } @@ -1938,14 +1938,14 @@ void CModelingDoc::OnDprismLocal() gp_Circ2d c(gp_Ax2d(gp_Pnt2d(200.,130.),gp_Dir2d(1.,0.)),50.); BRepBuilderAPI_MakeWire MW; Handle(Geom2d_Curve) aline = new Geom2d_Circle(c); - MW.Add(BRepBuilderAPI_MakeEdge(aline,surf,0.,PI)); - MW.Add(BRepBuilderAPI_MakeEdge(aline,surf,PI,2.*PI)); + MW.Add(BRepBuilderAPI_MakeEdge(aline,surf,0.,M_PI)); + MW.Add(BRepBuilderAPI_MakeEdge(aline,surf,M_PI,2.*M_PI)); BRepBuilderAPI_MakeFace MKF; MKF.Init(surf,Standard_False, Precision::Confusion()); MKF.Add(MW.Wire()); TopoDS_Face FP = MKF.Face(); BRepLib::BuildCurves3d(FP); - BRepFeat_MakeDPrism MKDP(S,FP,F,10*PI180,1,Standard_True); + BRepFeat_MakeDPrism MKDP(S,FP,F,10*M_PI/180,1,Standard_True); MKDP.Perform(200); TopoDS_Shape res1 = MKDP.Shape(); @@ -2734,7 +2734,7 @@ void CModelingDoc::OnEdge() //////////////The red edge gp_Elips Elips(gp_Ax2(gp_Pnt(10,0,0),gp_Dir(1,1,1)),60,30); - RedEdge = BRepBuilderAPI_MakeEdge(Elips,0,PI/2); + RedEdge = BRepBuilderAPI_MakeEdge(Elips,0,M_PI/2); /////////////The green edge and the both extreme vertex @@ -2865,14 +2865,14 @@ void CModelingDoc::OnWire() ////////////The red wire is build from a single edge gp_Elips Elips(gp_Ax2(gp_Pnt(250,0,0),gp_Dir(1,1,1)),160,90); - Edge1 = BRepBuilderAPI_MakeEdge(Elips,0,PI/2); + Edge1 = BRepBuilderAPI_MakeEdge(Elips,0,M_PI/2); RedWire = BRepBuilderAPI_MakeWire(Edge1); ///////////the yellow wire is build from an existing wire and an edge gp_Circ circle(gp_Ax2(gp_Pnt(-300,0,0),gp_Dir(1,0,0)),80); - Edge2 = BRepBuilderAPI_MakeEdge(circle,0,PI); + Edge2 = BRepBuilderAPI_MakeEdge(circle,0,M_PI); ExistingWire = BRepBuilderAPI_MakeWire(Edge2); @@ -2888,7 +2888,7 @@ void CModelingDoc::OnWire() //////////we use the methods Add, Edge and Vertex from BRepBuilderAPI_MakeWire. gp_Circ circle2(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0,1,0)),200); - Edge4 = BRepBuilderAPI_MakeEdge(circle2,0,PI); + Edge4 = BRepBuilderAPI_MakeEdge(circle2,0,M_PI); ExistingWire2 = BRepBuilderAPI_MakeWire(Edge4); @@ -3043,7 +3043,7 @@ void CModelingDoc::OnFace() //////////////////// gp_Circ circle(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(1,0,0)),80); - Edge1 = BRepBuilderAPI_MakeEdge(circle,0,PI); + Edge1 = BRepBuilderAPI_MakeEdge(circle,0,M_PI); Edge2 = BRepBuilderAPI_MakeEdge(gp_Pnt(0,0,-80),gp_Pnt(0,-10,40)); Edge3 = BRepBuilderAPI_MakeEdge(gp_Pnt(0,-10,40),gp_Pnt(0,0,80)); @@ -3658,7 +3658,7 @@ void CModelingDoc::OnBuilder() B.Add(EX01,V101); //Parameters B.UpdateVertex(V001,0,EX01,precision); - B.UpdateVertex(V101,PI,EX01,precision); + B.UpdateVertex(V101,M_PI,EX01,precision); //Edge EX11 C = new Geom_Circle(gp_Ax2(gp_Pnt(100,150,100),gp_Dir(0,1,0),gp_Dir(-1,0,0)),100); @@ -3669,7 +3669,7 @@ void CModelingDoc::OnBuilder() B.Add(EX11,V111); //Parameters B.UpdateVertex(V011,0,EX11,precision); - B.UpdateVertex(V111,PI,EX11,precision); + B.UpdateVertex(V111,M_PI,EX11,precision); //Build wire and faces //Faces normals are along the axis X,Y,Z @@ -3766,7 +3766,7 @@ void CModelingDoc::OnBuilder() C2d = new Geom2d_Circle(gp_Ax2d(gp_Pnt2d(100,100),gp_Dir2d(0,-1)),100); B.UpdateEdge(EX01,C2d,FYMAX,precision); B.UpdateVertex(V001,0,EX01,FYMAX,precision); - B.UpdateVertex(V101,PI,EX01,FYMAX,precision); + B.UpdateVertex(V101,M_PI,EX01,FYMAX,precision); EZ10.Orientation(TopAbs_REVERSED); B.Add(W,EZ10); @@ -3803,7 +3803,7 @@ void CModelingDoc::OnBuilder() C2d = new Geom2d_Circle(gp_Ax2d(gp_Pnt2d(100,100),gp_Dir2d(0,-1)),100); B.UpdateEdge(EX11,C2d,FYMIN,precision); B.UpdateVertex(V011,0,EX11,FYMIN,precision); - B.UpdateVertex(V111,PI,EX11,FYMIN,precision); + B.UpdateVertex(V111,M_PI,EX11,FYMIN,precision); EZ11.Orientation(TopAbs_REVERSED); B.Add(W,EZ11); @@ -3865,12 +3865,12 @@ void CModelingDoc::OnBuilder() L2d = new Geom2d_Line(gp_Ax2d(gp_Pnt2d(0,0),gp_Dir2d(1,0))); B.UpdateEdge(EX01,L2d,FZMIN,precision); B.UpdateVertex(V001,0,EX01,FZMIN,precision); - B.UpdateVertex(V101,PI,EX01,FZMIN,precision); + B.UpdateVertex(V101,M_PI,EX01,FZMIN,precision); EY11.Orientation(TopAbs_FORWARD); B.Add(W,EY11); //pcurve - L2d = new Geom2d_Line(gp_Pnt2d(PI,0),gp_Dir2d(0,1)); + L2d = new Geom2d_Line(gp_Pnt2d(M_PI,0),gp_Dir2d(0,1)); B.UpdateEdge(EY11,L2d,FZMIN,precision); EX11.Orientation(TopAbs_REVERSED); @@ -3878,7 +3878,7 @@ void CModelingDoc::OnBuilder() //pcurve L2d = new Geom2d_Line(gp_Ax2d(gp_Pnt2d(0,150),gp_Dir2d(1,0))); B.UpdateEdge(EX11,L2d,FZMIN,precision); - B.UpdateVertex(V111,PI,EX11,FZMIN,precision); + B.UpdateVertex(V111,M_PI,EX11,FZMIN,precision); B.UpdateVertex(V011,0,EX11,FZMIN,precision); EY01.Orientation(TopAbs_REVERSED); @@ -5070,4 +5070,4 @@ void CModelingDoc::Popup(const Standard_Integer x, ClientToScreen ( (HWND)(aWNTWindow->HWindow()),&winCoord); pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON , winCoord.x, winCoord.y , AfxGetMainWnd()); -} \ No newline at end of file +} diff --git a/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp b/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp index dab7aa4131..d01019c324 100755 --- a/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp +++ b/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp @@ -115,7 +115,7 @@ void CViewer2dDoc::OnBUTTONTestText() new Sample2D_Text(Text, 0,15*(j-15), // anX , anY Aspect_TOT_SOLID,// aType - 20.0*PI180 , // anAngle + 20.0*M_PI/180 , // anAngle 0.0 , // aSlant color++, // aColorIndex 0, // aFontIndex @@ -247,7 +247,7 @@ void CViewer2dDoc::OnBUTTONTestMarkers() new Sample2D_Markers(EntryNumber, // generic marker index 10*i,10,// display point 5,5, // size - 20*PI180); // angle in radian + 20*M_PI/180); // angle in radian myAISInteractiveContext2D->Display(Marker, // object Standard_False); // Redraw } @@ -269,7 +269,7 @@ void CViewer2dDoc::OnBUTTONTestMarkers() new Sample2D_Markers(20,20, // reference point 0,0, // display point 3,2, // major, minor radius - 20*PI180); // angle + 20*M_PI/180); // angle myAISInteractiveContext2D->Display(Marker, // object Standard_False); // Redraw } @@ -650,7 +650,7 @@ void CViewer2dDoc::OnBUTTONTestRect() Handle (Sample2D_Rectangle) aRectangle = new Sample2D_Rectangle( 0,0, // display point 50,80, // size - 20*PI180); // angle in radian + 20*M_PI/180); // angle in radian aRectangle->SetHighlightMode(AIS2D_TOD_OBJECT); myAISInteractiveContext2D->Display(aRectangle, Standard_False); // Display rectangle @@ -660,7 +660,7 @@ void CViewer2dDoc::OnBUTTONTestRect() Handle (Sample2D_Rectangle) aRectangle2 = new Sample2D_Rectangle( 80,0, // display point 50,90, // size - 20*PI180); // angle in radian + 20*M_PI/180); // angle in radian aRectangle2->SetHighlightMode(AIS2D_TOD_ELEMENT); myAISInteractiveContext2D->Display(aRectangle2); // Display rectangle diff --git a/samples/mfc/standard/09_Animation/src/AnimationDoc.cpp b/samples/mfc/standard/09_Animation/src/AnimationDoc.cpp index 02693a616d..e52ec3da8c 100755 --- a/samples/mfc/standard/09_Animation/src/AnimationDoc.cpp +++ b/samples/mfc/standard/09_Animation/src/AnimationDoc.cpp @@ -284,7 +284,7 @@ void CAnimationDoc::OnMyTimer() myAngle++; - angleA = thread*myAngle*PI/180; + angleA = thread*myAngle*M_PI/180; X = Sin(angleA)*3/8; angleB = atan(X / Sqrt(-X * X + 1)); Standard_Real decal(25*0.6); diff --git a/samples/mfc/standard/09_Animation/src/AnimationView3D.cpp b/samples/mfc/standard/09_Animation/src/AnimationView3D.cpp index 8643441fa5..94a25a96fe 100755 --- a/samples/mfc/standard/09_Animation/src/AnimationView3D.cpp +++ b/samples/mfc/standard/09_Animation/src/AnimationView3D.cpp @@ -104,7 +104,7 @@ CAnimationView3D::CAnimationView3D() // will be set in OnInitial update, but, for more security : m_FlySens = 500. ; - m_TurnSens = Standard_PI / 40. ; + m_TurnSens = M_PI / 40. ; } CAnimationView3D::~CAnimationView3D() @@ -951,7 +951,7 @@ void CAnimationView3D::SetFocal(double dFocus,double dAngle) myView->SetImmediateUpdate ( Standard_False ) ; myView->SetAt ( m_Atx , m_Aty , m_Atz ) ; m_dAngle = dAngle ; - dAngle = dAngle * Standard_PI / 180. ; + dAngle = dAngle * M_PI / 180. ; myPView->SetAngle ( dAngle ) ; dAngle = myPView->Angle () ; @@ -969,7 +969,7 @@ void CAnimationView3D::ReloadData() myView->Eye ( m_Eyex , m_Eyey , m_Eyez ) ; dTwist = myView->Twist () ; - dTwist = dTwist * 180. / Standard_PI ; + dTwist = dTwist * 180. / M_PI ; sprintf_s ( szMsg , "%lf" , m_Atx ) ; (m_Tune.GetDlgItem ( IDC_XAT ))->SetWindowText ( szMsg ) ; @@ -995,7 +995,7 @@ void CAnimationView3D::ReloadData() m_Focus = sqrt ( dx * dx + dy * dy + dz * dz ) ; m_dAngle = myPView->Angle () ; - m_dAngle = m_dAngle * 180. / Standard_PI ; + m_dAngle = m_dAngle * 180. / M_PI ; m_Tune.m_dAngle = m_dAngle ; m_Tune.m_dFocus = m_Focus ; @@ -1053,4 +1053,4 @@ void CAnimationView3D::OnUpdateViewDisplaystatus(CCmdUI* pCmdUI) else { pCmdUI->SetCheck ( 0 ) ; } -} \ No newline at end of file +} diff --git a/samples/mfc/standard/10_Convert/src/Convert_Presentation.cpp b/samples/mfc/standard/10_Convert/src/Convert_Presentation.cpp index 9d888a8dfa..b5d06bfe97 100755 --- a/samples/mfc/standard/10_Convert/src/Convert_Presentation.cpp +++ b/samples/mfc/standard/10_Convert/src/Convert_Presentation.cpp @@ -318,7 +318,7 @@ void Convert_Presentation::sampleCylindricalSurface() // only finit surfaces can be converted to BSpline surfaces, // cylindrical surface is infinite, it must be trimmed Handle(Geom_RectangularTrimmedSurface) aSurface = - new Geom_RectangularTrimmedSurface(aCylSurface, 0, 2*PI, -1000, 1000, Standard_True, Standard_True); + new Geom_RectangularTrimmedSurface(aCylSurface, 0, 2*M_PI, -1000, 1000, Standard_True, Standard_True); drawSurfaceAndItsBSpline(aSurface, aName, aText); } @@ -426,12 +426,12 @@ void Convert_Presentation::sampleConicalSurface() // creating an axis parallel to Z axis gp_Ax3 anAx(gp_Pnt(0,0,0), gp_Dir(0,0,1)); // creating a conical surface with base radius = 10 and angle = 20 deg - Handle(Geom_ConicalSurface) aConicalSurface = new Geom_ConicalSurface(anAx,PI/9., 10); + Handle(Geom_ConicalSurface) aConicalSurface = new Geom_ConicalSurface(anAx,M_PI/9., 10); // only finit surfaces can be converted to BSpline surfaces, // conical surface is infinite, it must be trimmed Handle(Geom_RectangularTrimmedSurface) aSurface = - new Geom_RectangularTrimmedSurface(aConicalSurface, 0, 2*PI, -1000, 1000, Standard_True, Standard_True); + new Geom_RectangularTrimmedSurface(aConicalSurface, 0, 2*M_PI, -1000, 1000, Standard_True, Standard_True); drawSurfaceAndItsBSpline(aSurface, aName, aText); } diff --git a/samples/mfc/standard/Common/Resource2D/CircularGrid.cpp b/samples/mfc/standard/Common/Resource2D/CircularGrid.cpp index a8d67d3bd3..10b0e3b12e 100755 --- a/samples/mfc/standard/Common/Resource2D/CircularGrid.cpp +++ b/samples/mfc/standard/Common/Resource2D/CircularGrid.cpp @@ -68,7 +68,7 @@ void CCircularGrid::UpdateDialogData() YOrigin = m_YOrigin ; RadiusStep = m_RadiusStep ; DivisionNumber = m_DivisionNumber ; - RotationAngle = m_RotationAngle*PI180 ; + RotationAngle = m_RotationAngle*M_PI/180 ; myViewer->SetCircularGridValues(XOrigin, YOrigin, RadiusStep, DivisionNumber, RotationAngle ); } diff --git a/samples/mfc/standard/Common/Resource2D/RectangularGrid.cpp b/samples/mfc/standard/Common/Resource2D/RectangularGrid.cpp index 0ac75f7506..bfde169de5 100755 --- a/samples/mfc/standard/Common/Resource2D/RectangularGrid.cpp +++ b/samples/mfc/standard/Common/Resource2D/RectangularGrid.cpp @@ -58,7 +58,7 @@ void CRectangularGrid::UpdateDialogData() YOrigin = m_YOrigin ; XStep = m_XStep ; YStep = m_YStep ; - RotationAngle= m_RotationAngle*PI180 ; + RotationAngle= m_RotationAngle*M_PI/180 ; myViewer->SetRectangularGridValues(XOrigin, YOrigin, XStep, YStep, RotationAngle ); } diff --git a/src/ShapeAnalysis/ShapeAnalysis_Wire.cxx b/src/ShapeAnalysis/ShapeAnalysis_Wire.cxx index 13a471ae84..5906e10b51 100755 --- a/src/ShapeAnalysis/ShapeAnalysis_Wire.cxx +++ b/src/ShapeAnalysis/ShapeAnalysis_Wire.cxx @@ -551,6 +551,11 @@ Standard_Boolean ShapeAnalysis_Wire::CheckOrder(ShapeAnalysis_WireOrder& sawo, if ( mode3d ) { TopoDS_Vertex V1 = EA.FirstVertex (E); TopoDS_Vertex V2 = EA.LastVertex (E); + if (V1.IsNull() || V2.IsNull()) + { + myStatus = ShapeExtend::EncodeStatus (ShapeExtend_FAIL2); + return Standard_False; + } gp_Pnt p1 = BRep_Tool::Pnt (V1); gp_Pnt p2 = BRep_Tool::Pnt (V2); sawo.Add (p1.XYZ(),p2.XYZ()); @@ -600,6 +605,11 @@ Standard_Boolean ShapeAnalysis_Wire::CheckConnected (const Standard_Integer num, ShapeAnalysis_Edge sae; TopoDS_Vertex V1 = sae.LastVertex (E1); TopoDS_Vertex V2 = sae.FirstVertex (E2); + if (V1.IsNull() || V2.IsNull()) + { + myStatus = ShapeExtend::EncodeStatus (ShapeExtend_FAIL2); + return Standard_False; + } if (V1.IsSame(V2)) return Standard_False; gp_Pnt p1 = BRep_Tool::Pnt (V1); diff --git a/src/StepToTopoDS/StepToTopoDS_Builder.cxx b/src/StepToTopoDS/StepToTopoDS_Builder.cxx index e9dfbd15dd..2aff9ff83f 100755 --- a/src/StepToTopoDS/StepToTopoDS_Builder.cxx +++ b/src/StepToTopoDS/StepToTopoDS_Builder.cxx @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -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; diff --git a/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cdl b/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cdl index 5b825f71be..93f3e9f738 100755 --- a/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cdl +++ b/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cdl @@ -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; diff --git a/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cxx b/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cxx index f510f2ffdb..c51077fcde 100755 --- a/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cxx +++ b/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cxx @@ -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; diff --git a/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.lxx b/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.lxx new file mode 100644 index 0000000000..9e7bc484b8 --- /dev/null +++ b/src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.lxx @@ -0,0 +1,16 @@ +// File: StepToTopoDS_TranslateCompositeCurve.lxx +// Created: Jan 16 12:08:12 2012 +// Author: ANNA MASALSKAYA +// Copyright: Open CASCADE SAS 2012 + +#include + +//======================================================================= +//function : IsInfiniteSegment +//purpose : +//======================================================================= + +inline Standard_Boolean StepToTopoDS_TranslateCompositeCurve::IsInfiniteSegment() const +{ + return myInfiniteSegment; +} -- 2.20.1