// Created on: 2002-03-20
// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
+// Copyright (c) 2002-2014 OPEN CASCADE SAS
//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// 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.
//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
#include <stdio.h>
#include <AIS_Shape.hxx>
#include <TopoDS_Shape.hxx>
+#include <Geom_Surface.hxx>
#include <Geom_Axis2Placement.hxx>
#include <gp.hxx>
#include <gp_Trsf.hxx>
#include <OSD_Exception_ACCESS_VIOLATION.hxx>
#include <OSD_Exception_STACK_OVERFLOW.hxx>
#include <OSD.hxx>
+#include <OSD_ThreadPool.hxx>
#include <STEPCAFControl_Writer.hxx>
#include <STEPControl_StepModelType.hxx>
#include <Interface_Static.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <Geom_BSplineCurve.hxx>
#include <TColgp_Array1OfPnt.hxx>
+#include <AIS_ColorScale.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
#include <V3d_View.hxx>
#include <BRepFeat_SplitShape.hxx>
#include <BRepAlgoAPI_Section.hxx>
+#include <TColStd_PackedMapOfInteger.hxx>
+#include <Message.hxx>
+#include <Draw_Printer.hxx>
-#include <tcl.h>
-
-#if ! defined(WNT)
+#if ! defined(_WIN32)
extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
#else
Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
Graphic3d_MaterialAspect mat(Graphic3d_NOM_PLASTIC);
AS->SetMaterial(mat);
AS->SetColor(Quantity_NOC_RED);
- myAISContext->Display(AS);
+ myAISContext->Display (AS, Standard_False);
gp_Trsf TouchTrsf;
TouchTrsf.SetTranslation(gp_Vec(20, 20, 0));
return 1;
}
- if(anAISCtx->HasOpenedContext()) anAISCtx->CloseAllContexts();
- anAISCtx->EraseAll();
+ anAISCtx->EraseAll (Standard_False);
//load primitives to context
- Handle(AIS_Shape) aSh1 = new AIS_Shape(aBox);
- anAISCtx->Display(aSh1);
+ Handle(AIS_InteractiveObject) aSh1 = new AIS_Shape(aBox);
+ anAISCtx->Display (aSh1, Standard_False);
- Handle(AIS_Shape) aSh2 = new AIS_Shape(aSphere);
- anAISCtx->Display(aSh2);
+ Handle(AIS_InteractiveObject) aSh2 = new AIS_Shape(aSphere);
+ anAISCtx->Display (aSh2, Standard_False);
- Handle(AIS_Shape) aSh3 = new AIS_Shape(aCone);
- anAISCtx->Display(aSh3);
+ Handle(AIS_InteractiveObject) aSh3 = new AIS_Shape(aCone);
+ anAISCtx->Display (aSh3, Standard_False);
- Handle(AIS_Shape) aSh4 = new AIS_Shape(aCyl);
- anAISCtx->Display(aSh4);
+ Handle(AIS_InteractiveObject) aSh4 = new AIS_Shape(aCyl);
+ anAISCtx->Display (aSh4, Standard_False);
//set selected
- anAISCtx->InitCurrent();
- anAISCtx->AddOrRemoveCurrentObject(aSh1);
- anAISCtx->AddOrRemoveCurrentObject(aSh2);
- anAISCtx->AddOrRemoveCurrentObject(aSh3);
- anAISCtx->AddOrRemoveCurrentObject(aSh4);
+ anAISCtx->InitSelected();
+ anAISCtx->AddOrRemoveSelected (aSh1, Standard_False);
+ anAISCtx->AddOrRemoveSelected (aSh2, Standard_False);
+ anAISCtx->AddOrRemoveSelected (aSh3, Standard_False);
+ anAISCtx->AddOrRemoveSelected (aSh4, Standard_False);
//remove all this objects from context
- anAISCtx->Clear(aSh1, Standard_False);
- anAISCtx->Clear(aSh2, Standard_False);
- anAISCtx->Clear(aSh3, Standard_False);
- anAISCtx->Clear(aSh4, Standard_False);
+ anAISCtx->Remove (aSh1, Standard_False);
+ anAISCtx->Remove (aSh2, Standard_False);
+ anAISCtx->Remove (aSh3, Standard_False);
+ anAISCtx->Remove (aSh4, Standard_False);
+
+ anAISCtx->UpdateCurrentViewer();
return 0;
}
printf("Usage: %s iges_input [name]\n",argv[0]);
return(1);
}
- Standard_Character *Ch;
+ Standard_Character *Ch = NULL;
if(argc > 2) {
Ch = new Standard_Character[strlen(argv[2])+3];
return (1);
}
-static Standard_Integer BUC60661(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
-{
- if(argc!=2)
- {
- di << "Usage : " << a[0] << " file.igs" << "\n";
- return -1;
- }
-
- Handle(AIS_InteractiveContext) myContext = ViewerTest::GetAISContext();
-
- if(myContext.IsNull()) {
- di << "use 'vinit' command before " << a[0] << "\n";
- return -1;
- }
-
- // MKV 30.03.05
-#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
- const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#else
- Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#endif
-
- Standard_Character *file1 = new Standard_Character [strlen(DD)+strlen(a[1])+2];
- Sprintf(file1,"%s/%s",DD,a[1]);
-
- IGESToBRep_Reader reader;
- Standard_Integer status = reader.LoadFile(file1);
- if( !status ) {
- IGESToBRep::Init();
- reader.TransferRoots();
- TopoDS_Shape shape = reader.OneShape();
-
- Handle(AIS_Shape) importedShape = new AIS_Shape(shape);
-
- Handle(V3d_Viewer) myPView = myContext->CurrentViewer();
-
- if( ! myPView.IsNull() && (myPView->DefaultVisualization() == V3d_WIREFRAME) )
- importedShape->SetDisplayMode(AIS_WireFrame);
- else importedShape->SetDisplayMode(AIS_Shaded);
- myContext->Display(importedShape);
- }
-
- printf("\n End of my IGES to 3D-viewer *****************>\n");
- return 0;
-}
-
-
//====================================================
//
// Following code is inserted from
Standard_Integer n, const char ** a)
{
if (n < 6) {
- di << "Usage: " << a[0] << " result path cur1 cur2 radius [tolerance]" << "\n";
+ di << "Usage: " << a[0] << " result path cur1 cur2 radius [tolerance]\n";
return 1;
}
for (i=2 ; i<=4; i++) {
Handle(Geom_Curve) aC = Handle(Geom_Curve)::DownCast( DrawTrSurf::Get(a[i]) );
if (aC.IsNull()) {
- di << a[i] << " is not a curve" << "\n";
+ di << a[i] << " is not a curve\n";
return 1;
}
aCurveSeq.Append(aC);
aPipe.Perform(Standard_True/*, Standard_True*/);
}
+ if (!aPipe.IsDone()) {
+ di << "GeomFill_Pipe cannot make a surface\n";
+ return 1;
+ }
+
Handle(Geom_Surface) aSurf = aPipe.Surface();
DrawTrSurf::Set(a[1], aSurf);
//static Standard_Integer findplanarsurface(Draw_Interpretor&, Standard_Integer n, const char ** a)
{
if (n<3) {
- di << "bad number of arguments" <<"\n";
+ di << "bad number of arguments\n";
return 1;
}
// try to read a shape:
TopoDS_Shape inputShape=DBRep::Get(a[2]);
if (inputShape.IsNull() || inputShape.ShapeType() != TopAbs_WIRE) {
- di << "Invalid input shape"<< "\n";
+ di << "Invalid input shape\n";
return 1;
}
Standard_Real toler = Draw::Atof(a[3]);
TopoDS_Wire aWire = TopoDS::Wire(inputShape);
BRepLib_FindSurface FS(aWire, toler, Standard_True);
if(FS.Found()) {
- di<<"OCC157: OK; Planar surface is found"<<"\n";
+ di<<"OCC157: OK; Planar surface is found\n";
Handle(Geom_Surface) aSurf = FS.Surface();
BRepBuilderAPI_MakeFace aMakeFace(aSurf,aWire,Standard_True);
if(aMakeFace.IsDone()) {
{
if (n > 2)
{
- di <<"Usage : " << a[0] << " [file]"<<"\n";
+ di <<"Usage : " << a[0] << " [file]\n";
return 1;
}
di.Eval ("axo");
}
#include<BRepAlgoAPI_Cut.hxx>
-#include<BRepAlgo_Cut.hxx>
#include<BRepPrimAPI_MakeHalfSpace.hxx>
-#include<Handle_Geom_CartesianPoint.hxx>
#include<Geom_CartesianPoint.hxx>
#include<AIS_Point.hxx>
static Standard_Integer OCC297 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
{
-
Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
- if(myAISContext.IsNull()) {
+ if (myAISContext.IsNull()) {
di << "use 'vinit' command before " << argv[0] << "\n";
return -1;
}
+
+ gp_Pnt pt1_(250., 250., 0.);
+ gp_Pnt pt2_(-250., 250., 0.);
+ gp_Pnt pt3_(-250., -250., 0.);
+ gp_Pnt pt4_(250., -250., 0.);
+ BRepBuilderAPI_MakeEdge edg1_(pt1_, pt2_);
+ BRepBuilderAPI_MakeEdge edg2_(pt2_, pt3_);
+ BRepBuilderAPI_MakeEdge edg3_(pt3_, pt4_);
+ BRepBuilderAPI_MakeEdge edg4_(pt4_, pt1_);
+
+ BRepBuilderAPI_MakeWire wire_(edg1_, edg2_, edg3_, edg4_);
+ BRepBuilderAPI_MakeFace face_(wire_);
+ TopoDS_Face sh_ = face_.Face();
+
+ int up = 1;
+
+ gp_Pnt g_pnt;
+ if (up)
+ g_pnt = gp_Pnt(0, 0, -100);
+ else
+ g_pnt = gp_Pnt(0, 0, 100);
+ myAISContext->EraseAll(Standard_False);
+ Handle(Geom_CartesianPoint) GEOMPoint = new Geom_CartesianPoint(g_pnt);
+ Handle(AIS_Point) AISPoint = new AIS_Point(GEOMPoint);
+ myAISContext->Display(AISPoint, Standard_True);
- gp_Pnt pt1_(250.,250.,0.);
- gp_Pnt pt2_(-250.,250.,0.);
- gp_Pnt pt3_(-250.,-250.,0.);
- gp_Pnt pt4_(250.,-250.,0.);
- BRepBuilderAPI_MakeEdge edg1_(pt1_, pt2_);
- BRepBuilderAPI_MakeEdge edg2_(pt2_, pt3_);
- BRepBuilderAPI_MakeEdge edg3_(pt3_, pt4_);
- BRepBuilderAPI_MakeEdge edg4_(pt4_, pt1_);
-
- BRepBuilderAPI_MakeWire wire_(edg1_, edg2_, edg3_, edg4_);
- BRepBuilderAPI_MakeFace face_(wire_);
- TopoDS_Face sh_ = face_.Face();
-
- int up = 1;
-
- gp_Pnt g_pnt;
- if(up)
- g_pnt = gp_Pnt(0,0,-100);
- else
- g_pnt = gp_Pnt(0,0,100);
-
- myAISContext->EraseAll(Standard_False);
- Handle(Geom_CartesianPoint) GEOMPoint = new Geom_CartesianPoint(g_pnt);
- Handle(AIS_Point) AISPoint = new AIS_Point(GEOMPoint);
- myAISContext->Display(AISPoint);
-
- BRepPrimAPI_MakeHalfSpace half_(sh_, g_pnt);
- TopoDS_Solid sol1_ = half_.Solid();
-// Handle(AIS_Shape) AISHalf = new AIS_Shape(sol1_);
-// AISHalf->SetColor(Quantity_NOC_GREEN);
-// myAISContext->Display(AISHalf);
-
- DBRep::Set("Face",sol1_);
-
- gp_Ax1 ax1_(gp_Pnt(0., 0., -100.), gp_Dir(0., 0., 1.));
+ BRepPrimAPI_MakeHalfSpace half_(sh_, g_pnt);
+ TopoDS_Solid sol1_ = half_.Solid();
- Standard_Real x=0., y=0., z=-80.;
+ DBRep::Set("Face", sol1_);
- BRepPrimAPI_MakeBox box(gp_Pnt(x,y,z),gp_Pnt(x+150,y+200,z+200));
-// Handle(AIS_Shape) AISBox = new AIS_Shape(box);
-// AISBox->SetColor(Quantity_NOC_BLUE1);
-// myAISContext->Display(AISBox);
+ gp_Ax1 ax1_(gp_Pnt(0., 0., -100.), gp_Dir(0., 0., 1.));
- DBRep::Set("Box",box.Shape());
+ Standard_Real x = 0., y = 0., z = -80.;
-// BRepAlgoAPI_Cut cut( sol1_, box.Shape() );
-// //BRepAlgoAPI_Cut cut( box.Shape(), sol1_ );
-// TopoDS_Shape sh1_ = cut.Shape();
-// Handle(AIS_Shape) AISCut = new AIS_Shape(sh1_);
-// AISCut->SetColor(Quantity_NOC_RED);
-// myAISContext->Display(AISCut);
+ BRepPrimAPI_MakeBox box(gp_Pnt(x, y, z), gp_Pnt(x + 150, y + 200, z + 200));
-// DBRep::Set("Cut",sh1_);
+ DBRep::Set("Box", box.Shape());
return 0;
}
+
#include<GProp_GProps.hxx>
#include<BRepGProp.hxx>
{
if (argc != 2)
{
- di <<"Usage : " << argv[0] << " file"<<"\n";
+ di <<"Usage : " << argv[0] << " file\n";
return 1;
}
Standard_CString file = argv[1];
BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
Handle(AIS_Shape) anAISBox = new AIS_Shape(aBox.Shape());
+ myAISContext->SetAutoActivateSelection (Standard_False);
myAISContext->Display(anAISBox, 1);
- anAISBox->SetSelectionMode(-1);
- Standard_Integer myLocContInd = myAISContext->OpenLocalContext();
- myAISContext->CloseLocalContext(myLocContInd);
- Standard_Integer aSelMode = ((Handle(AIS_InteractiveObject)) anAISBox)->SelectionMode();
- if(aSelMode != -1)
+
+ TColStd_ListOfInteger anActivatedModes;
+ myAISContext->ActivatedModes (anAISBox, anActivatedModes);
+ if(anActivatedModes.Extent() != 1 || anActivatedModes.First() != -1 )
return 1;
return 0;
static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
{
if (nb != 2) {
- di << "Usage: " << a[0] << " Doc" << "\n";
+ di << "Usage: " << a[0] << " Doc\n";
return 1;
}
Handle(TDocStd_Document) D;
if (!DDocStd::GetDocument(a[1],D)) return 1;
- Handle(TDocStd_Application) A;
- if (!DDocStd::Find(A)) return 1;
+ Handle(TDocStd_Application) A = DDocStd::GetApplication();
TCollection_ExtendedString theStatusMessage;
if (!D->IsSaved()) {
- di << "this document has never been saved" << "\n";
+ di << "this document has never been saved\n";
return 0;
}
PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
if (theStatus != PCDM_SS_OK ) {
switch ( theStatus ) {
- case PCDM_SS_DriverFailure: {
- di << " Could not store , no driver found to make it " <<"\n" ;
- break ;
- }
- case PCDM_SS_WriteFailure: {
- di << " Write access failure " << "\n" ;
- break;
- }
- case PCDM_SS_Failure: {
- di << " Write failure " << "\n" ;
- }
+ case PCDM_SS_DriverFailure: {
+ di << "Error saving document: Could not store , no driver found to make it\n";
+ break ;
+ }
+ case PCDM_SS_WriteFailure: {
+ di << "Error saving document: Write access failure\n";
+ break;
+ }
+ case PCDM_SS_Failure: {
+ di << "Error saving document: Write failure\n" ;
+ break;
+ }
+ case PCDM_SS_Doc_IsNull: {
+ di << "Error saving document: No document to save\n";
+ break ;
+ }
+ case PCDM_SS_No_Obj: {
+ di << "Error saving document: No objects written\n";
+ break;
+ }
+ case PCDM_SS_Info_Section_Error: {
+ di << "Error saving document: Write info section failure\n" ;
+ break;
+ }
+ default:
+ break;
}
return 1;
}
static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
{
if (nb != 3) {
- di << "Usage: " << a[0] << " Doc Path" << "\n";
+ di << "Usage: " << a[0] << " Doc Path\n";
return 1;
}
if (!DDocStd::GetDocument(a[1],D)) return 1;
TCollection_ExtendedString path (a[2]);
- Handle(TDocStd_Application) A;
- if (!DDocStd::Find(A)) return 1;
+ Handle(TDocStd_Application) A = DDocStd::GetApplication();
TCollection_ExtendedString theStatusMessage;
PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
if (theStatus != PCDM_SS_OK ) {
switch ( theStatus ) {
- case PCDM_SS_DriverFailure: {
- di << " Could not store , no driver found to make it " <<"\n" ;
- break ;
- }
- case PCDM_SS_WriteFailure: {
- di << " Write access failure " << "\n" ;
- break;
- }
- case PCDM_SS_Failure: {
- di << " Write failure " << "\n" ;
- }
+ case PCDM_SS_DriverFailure: {
+ di << "Error saving document: Could not store , no driver found to make it\n";
+ break ;
+ }
+ case PCDM_SS_WriteFailure: {
+ di << "Error saving document: Write access failure\n";
+ break;
+ }
+ case PCDM_SS_Failure: {
+ di << "Error saving document: Write failure\n" ;
+ break;
+ }
+ case PCDM_SS_Doc_IsNull: {
+ di << "Error saving document: No document to save\n";
+ break ;
+ }
+ case PCDM_SS_No_Obj: {
+ di << "Error saving document: No objects written\n";
+ break;
+ }
+ case PCDM_SS_Info_Section_Error: {
+ di << "Error saving document: Write info section failure\n" ;
+ break;
+ }
+ default:
+ break;
}
return 1;
}
#include <BRepClass3d_SolidClassifier.hxx>
-Standard_Integer OCC299bug (Draw_Interpretor& di,
- Standard_Integer n,
- const char ** a)
+Standard_Integer OCC299bug (Draw_Interpretor& theDi,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
{
- char sbf[512];
-
- if (n < 3) {
- di << "Usage : " << a[0] << " Solid Point [Tolerance=1.e-7]" << "\n";
+ if (theArgNb < 3)
+ {
+ theDi << "Usage : " << theArgVec[0] << " Solid Point [Tolerance=1.e-7]\n";
return -1;
}
- TopoDS_Shape aS = DBRep::Get(a[1]);
- if (aS.IsNull()) {
- Sprintf(sbf, " Null Shape is not allowed here\n");
- di<<sbf;
+ TopoDS_Shape aS = DBRep::Get (theArgVec[1]);
+ if (aS.IsNull())
+ {
+ theDi << " Null Shape is not allowed here\n";
return 1;
}
-
- if (aS.ShapeType()!=TopAbs_SOLID) {
- Sprintf(sbf, " Shape type must be SOLID\n");
- di<<sbf;
+ else if (aS.ShapeType() != TopAbs_SOLID)
+ {
+ theDi << " Shape type must be SOLID\n";
return 1;
}
- //
- Standard_Real aTol=1.e-7;
- TCollection_AsciiString sIN("IN"), sOUT("OUT of"), sON("ON"), sUNKNOWN("UNKNOWN");
- TopAbs_State aState = TopAbs_UNKNOWN;
- gp_Pnt aP(8., 9., 10.);
-
- if (!DrawTrSurf::GetPoint(a[2], aP) ) {
- Sprintf(sbf, " Null Point is not allowed here\n");
- di<<sbf;
+
+ gp_Pnt aP (8., 9., 10.);
+ if (!DrawTrSurf::GetPoint (theArgVec[2], aP))
+ {
+ theDi << " Null Point is not allowed here\n";
return 1;
}
+ const Standard_Real aTol = (theArgNb == 4) ? Draw::Atof (theArgVec[3]) : 1.e-7;
- aTol=1.e-7;
- if (n==4) {
- aTol=Draw::Atof(a[3]);
- }
- //
- BRepClass3d_SolidClassifier aSC(aS);
- aSC.Perform(aP,aTol);
- //
- aState = aSC.State();
- //
- Sprintf(sbf, "The point is "); di<<sbf;
- //
- switch (aState) {
- case TopAbs_IN:
- Sprintf(sbf, sIN.ToCString());
- break;
- case TopAbs_OUT:
- Sprintf(sbf, sOUT.ToCString());
- break;
- case TopAbs_ON:
- Sprintf(sbf, sON.ToCString());
- break;
- case TopAbs_UNKNOWN:
- Sprintf(sbf, sUNKNOWN.ToCString());
- break;
- default:
- Sprintf(sbf, sUNKNOWN.ToCString());
- break;
- }
- di<<sbf;
- //
- Sprintf(sbf, " shape\n");
- di<<sbf;
+ BRepClass3d_SolidClassifier aSC (aS);
+ aSC.Perform (aP, aTol);
- return 0;
+ switch (aSC.State())
+ {
+ case TopAbs_IN: theDi << "The point is IN shape\n"; return 0;
+ case TopAbs_OUT: theDi << "The point is OUT of shape\n"; return 0;
+ case TopAbs_ON: theDi << "The point is ON shape\n"; return 0;
+ case TopAbs_UNKNOWN:
+ default: theDi << "The point is UNKNOWN shape\n"; return 0;
+ }
}
#include <OSD_Process.hxx>
OSD_Path d = p.CurrentDirectory();
TCollection_AsciiString s;
d.SystemName(s);
- di << "*" << s.ToCString() << "*" << "\n";
+ di << "*" << s.ToCString() << "*\n";
d.UpTrek();
d.SystemName(s);
- di << "*" << s.ToCString() << "*" <<"\n";
+ di << "*" << s.ToCString() << "*\n";
return 0;
}
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Common.hxx>
-#include <BRepAlgo_Fuse.hxx>
-#include <BRepAlgo_Common.hxx>
static Standard_Integer OCC277bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
{
- //if (nb != 1) {
- // cout << "Usage: " << a[0] << endl;
- // return 1;
- //}
- if(nb < 1 || nb > 2) {
- di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+ if(nb != 1) {
+ di << "Usage : " << a[0] << "\n";
return 1;
}
- Standard_Boolean IsBRepAlgoAPI = Standard_True;
- if (nb == 2) {
- Standard_Integer IsB = Draw::Atoi(a[1]);
- if (IsB != 1) {
- IsBRepAlgoAPI = Standard_False;
- }
- }
BRepPrimAPI_MakeBox box1( 100, 100, 100 );
BRepPrimAPI_MakeBox box2( gp_Pnt( 50, 50,50 ), 200, 200, 200 );
TopoDS_Shape shape1 = box1.Shape();
TopoDS_Shape shape2 = box2.Shape();
-//#if ! defined(BRepAlgoAPI_def01)
-// TopoDS_Shape fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
-// TopoDS_Shape comm = BRepAlgoAPI_Common( shape1, shape2 );
-//#else
-// TopoDS_Shape fuse = BRepAlgo_Fuse( shape1, shape2 );
-// TopoDS_Shape comm = BRepAlgo_Common( shape1, shape2 );
-//#endif
TopoDS_Shape fuse,comm;
- if (IsBRepAlgoAPI) {
- di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )" <<"\n";
- di << "comm = BRepAlgoAPI_Common( shape1, shape2 )" <<"\n";
- fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
- comm = BRepAlgoAPI_Common( shape1, shape2 );
- } else {
- di << "fuse = BRepAlgo_Fuse( shape1, shape2 )" <<"\n";
- fuse = BRepAlgo_Fuse( shape1, shape2 );
- di << "comm = BRepAlgo_Common( shape1, shape2 )" <<"\n";
- comm = BRepAlgo_Common( shape1, shape2 );
- }
+ di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )\n";
+ di << "comm = BRepAlgoAPI_Common( shape1, shape2 )\n";
+ fuse = BRepAlgoAPI_Fuse(shape1, shape2).Shape();
+ comm = BRepAlgoAPI_Common(shape1, shape2).Shape();
return 0;
}
-#include <ShapeAnalysis_Edge.hxx>
-
-static Standard_Integer OCC333bug (Draw_Interpretor& di, Standard_Integer n, const char ** a)
-{
- if( n < 3) {
- di<<"-1"<<"\n";
- di << "Usage: " << a[0] << " edge1 edge2 [toler domaindist]" << "\n";
- return 1;
- }
- TopoDS_Shape Sh1 = DBRep::Get(a[1]);
- TopoDS_Shape Sh2 = DBRep::Get(a[2]);
- if(Sh1.IsNull() || Sh2.IsNull()) {
- di<<"-2"<<"\n";
- di<<"Invalid arguments"<<"\n";
- return 1;
- }
- TopoDS_Edge e1 = TopoDS::Edge(Sh1);
- TopoDS_Edge e2 = TopoDS::Edge(Sh2);
- if(e1.IsNull() || e2.IsNull()) {
- di<<"-3"<<"\n";
- di<<"Invalid type of arguments"<<"\n";
- return 1;
- }
- Standard_Real aTol = Precision::Confusion();
- Standard_Real aDistDomain = 0.0;
- Standard_Integer k = 3;
- if(k < n)
- aTol = Draw::Atof(a[k++]);
- if(k < n)
- aDistDomain = Draw::Atof(a[k++]);
-
- ShapeAnalysis_Edge sae;
- if(sae.CheckOverlapping(e1,e2,aTol,aDistDomain)) {
- if(aDistDomain ==0.0) {
- di<<"1"<<"\n";
- di<<"Edges is overlaping comletly"<<"\n";
- } else {
- di<<"2"<<"\n";
- di<<"Edges is overlaped"<<"\n";
- di<<"with tolerance = "<<aTol<<"\n";
- di<<"on segment length = "<<aDistDomain<<"\n";
- }
- } else {
- di<<"3"<<"\n";
- di<<"Edges is not overlaped"<<"\n";
- }
- return 0;
-}
-
-
#include <DDocStd_DrawDocument.hxx>
#include <TDataStd_Name.hxx>
#include <Draw.hxx>
if(argc < 3) { di <<"Error OCC363 : Use : OCC363 document filename\n"; return 1; }
// 2. Retrieve DDocStd application
- Handle(TDocStd_Application) App;
- if (!DDocStd::Find(App)) { di << "Error OCC363 : There is no current DDocStd application\n";return 1;}
+ Handle(TDocStd_Application) App = DDocStd::GetApplication();
// 3. Open document
TCollection_ExtendedString name(argv[2]);
if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) )
prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
}
- catch(Standard_Failure) { di << "FAULTY OCC363 : Exception during reading document.\n";return 0;}
+ catch(Standard_Failure const&) { di << "FAULTY OCC363 : Exception during reading document.\n";return 0;}
di << "OCC363 OK\n";
return 0;
di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
// 4.3. Compare results (they must be same)
- if(stat1 ==stat2) di << "OCC377 OK" << "\n";
- else {di << "OCC377 FAULTY" << "\n"; return 0;}
+ if(stat1 ==stat2) di << "OCC377 OK\n";
+ else {di << "OCC377 FAULTY\n"; return 0;}
}
}
- catch(Standard_Failure)
+ catch(Standard_Failure const&)
{
di << "OCC377 Exception";
}
// 4.3. Create result Draw shape
DBRep::Set(argv[1], aResultShape);
}
- catch (Standard_Failure) {di << "OCC22 Exception \n" ;return 0;}
+ catch (Standard_Failure const&) {di << "OCC22 Exception \n" ;return 0;}
return 0;
}
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
+#include <IMeshTools_Parameters.hxx>
//=======================================================================
//function : OCC24
DBRep::Set(argv[1], aResultShape);
}
- catch (Standard_Failure) {di << "OCC24 Exception \n" ;return 0;}
+ catch (Standard_Failure const&) {di << "OCC24 Exception \n" ;return 0;}
return 0;
}
if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
// 3. Build mesh
- BRepMesh_IncrementalMesh aMesh(aShape, 0.2, Standard_True, M_PI/6);
+ IMeshTools_Parameters aMeshParams;
+ aMeshParams.Relative = Standard_True;
+ aMeshParams.Deflection = 0.2;
+ aMeshParams.Angle = M_PI / 6.0;
+ BRepMesh_IncrementalMesh aMesh(aShape, aMeshParams);
}
- catch (Standard_Failure) {di << "OCC369 Exception \n" ;return 0;}
+ catch (Standard_Failure const&) {di << "OCC369 Exception \n" ;return 0;}
di << "OCC369 OK \n";
return 0;
math_Vector Vector(LowerVector, UpperVector, InitialValueVector);
math_Matrix Matrix(LowerRowMatrix, UpperRowMatrix, LowerColMatrix, UpperColMatrix, InitialValueMatrix);
- //Vector.Dump(cout);
- //cout<<endl;
+ //Vector.Dump(std::cout);
+ //std::cout<<std::endl;
- //Matrix.Dump(cout);
- //cout<<endl;
+ //Matrix.Dump(std::cout);
+ //std::cout<<std::endl;
Vector1.Multiply(Vector, Matrix);
- //Vector1.Dump(cout);
+ //Vector1.Dump(std::cout);
Standard_SStream aSStream1;
Vector1.Dump(aSStream1);
di << aSStream1;
di<<"\n";
+ if (Matrix.RowNumber() > 1) {
+ Matrix(Matrix.LowerRow() + 1, Matrix.LowerCol()) += 1.;
+ }
Vector2.TMultiply(Vector, Matrix);
- //Vector2.Dump(cout);
+ //Vector2.Dump(std::cout);
Standard_SStream aSStream2;
Vector2.Dump(aSStream2);
di << aSStream2;
//=======================================================================
static Standard_Integer OCC525(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
{
- try
+ GeomPlate_BuildPlateSurface aBuilder;
+ aBuilder.Perform();
+
+ if (aBuilder.IsDone())
{
- OCC_CATCH_SIGNALS
- GeomPlate_BuildPlateSurface aBuilder;
- aBuilder.Perform();
+ di << "Error in OCC525. Null result is expected.\n";
+ }
+ else
+ {
+ di << "OCC525 OK \n";
}
- catch (Standard_RangeError) { di << "OCC525 Exception \n" ;return 0; }
- //catch (...) { di << "OCC525 Exception \n" ;return 0; }
- di << "OCC525 OK \n";
return 0;
}
#include <gce_MakeTranslation.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepPrimAPI_MakeWedge.hxx>
-#include <BRepAlgoAPI_Fuse.hxx>
-#include <BRepAlgoAPI_Cut.hxx>
-#include <BRepAlgo_Fuse.hxx>
-#include <BRepAlgo_Cut.hxx>
//=======================================================================
//function : OCC578
//purpose :
//=======================================================================
static Standard_Integer OCC578 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
- //if (argc!=4) {
- // di<<"Usage : " << argv[0] << " shape1 shape2 shape3\n";
- // return 1;
- //}
- if(argc < 4 || argc > 5) {
- di << "Usage : " << argv[0] << " shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+ if(argc != 4) {
+ di << "Usage : " << argv[0] << " shape1 shape2 shape3\n";
return 1;
}
- Standard_Boolean IsBRepAlgoAPI = Standard_True;
- if (argc == 5) {
- Standard_Integer IsB = Draw::Atoi(argv[4]);
- if (IsB != 1) {
- IsBRepAlgoAPI = Standard_False;
-// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-// return 1;
-// di << "Error: There is not BRepAlgo_Cut class" << "\n";
-// return 1;
- }
- }
gp_Pnt P0(0,0,0.0);
double xperiod = 1.0;
// combine wedges
-//#if ! defined(BRepAlgoAPI_def01)
-// TopoDS_Shape wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
-//#else
-// TopoDS_Shape wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
-//#endif
- TopoDS_Shape wedge_common;
- if (IsBRepAlgoAPI) {
- di << "wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a)" <<"\n";
- wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
- } else {
- di << "wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a)" <<"\n";
- wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
- }
-
- // remove wedge area from substrate
-//#if ! defined(BRepAlgoAPI_def01)
-// TopoDS_Shape sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
-//#else
-// TopoDS_Shape sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
-//#endif
- TopoDS_Shape sub_etch1;
- if (IsBRepAlgoAPI) {
- di << "sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common)" <<"\n";
- sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
- } else {
- di << "sub_etch1 = BRepAlgo_Cut(substrate, wedge_common)" <<"\n";
- sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
- }
+ di << "wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a)\n";
+ TopoDS_Shape wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a).Shape();
+ di << "sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common)\n";
+ TopoDS_Shape sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common).Shape();
+
if (sub_etch1.IsNull()) {
di<<" Null shape3 is not allowed\n";
return 1;
return -1;
}
Standard_GUID guid(argv[1]);
- //guid.ShallowDump(cout);
+ //guid.ShallowDump(std::cout);
Standard_SStream aSStream;
guid.ShallowDump(aSStream);
di << aSStream;
return -1;
}
const Standard_GUID& guid = XCAFDoc::ShapeRefGUID ();
- //guid.ShallowDump(cout);
+ //guid.ShallowDump(std::cout);
Standard_SStream aSStream;
guid.ShallowDump(aSStream);
di << aSStream;
return -1;
}
const Standard_GUID& guid = XCAFDoc::AssemblyGUID ();
- //guid.ShallowDump(cout);
+ //guid.ShallowDump(std::cout);
Standard_SStream aSStream;
guid.ShallowDump(aSStream);
di << aSStream;
return -1;
}
const Standard_GUID& guid = DDataStd_DrawPresentation::GetID() ;
- //guid.ShallowDump(cout);
+ //guid.ShallowDump(std::cout);
Standard_SStream aSStream;
guid.ShallowDump(aSStream);
di << aSStream;
{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if(aContext.IsNull()) {
- di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+ di << argv[0] << "ERROR : use 'vinit' command before \n";
return 1;
}
if ( argc != 2) {
- di << "ERROR : Usage : " << argv[0] << " shape ; Deactivate the current transformation" << "\n";
+ di << "ERROR : Usage : " << argv[0] << " shape ; Deactivate the current transformation\n";
return 1;
}
- Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
+ Standard_Boolean updateviewer = Standard_True;
ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
TCollection_AsciiString aName(argv[1]);
Handle(AIS_InteractiveObject) AISObj;
- if(!aMap.IsBound2(aName)) {
- di << "Use 'vdisplay' before" << "\n";
+ if (!aMap.Find2 (aName, AISObj)
+ || AISObj.IsNull())
+ {
+ di << "Use 'vdisplay' before\n";
return 1;
- } else {
- AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
- if(AISObj.IsNull()){
- di << argv[1] << " : No interactive object" << "\n";
- return 1;
- }
- AISObj->UnsetTransformation();
- if (!aContext->HasOpenedContext()) {
- aContext->OpenLocalContext();
- }
- aContext->Erase(AISObj, updateviewer, PutInCollector);
- aContext->UpdateCurrentViewer();
- aContext->Display(AISObj, updateviewer);
- aContext->UpdateCurrentViewer();
}
+
+ AISObj->ResetTransformation();
+
+ aContext->Erase(AISObj, updateviewer);
+ aContext->UpdateCurrentViewer();
+ aContext->Display(AISObj, updateviewer);
+ aContext->UpdateCurrentViewer();
return 0;
}
di<<"Usage : " << argv[0] << "\n";
return -1;
}
- TColStd_Array2OfInteger Array2OfInteger(1,1,1,1);
- Array2OfInteger.SetValue(5,5,55);
+
+ // check that exception initialized without message string can be safely handled and printed
+ try {
+ throw Standard_OutOfRange();
+ }
+ catch (Standard_Failure const& anException) {
+ std::cout << "Caught successfully: ";
+ std::cout << anException << std::endl;
+ }
return 0;
}
TopoDS_Wire awire = TopoDS::Wire(DBRep::Get(argv[1])); //read the wire
TopoDS_Face aface = TopoDS::Face(DBRep::Get(argv[2])); //read the face
if (awire.IsNull() || aface.IsNull()) {
- di << "Null object" << "\n";
+ di << "Null object\n";
return 1;
}
{
if (argc != 2)
{
- di <<"Usage : " << argv[0] << " face"<<"\n";
+ di <<"Usage : " << argv[0] << " face\n";
return 1;
}
Standard_Real u1, u2, v1, v2;
{
if (argc != 2)
{
- di <<"Usage : " << argv[0] << " expression"<<"\n";
+ di <<"Usage : " << argv[0] << " expression\n";
return 1;
}
return 0;
}
}
- di << arg[0] << " : Error" << "\n";
- return 1;
-}
-
-//=======================================================================
-//function : OCC1030_AISColor
-//purpose : OCC1030_AISColor (DOC,entry,[color])
-//=======================================================================
-
-static Standard_Integer OCC1030_AISColor (Draw_Interpretor& di,
- Standard_Integer nb,
- const char ** arg)
-{
- if (nb >= 3) {
- Handle(TDocStd_Document) D;
- if (!DDocStd::GetDocument(arg[1],D)) return 1;
- TDF_Label L;
- if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
-
- Handle(TPrsStd_AISViewer) viewer;
- if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
-
- Handle(TPrsStd_AISPresentation) prs;
- if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
- if( nb == 4 ) {
- prs->SetColor((Quantity_NameOfColor)Draw::Atoi(arg[3]));
- TPrsStd_AISViewer::Update(L);
- }
- else
- di << "Color = " << prs->Color() << "\n";
- return 0;
- }
- }
- di << arg[0] << " : Error" << "\n";
+ di << arg[0] << " : Error\n";
return 1;
}
return 0;
}
}
- di << arg[0] << " : Error" << "\n";
+ di << arg[0] << " : Error\n";
return 1;
}
return 0;
}
}
- di << arg[0] << " : Error" << "\n";
+ di << arg[0] << " : Error\n";
return 1;
}
return 0;
}
}
- di << arg[0] << " : Error" << "\n";
+ di << arg[0] << " : Error\n";
return 1;
}
return 0;
}
}
- di << arg[0] << " : Error" << "\n";
+ di << arg[0] << " : Error\n";
return 1;
}
-#include<BRepAlgoAPI_Cut.hxx>
-#include<BRepAlgo_Cut.hxx>
//=======================================================================
//function : OCC1487
//purpose :
//=======================================================================
static Standard_Integer OCC1487 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
- //if(argc != 5) {
- // cerr << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape" << endl;
- // return -1;
- //}
- if(argc < 5 || argc > 6) {
- di << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+ if(argc != 5) {
+ di << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape\n";
return 1;
}
- Standard_Boolean IsBRepAlgoAPI = Standard_True;
- if (argc == 6) {
- Standard_Integer IsB = Draw::Atoi(argv[5]);
- if (IsB != 1) {
- IsBRepAlgoAPI = Standard_False;
-// di << "Error: There is not BRepAlgo_Cut class" << "\n";
-// return 1;
- }
- }
Standard_Integer CaseNumber = Draw::Atoi(argv[1]);
BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
cyl2 = o_mc2.Shape();
-//#if ! defined(BRepAlgoAPI_def01)
-// o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
-//#else
-// o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
-//#endif
- if (IsBRepAlgoAPI) {
- di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
- o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
- } else {
- di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
- o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
- }
+ di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())\n";
+ o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ()).Shape();
} else {
//BRepPrimAPI_MakeCylinder o_mc2 (gp_Ax2 (gp_Pnt(978.34936, -50.0, 127.5),gp_Dir(sin(M_PI/3), 0.0, 0.5)), 5, 150);
gp_Dir myDir_mc2(sin(M_PI/3), 0.0, 0.5);
BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
cyl2 = o_mc2.Shape();
-//#if ! defined(BRepAlgoAPI_def01)
-// o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
-//#else
-// o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
-//#endif
- if (IsBRepAlgoAPI) {
- di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
- o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
- } else {
- di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
- o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
- }
+ di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())\n";
+ o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ()).Shape();
}
DBRep::Set(argv[2],cyl1);
TopoDS_Shape ShapeCut = aBoolenaOperation.Shape();
-//#ifdef OCC40
-// Handle_TopOpeBRepBuild_HBuilder build = aBoolenaOperation.Builder();
-//#endif
TopTools_ListIteratorOfListOfShape its;
TopoDS_Compound result;
BRepFilletAPI_MakeFillet fill(cutsol);
fill.SetParams(ta, t3d, t2d, t3d, t2d, fl);
fill.SetContinuity(blend_cont, tapp_angle);
-//#ifdef OCC40
-// its = build->Section();
-//#else //OCC40DEV
its = aBoolenaOperation.SectionEdges();
-//#endif
while (its.More())
{
TopoDS_Edge E = TopoDS::Edge(its.Value());
TopoDS_Shape theCylinder3 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, - 10, 0),
gp_Dir(0, 1, 0)), 3, 20).Shape();
TopoDS_Shape theTmp1 = OCC1077_cut_blend(theCommon,theCylinder1,0.7);
- Handle_ShapeFix_Shape fixer = new ShapeFix_Shape(theTmp1);
+ Handle(ShapeFix_Shape) fixer = new ShapeFix_Shape(theTmp1);
fixer->Perform();
theTmp1 = fixer->Shape();
TopoDS_Shape theTmp2 = OCC1077_cut_blend(theTmp1,theCylinder2,0.7);
static Standard_Integer OCC1077 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if(argc < 1 || argc > 2) {
- di << "Usage : " << argv[0] << " result" << "\n";
+ di << "Usage : " << argv[0] << " result\n";
return 1;
}
{
if (argc < 4)
{
- di << "Usage : " << argv[0] << " name shape step" << "\n";
+ di << "Usage : " << argv[0] << " name shape step\n";
return 1;
}
const char *name = argv[1];
TopoDS_Shape wire = DBRep::Get(argv[2]);
if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
{
- di << argv[0] <<" Faulty : incorrect 1st parameter, curve or wire expected"<<"\n";
+ di << argv[0] <<" Faulty : incorrect 1st parameter, curve or wire expected\n";
return 1;
}
adapCurve = new BRepAdaptor_CompCurve(TopoDS::Wire(wire));
int res;
if (!aUni.IsDone())
{
- di << argv[0] <<" : fail"<<"\n";
+ di << argv[0] <<" : fail\n";
res = 1;
}
else
{
if (argc != 3)
{
- di << "Usage : " << argv[0] << " nb_of_vectors size" << "\n";
+ di << "Usage : " << argv[0] << " nb_of_vectors size\n";
return 1;
}
Standard_Real val = 10;
math_Vector **pv = new math_Vector *[nb];
- di<<"creating "<<nb<<" vectors "<<sz<<" elements each..."<<"\n";
+ di<<"creating "<<nb<<" vectors "<<sz<<" elements each...\n";
Standard_Integer i;
for (i=0; i < nb; i++) {
pv[i] = new math_Vector (1, sz, val);
if ((i % (nb/10)) == 0) {
di<<" "<<i;
- //cout.flush();
+ //std::cout.flush();
di<<"\n";
}
}
- di<<" done"<<"\n";
- di<<"deleting them ..."<<"\n";
+ di<<" done\n";
+ di<<"deleting them ...\n";
for (i=0; i < nb; i++) {
delete pv[i];
if ((i % (nb/10)) == 0) {
di<<" "<<i;
- //cout.flush();
+ //std::cout.flush();
di<<"\n";
}
}
- di<<" done"<<"\n";
+ di<<" done\n";
delete [] pv;
{
if (argc != 2)
{
- di << "Usage : " << argv[0] << " wire" << "\n";
+ di << "Usage : " << argv[0] << " wire\n";
return 1;
}
TopoDS_Shape shape = DBRep::Get(argv[1],TopAbs_WIRE);
// check that points are coinsiding
Standard_Real error_dist = pnt.Distance(check_pnt);
if (error_dist > Precision::Confusion()) {
- //cout.precision(3);
+ //std::cout.precision(3);
di<<"error_dist = "<<error_dist<<
- " ( "<<error_dist/need_length*100<<" %)"<<"\n";
+ " ( "<<error_dist/need_length*100<<" %)\n";
return 0;
}
- di<<"OK"<<"\n";
+ di<<"OK\n";
return 0;
}
-static char sarr[2000];
-static int si=1;
-static int StackOverflow(int i = -1)
+// stack overflow can be successfully handled only on 32-bit Windows
+#if defined(_WIN32) && !defined(_WIN64)
+static int StackOverflow (int i = -1)
{
char arr[2000];
- if (si == 1) {
- si = 0;
- memcpy(arr,sarr,2000);
- arr[1999]=0;
- int n = strlen(arr), s=0;
- while (n--)
- s += StackOverflow(i-1);
- return i + s + StackOverflow(i-1);
- }
- else if (i != 0) {
- return i + StackOverflow(i-1);
- }
- si = 1;
+ memset (arr, 0, sizeof(arr));
+ if (i < 0)
+ StackOverflow(i-1);
return i;
}
+#endif
-#ifdef WNT
// this code does not work with optimize mode on Windows
+#if defined(_MSC_VER) && !defined(__clang__)
#pragma optimize( "", off )
#endif
static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if (argc != 1)
{
- di << "Usage : " << argv[0] << "\n";
+ std::cout << "Usage : " << argv[0] << "\n";
return 1;
}
Standard_Boolean Succes;
{//==== Test Divide ByZero (Integer) ========================================
try{
OCC_CATCH_SIGNALS
+ std::cout << "(Integer) Divide By Zero..." << std::endl;
di << "(Integer) Divide By Zero...";
- //cout.flush();
+ //std::cout.flush();
di << "\n";
Standard_Integer res, a =4, b = 0 ;
res = a / b;
- di << " 4 / 0 = " << res << " Does not Caught... KO"<< "\n";
+ di << "Error: 4 / 0 = " << res << " - no exception is raised!\n";
Succes = Standard_False;
}
-#if defined(SOLARIS) || defined(WNT)
- catch(Standard_DivideByZero)
+#if defined(SOLARIS) || defined(_WIN32)
+ catch(Standard_DivideByZero const&)
#else
- catch(Standard_NumericError)
+ catch(Standard_NumericError const&)
#endif
{
- di << " Ok"<< "\n";
+ di << "Caught, OK\n";
}
- catch(Standard_Failure) {
- //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+ catch(Standard_Failure const& anException) {
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
- di << ")... KO" << "\n";
+ di << anException.GetMessageString();
+ di << ")... KO\n";
Succes = Standard_False;
}
-#ifndef NO_CXX_EXCEPTION
// this case tests if (...) supersedes (Standard_*),
// the normal behaviour is not
catch(...) {
- di<<" unknown exception... (But) Ok"<<"\n";
+ di<<" unknown exception... (But) Ok\n";
}
-#endif
}
{//==== Test Divide ByZero (Real) ===========================================
try{
OCC_CATCH_SIGNALS
+ std::cout << "(Real) Divide By Zero..." << std::endl;
di << "(Real) Divide By Zero...";
- //cout.flush();
+ //std::cout.flush();
di << "\n";
Standard_Real res, a= 4.0, b=0.0;
res = a / b;
- di << " 4.0 / 0.0 = " << res << " Does not Caught... KO"<< "\n";
+ di << "Error: 4.0 / 0.0 = " << res << " - no exception is raised!\n";
Succes = Standard_False;
}
-#if defined(SOLARIS) || defined(WNT)
- catch(Standard_DivideByZero)
-#else
- catch(Standard_NumericError)
-#endif
+ catch(Standard_DivideByZero const&) // Solaris, Windows w/o SSE2
+ {
+ di << "Caught, OK\n";
+ }
+ catch(Standard_NumericError const&) // Linux, Windows with SSE2
{
- di << " Ok"<< "\n";
+ di << "Caught, OK\n";
}
- catch(Standard_Failure) {
- //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+ catch(Standard_Failure const& anException) {
+ //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
- di << ")... KO" << "\n";
+ di << anException.GetMessageString();
+ di << ")... KO\n";
Succes = Standard_False;
}
}
{//==== Test Overflow (Integer) =============================================
try{
OCC_CATCH_SIGNALS
+ std::cout << "(Integer) Overflow..." << std::endl;
di << "(Integer) Overflow...";
- //cout.flush();
+ //std::cout.flush();
di << "\n";
Standard_Integer res, i=IntegerLast();
res = i + 1;
- //++++ cout << " -- "<<res<<"="<<i<<"+1 Does not Caught... KO"<< endl;
+ //++++ std::cout << " -- "<<res<<"="<<i<<"+1 Does not Caught... KO"<< std::endl;
//++++ Succes = Standard_False;
- di << " "<<res<<"="<<i<<"+1 Does not Caught... (But) Ok"<< "\n";
+ di << "Not caught: " << i << " + 1 = " << res << ", still OK\n";
}
- catch(Standard_Overflow) {
- di << " Ok"<< "\n";
+ catch(Standard_Overflow const&) {
+ di << "Caught, OK\n";
}
- catch(Standard_Failure) {
- //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+ catch(Standard_Failure const& anException) {
+ //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
- di << ")... KO" << "\n";
+ di << anException.GetMessageString();
+ di << ")... KO\n";
Succes = Standard_False;
}
}
{//==== Test Overflow (Real) ================================================
try{
OCC_CATCH_SIGNALS
+ std::cout << "(Real) Overflow..." << std::endl;
di << "(Real) Overflow...";
- //cout.flush();
+ //std::cout.flush();
di << "\n";
Standard_Real res, r=RealLast();
res = r * r;
- sin(1.); //this function tests FPU flags and raises signal (tested on LINUX).
+ (void)sin(1.); //this function tests FPU flags and raises signal (tested on LINUX).
- di << "-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<< "\n";
+ di << "Error: " << r << "*" << r << " = " << res << " - no exception is raised!\n";
Succes = Standard_False;
}
-#if defined(SOLARIS) || defined(WNT)
- catch(Standard_Overflow)
-#else
- catch(Standard_NumericError)
-#endif
+ catch(Standard_Overflow const&) // Solaris, Windows w/o SSE2
{
- di << " Ok"<< "\n";
+ di << "Caught, OK\n";
}
- catch(Standard_Failure) {
- //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+ catch(Standard_NumericError const&) // Linux, Windows with SSE2
+ {
+ di << "Caught, OK\n";
+ }
+ catch(Standard_Failure const& anException) {
+ //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
- di << ")... KO" << "\n";
+ di << anException.GetMessageString();
+ di << ")... KO\n";
Succes = Standard_False;
}
}
{//==== Test Underflow (Real) ===============================================
try{
OCC_CATCH_SIGNALS
+ std::cout << "(Real) Underflow" << std::endl; // to have message in log even if process crashed
di << "(Real) Underflow";
- //cout.flush();
+ //std::cout.flush();
di << "\n";
- Standard_Real res, r=1.0e-308;
+ Standard_Real res, r = RealSmall();
res = r * r;
//res = res + 1.;
- //++++ cout<<"-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<<endl;
+ //++++ std::cout<<"-- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... KO"<<std::endl;
//++++ Succes = Standard_False;
- di<<" -- "<<res<<"="<<r<<"*"<<r<<" Does not Caught... (But) Ok"<<"\n";
+ di << "Not caught: " << r << "*" << r << " = " << res << ", still OK\n";
}
-#if defined(SOLARIS) || defined(WNT)
- catch(Standard_Underflow)
-#else
- catch(Standard_NumericError)
-#endif
+ catch(Standard_Underflow const&) // could be on Solaris, Windows w/o SSE2
{
- di << " Ok"<< "\n";
+ di << "Exception caught, KO\n";
+ Succes = Standard_False;
+ }
+ catch(Standard_NumericError const&) // could be on Linux, Windows with SSE2
+ {
+ di << "Exception caught, KO\n";
+ Succes = Standard_False;
}
- catch(Standard_Failure) {
- //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+ catch(Standard_Failure const& anException) {
+ //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
- di << ")... KO" << "\n";
+ di << anException.GetMessageString();
+ di << ")... KO\n";
Succes = Standard_False;
}
}
{//==== Test Invalid Operation (Real) ===============================================
try{
OCC_CATCH_SIGNALS
+ std::cout << "(Real) Invalid Operation..." << std::endl;
di << "(Real) Invalid Operation...";
- //cout.flush();
+ //std::cout.flush();
di << "\n";
Standard_Real res, r=-1;
res = sqrt(r);
- di<<" "<<res<<"=sqrt("<<r<<") Does not Caught... KO"<<"\n";
+ di << "Error: swrt(-1) = " << res << " - no exception is raised!\n";
Succes = Standard_False;
}
- catch(Standard_NumericError) {
- di << " Ok"<< "\n";
+ catch(Standard_NumericError const&) {
+ di << "Caught, OK\n";
}
- catch(Standard_Failure) {
- //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+ catch(Standard_Failure const& anException) {
+ //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
- di << ")... KO" << "\n";
+ di << anException.GetMessageString();
+ di << ")... KO\n";
Succes = Standard_False;
}
}
{//==== Test Access Violation ===============================================
try {
OCC_CATCH_SIGNALS
+ std::cout << "Segmentation Fault..." << std::endl;
di << "Segmentation Fault...";
- //cout.flush();
+ //std::cout.flush();
di << "\n";
int* pint=NULL;
*pint = 4;
- di << " Does not Caught... KO"<<"\n";
+ di << "Error: writing by NULL address - no exception is raised!\n";
Succes = Standard_False;
}
-#ifdef WNT
- catch(OSD_Exception_ACCESS_VIOLATION)
+#ifdef _WIN32
+ catch(OSD_Exception_ACCESS_VIOLATION const&)
#else
- catch(OSD_SIGSEGV)
+ catch(OSD_SIGSEGV const&)
#endif
{
- di << " Ok"<< "\n";
- } catch(Standard_Failure) {
- //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+ di << "Caught, OK\n";
+ } catch(Standard_Failure const& anException) {
+ //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
- di << ")... KO" << "\n";
+ di << anException.GetMessageString();
+ di << ")... KO\n";
Succes = Standard_False;
}
}
-#ifdef WNT
+#if defined(_WIN32) && !defined(_WIN64)
{//==== Test Stack Overflow ===============================================
try {
OCC_CATCH_SIGNALS
+ std::cout << "Stack Overflow..." << std::endl;
di << "Stack Overflow...";
- //cout.flush();
+ //std::cout.flush();
di << "\n";
StackOverflow();
- di << " Does not Caught... KO"<<"\n";
+ di << "Error - no exception is raised!\n";
Succes = Standard_False;
}
- catch(OSD_Exception_STACK_OVERFLOW) {
- di << " Ok"<< "\n";
+ catch(OSD_Exception_STACK_OVERFLOW const&) {
+ di << "Caught, OK\n";
}
- catch(Standard_Failure) {
- //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+ catch(Standard_Failure const& anException) {
+ //std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
- di << ")... KO" << "\n";
+ di << anException.GetMessageString();
+ di << ")... KO\n";
Succes = Standard_False;
}
}
#endif
if(Succes) {
- di << "TestExcept: Successfull completion" << "\n";
+ di << "TestExcept: Successfull completion\n";
} else {
- di << "TestExcept: failure" << "\n";
+ di << "TestExcept: failure\n";
}
return 0;
}
-#ifdef WNT
+
+//! Auxiliary functor.
+struct TestParallelFunctor
+{
+ TestParallelFunctor() : myNbNotRaised (0), myNbSigSegv (0), myNbUnknown (0) {}
+
+ Standard_Integer NbNotRaised() const { return myNbNotRaised; }
+ Standard_Integer NbSigSegv() const { return myNbSigSegv; }
+ Standard_Integer NbUnknown() const { return myNbUnknown; }
+
+ void operator() (int theThreadId, int theTaskId) const
+ {
+ (void )theThreadId;
+ (void )theTaskId;
+
+ // Test Access Violation
+ {
+ try {
+ OCC_CATCH_SIGNALS
+ int* pint = NULL;
+ *pint = 4;
+ Standard_Atomic_Increment (&myNbNotRaised);
+ }
+ #ifdef _WIN32
+ catch (OSD_Exception_ACCESS_VIOLATION const&)
+ #else
+ catch (OSD_SIGSEGV const&)
+ #endif
+ {
+ Standard_Atomic_Increment (&myNbSigSegv);
+ }
+ catch (Standard_Failure const& )
+ {
+ Standard_Atomic_Increment (&myNbUnknown);
+ }
+ }
+ }
+private:
+ mutable volatile Standard_Integer myNbNotRaised;
+ mutable volatile Standard_Integer myNbSigSegv;
+ mutable volatile Standard_Integer myNbUnknown;
+};
+
+static Standard_Integer OCC30775 (Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** )
+{
+ if (theNbArgs != 1)
+ {
+ std::cout << "Syntax error: wrong number of arguments\n";
+ return 1;
+ }
+
+ Handle(OSD_ThreadPool) aPool = new OSD_ThreadPool (4);
+ OSD_ThreadPool::Launcher aLauncher (*aPool, 4);
+ TestParallelFunctor aFunctor;
+ aLauncher.Perform (0, 100, aFunctor);
+ theDI << "NbRaised: " << (aFunctor.NbSigSegv() + aFunctor.NbUnknown()) << "\n"
+ << "NbNotRaised: " << aFunctor.NbNotRaised() << "\n"
+ << "NbSigSeg: " << aFunctor.NbSigSegv() << "\n"
+ << "NbUnknown: " << aFunctor.NbUnknown() << "\n";
+ return 0;
+}
+
+#if defined(_MSC_VER) && !defined(__clang__)
#pragma optimize( "", on )
#endif
static Standard_Integer OCC7141 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
- int nCount = 10;
-
- if (argc > 2)
- {
- di << "Usage : " << argv[0] << " [nCount]" << "\n";
- return 1;
- }
+ if (argc != 2 && argc != 3)
+ {
+ std::cout << "Usage : " << argv[0] << " [nCount] path\n";
+ return 1;
+ }
- if (argc > 1)
- nCount = Draw::Atoi(argv[1]);
+ int nCount = (argc > 2 ? Draw::Atoi(argv[1]) : 10);
+ TCollection_AsciiString aFilePath (argv[argc > 2 ? 2 : 1]);
STEPCAFControl_Writer writer;
- Handle_TDocStd_Document document;
+ Handle(TDocStd_Document) document;
document = new TDocStd_Document("Pace Test-StepExporter-");
- Handle_XCAFDoc_ShapeTool shapeTool;
+ Handle(XCAFDoc_ShapeTool) shapeTool;
shapeTool = XCAFDoc_DocumentTool::ShapeTool(document->Main());
shapeTool->AddShape(AddTestStructure(nCount), Standard_True);
STEPControl_StepModelType mode = STEPControl_AsIs;
if (!Interface_Static::SetIVal("write.step.assembly",1)) { //assembly mode
- di << "Failed to set assembly mode for step data\n" << "\n";
+ di << "Failed to set assembly mode for step data\n\n";
return 0;
}
try {
OCC_CATCH_SIGNALS
if( writer.Transfer(document, mode)) {
- IFSelect_ReturnStatus stat =
- writer.Write("TestExportStructure.step");
+ writer.Write(aFilePath.ToCString());
}
}
- catch(OSD_Exception_STACK_OVERFLOW) {
- di << "Failed : STACK OVERFLOW\n" << "\n";
+ catch(OSD_Exception_STACK_OVERFLOW const&) {
+ di << "Failed : STACK OVERFLOW\n\n";
}
- catch (Standard_Failure) {
- di << "Failed :\n" << "\n";
- //cout << Standard_Failure::Caught() << endl;
- di << Standard_Failure::Caught()->GetMessageString();
+ catch (Standard_Failure const& anException) {
+ di << "Failed :\n\n";
+ //std::cout << Standard_Failure::Caught() << std::endl;
+ di << anException.GetMessageString();
}
- di << argv[0] << " : Finish" << "\n";
+ di << argv[0] << " : Finish\n";
return 0;
}
{
if (argc != 4)
{
- di << "Usage : " << argv[0] << " edge1 edge2 plane" << "\n";
+ di << "Usage : " << argv[0] << " edge1 edge2 plane\n";
return 1;
}
TopoDS_Edge theEdge1 = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
Standard_Integer i;
for (i=1; i<=NbPoints; i++) {
gp_Pnt2d aPi = anInter.Point(i);
- di << "Point.X(" << i << ") = " << aPi.X() << " " << "Point.Y(" << i << ") = " << aPi.Y() << "\n" ;
+ di << "Point.X(" << i << ") = " << aPi.X() << " Point.Y(" << i << ") = " << aPi.Y() << "\n" ;
}
}
Standard_Real aDist = aP1.Distance(aP2);
- di << "aP1.X() = " << aP1.X() << " " << "aP1.Y() = " << aP1.Y() << "\n" ;
- di << "aP2.X() = " << aP2.X() << " " << "aP2.Y() = " << aP2.Y() << "\n" ;
+ di << "aP1.X() = " << aP1.X() << " aP1.Y() = " << aP1.Y() << "\n" ;
+ di << "aP2.X() = " << aP2.X() << " aP2.Y() = " << aP2.Y() << "\n" ;
di << "Distance = " << aDist << "\n" ;
di << "Confusion = " << aConfusion << "\n" ;
if (aDist > aConfusion) {
- di << "\n" << argv[0] << " Faulty" << "\n" ;
+ di << "\n" << argv[0] << " Faulty\n" ;
} else {
- di << "\n" << argv[0] << " OK" << "\n" ;
+ di << "\n" << argv[0] << " OK\n" ;
}
} else {
- di << "\n" << argv[0] << " OK" << "\n" ;
+ di << "\n" << argv[0] << " OK\n" ;
}
return 0;
{
if (argc != 3)
{
- di << "Usage : " << argv[0] << " lower upper" << "\n";
+ di << "Usage : " << argv[0] << " lower upper\n";
return 1;
}
Handle(TDataStd_RealArray) array;
if (label1.FindAttribute(TDataStd_RealArray::GetID(), array) &&
array->Lower() == LOWER && array->Upper() == UPPER)
- cout<<"1: OK"<<endl;
+ std::cout<<"1: OK"<<std::endl;
else
{
- cout<<"1: Failed.."<<endl;
+ std::cout<<"1: Failed.."<<std::endl;
return 1;
}
doc->CommitCommand();
{
if (array->Value(i) != i)
{
- cout<<"2: Failed.."<<endl;
+ std::cout<<"2: Failed.."<<std::endl;
return 2;
}
}
- cout<<"2: OK"<<endl;
+ std::cout<<"2: OK"<<std::endl;
doc->CommitCommand();
//! 3. Re-init the array
array->Init(LOWER + 2, UPPER + 4);
if (array->Lower() != LOWER + 2 && array->Upper() != UPPER + 4)
{
- cout<<"3: Failed.."<<endl;
+ std::cout<<"3: Failed.."<<std::endl;
return 3;
}
for (i = LOWER + 2; i <= UPPER + 4; i++)
{
if (array->Value(i) != i)
{
- cout<<"3: Failed.."<<endl;
+ std::cout<<"3: Failed.."<<std::endl;
return 3;
}
}
- cout<<"3: OK"<<endl;
+ std::cout<<"3: OK"<<std::endl;
doc->CommitCommand();
//! 4. Change array
{
if (array->Value(i) != i)
{
- cout<<"4: Failed.."<<endl;
+ std::cout<<"4: Failed.."<<std::endl;
return 4;
}
}
- cout<<"4: OK"<<endl;
+ std::cout<<"4: OK"<<std::endl;
doc->CommitCommand();
//! 5. Copy the array
copier.Perform();
if (!copier.IsDone())
{
- cout<<"5: Failed.."<<endl;
+ std::cout<<"5: Failed.."<<std::endl;
return 5;
}
Handle(TDataStd_RealArray) array2;
if (!label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
{
- cout<<"5: Failed.."<<endl;
+ std::cout<<"5: Failed.."<<std::endl;
return 5;
}
for (i = LOWER + 5; i <= UPPER + 5; i++)
{
if (array->Value(i) != i)
{
- cout<<"5: Failed.."<<endl;
+ std::cout<<"5: Failed.."<<std::endl;
return 5;
}
}
- cout<<"5: OK"<<endl;
+ std::cout<<"5: OK"<<std::endl;
doc->CommitCommand();
//! 6. Undo/Redo
if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
{
- cout<<"6.a: Failed.."<<endl;
+ std::cout<<"6.a: Failed.."<<std::endl;
return 6;
}
//! 6.b: undoes the 4th action: the array should be changed to (lower+2,upper+4)
array->Lower() != LOWER + 2 ||
array->Upper() != UPPER + 4)
{
- cout<<"6.b: Failed.."<<endl;
+ std::cout<<"6.b: Failed.."<<std::endl;
return 6;
}
for (i = LOWER + 2; i <= UPPER + 4; i++)
{
if (array->Value(i) != i)
{
- cout<<"6.b: Failed.."<<endl;
+ std::cout<<"6.b: Failed.."<<std::endl;
return 6;
}
}
array->Lower() != LOWER ||
array->Upper() != UPPER)
{
- cout<<"6.c: Failed.."<<endl;
+ std::cout<<"6.c: Failed.."<<std::endl;
return 6;
}
for (i = LOWER; i <= UPPER; i++)
{
if (array->Value(i) != i)
{
- cout<<"6.c: Failed.."<<endl;
+ std::cout<<"6.c: Failed.."<<std::endl;
return 6;
}
}
array->Lower() != LOWER ||
array->Upper() != UPPER)
{
- cout<<"6.d: Failed.."<<endl;
+ std::cout<<"6.d: Failed.."<<std::endl;
return 6;
}
for (i = LOWER; i <= UPPER; i++)
{
if (array->Value(i) != i)
{
- cout<<"6.d: Failed.."<<endl;
+ std::cout<<"6.d: Failed.."<<std::endl;
return 6;
}
}
- cout<<"6: OK"<<endl;
+ std::cout<<"6: OK"<<std::endl;
//! 7. Re-set the array
doc->OpenCommand();
array = TDataStd_RealArray::Set(label1, LOWER + 1, UPPER + 1);
if (array->Lower() != LOWER + 1 && array->Upper() != UPPER + 1)
{
- cout<<"7: Failed.."<<endl;
+ std::cout<<"7: Failed.."<<std::endl;
return 7;
}
for (i = LOWER + 1; i <= UPPER + 1; i++)
{
if (array->Value(i) != i)
{
- cout<<"7: Failed.."<<endl;
+ std::cout<<"7: Failed.."<<std::endl;
return 7;
}
}
- cout<<"7: OK"<<endl;
+ std::cout<<"7: OK"<<std::endl;
doc->CommitCommand();
//! 8.Test of speed: set LOWER and UPPER equal to great integer number and
if (argc < 3 || IsEvenArgc)
{
- di << "Usage : " << argv[0] << " index1 value1 ... [indexN valueN]" << "\n";
+ di << "Usage : " << argv[0] << " index1 value1 ... [indexN valueN]\n";
return 1;
}
GeomAdaptor_Curve adaptor_spline(spline);
GCPnts_AbscissaPoint temp;
l_abcissa=temp.Length(adaptor_spline);
- cout<<"Length Spline(abcissa_Pnt): "<<l_abcissa<<endl;
+ std::cout<<"Length Spline(abcissa_Pnt): "<<l_abcissa<<std::endl;
//length!! 2.
TopoDS_Edge edge = BRepBuilderAPI_MakeEdge (spline);
GProp_GProps prop;
BRepGProp::LinearProperties(edge,prop);
l_gprop=prop.Mass();
- cout<<"Length Spline(GProp_GProps): "<<l_gprop<<endl;
+ std::cout<<"Length Spline(GProp_GProps): "<<l_gprop<<std::endl;
- cout<<"Difference (abcissa_Pnt<->GProp_GProps): "<<l_gprop-l_abcissa<<endl;
+ std::cout<<"Difference (abcissa_Pnt<->GProp_GProps): "<<l_gprop-l_abcissa<<std::endl;
return 0;
}
}
}
- // ObjectsInCollector
- AIS_ListOfInteractive ListOfIO_2;
- AISContext->ObjectsInCollector(ListOfIO_2);
- di<< "ObjectsInCollector = " << ListOfIO_2.Extent() <<"\n";
- if (!ListOfIO_2.IsEmpty() ) {
- AIS_ListIteratorOfListOfInteractive iter;
- for (iter.Initialize(ListOfIO_2); iter.More() ; iter.Next() ) {
- Handle(AIS_InteractiveObject) aIO=iter.Value();
- di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
- }
- }
-
return 0;
}
}
di<<"deflection="<< aDeflection << "\n";
- BRepMesh_IncrementalMesh aIMesh(aShape, aDeflection, Standard_False, M_PI/9.);
+ BRepMesh_IncrementalMesh aIMesh(aShape, aDeflection, Standard_False, M_PI / 9.);
TopLoc_Location aLocation;
Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation(TopoDS::Face(aShape), aLocation);
gp_Pnt2d anOrigin = aLin2d.Location();
di << "X_0 = " << anOrigin.X() << " Y_0 = " << anOrigin.Y() << "\n" ;
}
- catch(Standard_ConstructionError)
+ catch(Standard_ConstructionError const&)
{
di << argv[0] << " Exception: Sqrt(A*A + B*B) <= Resolution from gp\n";
}
if (getboollist->Last() != Standard_True)
return 3;
const TDataStd_ListOfByte& boollist = getboollist->List();
- TDataStd_ListIteratorOfListOfByte itr_boollist(boollist);
- for (; itr_boollist.More(); itr_boollist.Next())
+ for (TDataStd_ListIteratorOfListOfByte itr_boollist(boollist); itr_boollist.More(); itr_boollist.Next())
{
- if (itr_boollist.Value() != Standard_True &&
- itr_boollist.Value() != Standard_False)
+ if (itr_boollist.Value() != 1
+ && itr_boollist.Value() != 0)
{
return 4;
}
{
// Std
Handle(TDocStd_Document) doc_std, doc_std_open;
- app->NewDocument("MDTV-Standard", doc_std);
+ app->NewDocument("BinOcaf", doc_std);
// TDataStd_Tick:
TDataStd_Tick::Set(doc_std->Main());
// TDataStd_IntegerList:
int good = 0;
Handle(TDocStd_Document) doc;
- app->NewDocument("MDTV-Standard", doc);
+ app->NewDocument("BinOcaf", doc);
doc->SetUndoLimit(10);
di <<"\nTestSetGet start\n";
{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if(aContext.IsNull()) {
- di << argv[0] << " ERROR : use 'vinit' command before " << "\n";
+ di << argv[0] << " ERROR : use 'vinit' command before \n";
return -1;
}
return 1;
}
Handle(V3d_View) V = ViewerTest::CurrentView();
+ static Handle(AIS_ColorScale) aCS;
+ if (aCS.IsNull())
+ {
+ aCS = new AIS_ColorScale();
+ }
+ if (aCS->ZLayer() != Graphic3d_ZLayerId_TopOSD)
+ {
+ aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD);
+ }
+ if (aCS->TransformPersistence().IsNull()
+ || aCS->TransformPersistence()->Mode() != Graphic3d_TMF_2d)
+ {
+ aContext->SetTransformPersistence (aCS, new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
+ }
+ Standard_Integer aWinWidth, aWinHeight;
+ V->Window()->Size (aWinWidth, aWinHeight);
+ aCS->SetSize (aWinWidth, aWinHeight);
if ( !V.IsNull() ) {
if (mode == 0) {
- V->ColorScaleDisplay();
+ aContext->Display (aCS, Standard_True);
}
if (mode == 1) {
- V->ColorScaleErase();
+ aContext->Erase (aCS, Standard_False);
V->UpdateLights();
V->Update();
}
if (mode == 2) {
- Standard_Boolean IsDisplayed = V->ColorScaleIsDisplayed();
+ Standard_Boolean IsDisplayed = aContext->IsDisplayed (aCS);
if (IsDisplayed)
- di <<"ColorScaleIsDisplayed = " << "1" << "\n";
+ di <<"ColorScaleIsDisplayed = 1\n";
else
- di <<"ColorScaleIsDisplayed = " << "0" << "\n";
+ di <<"ColorScaleIsDisplayed = 0\n";
}
}
return 0;
#include <Draw_ProgressIndicator.hxx>
#include <XSControl_WorkSession.hxx>
#include <Transfer_TransientProcess.hxx>
-#include <XSDRAW_Commands.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <Message_ProgressSentry.hxx>
#include <XSControl_TransferReader.hxx>
-static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
- if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
-
- // Progress indicator
- Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
- progress->SetScale ( 0, 100, 1 );
- progress->Show();
-
- IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
- if (ctl.IsNull())
- ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
-
- TCollection_AsciiString fnom,rnom;
-
- Standard_Boolean modfic = XSDRAW::FileAndVar
- (argv[1],argv[2],"IGESBREP",fnom,rnom);
- if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
- else di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
- di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
- IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
-
-#ifdef CHRONOMESURE
- OSD_Timer Chr; Chr.Reset();
- IDT_SetLevel(3);
-#endif
-
-
-// Reading the file
- progress->NewScope ( 20, "Loading" ); // On average loading takes 20%
- progress->Show();
-
- // *New*
- //In order to decrease number of produced edges during translation it is possible to set following parameter
- Interface_Static::SetIVal("read.iges.bspline.continuity",0);
- // *New*
-
- if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
- else if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
-
- progress->EndScope();
- progress->Show();
-
- if (readstat != IFSelect_RetDone) {
- if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon"<<"\n";
- else di<<"No model loaded"<<"\n";
- return 1;
- }
-// Choice of treatment
- Standard_Boolean fromtcl = (argc > 3);
- Standard_Integer modepri = 1, nent, nbs;
- if (fromtcl) modepri = 4;
-
- while (modepri) {
- //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka
- //mode OnlyVisible does not work.
- // nent = Reader.NbRootsForTransfer();
- if (!fromtcl) {
- cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
- modepri = -1;
-
-// amv 26.09.2003 : this is used to avoid error of enter's simbol
- char str[80];
- cin>>str;
- modepri = Draw::Atoi(str);
- }
-
- if (modepri == 0) { //fin
- di << "Bye and good luck! " << "\n";
- break;
- }
-
- else if (modepri <= 2) { // 1 : Visible Roots, 2 : All Roots
- di << "All Geometry Transfer"<<"\n";
- di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
- di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
- Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->ClearContext();
- XSDRAW::SetTransferProcess (thesession->MapReader());
- progress->NewScope ( 80, "Translation" );
- progress->Show();
- thesession->MapReader()->SetProgress ( progress );
-
- if (modepri == 1) Reader.SetReadVisible (Standard_True);
- Reader.TransferRoots();
-
- thesession->MapReader()->SetProgress ( 0 );
- progress->EndScope();
- progress->Show();
- // result in only one shape for all the roots
- // or in one shape for one root.
- di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
- Standard_Integer answer = 1;
- if (Reader.NbShapes() > 1) {
- cout << " pass(0) one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << flush;
- answer = -1;
- //amv 26.09.2003
- char str_a[80];
- cin >> str_a;
- answer = Draw::Atoi(str_a);
- }
- if ( answer == 0) continue;
- if ( answer == 1 || answer == 3) {
- TopoDS_Shape shape = Reader.OneShape();
- // save the shape
- if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
- char fname[110];
- Sprintf(fname, "%s", rnom.ToCString());
- di << "Saving shape in variable Draw : " << fname << "\n";
- if (answer == 3) IGESToBRep::WriteShape (shape,1);
- try {
- OCC_CATCH_SIGNALS
- DBRep::Set(fname,shape);
- }
- catch(Standard_Failure) {
- di << "** Exception : ";
- di << Standard_Failure::Caught()->GetMessageString();
- di<<" ** Skip"<<"\n";
- di << "Saving shape in variable Draw : " << fname << "\n";
- IGESToBRep::WriteShape (shape,1);
- }
- }
-
- else if (answer == 2 || answer == 4) {
- Standard_Integer numshape = Reader.NbShapes();
- for (Standard_Integer inum = 1; inum <= numshape; inum++) {
- // save all the shapes
- TopoDS_Shape shape = Reader.Shape(inum);
- if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
- char fname[110];
- Sprintf(fname, "%s_%d", rnom.ToCString(),inum);
- di << "Saving shape in variable Draw : " << fname << "\n";
- if (answer == 4) IGESToBRep::WriteShape (shape,inum);
- try {
- OCC_CATCH_SIGNALS
- DBRep::Set(fname,shape);
- }
- catch(Standard_Failure) {
- di << "** Exception : ";
- di << Standard_Failure::Caught()->GetMessageString();
- di<<" ** Skip"<<"\n";
- }
- }
- }
- else return 0;
- }
-
- else if (modepri == 3) { // One Entity
- cout << "Only One Entity"<<endl;
- cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
- cout<<" To modify : command param read.iges.bspline.continuity"<<endl;
- cout << " give the number of the Entity : " << flush;
- nent = XSDRAW::GetEntityNumber();
-
- if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
- else {
- nbs = Reader.NbShapes();
- char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nent);
- di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
- di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
- TopoDS_Shape sh = Reader.Shape(nbs);
- DBRep::Set (shname,sh);
- }
- }
-
- else if (modepri == 4) { // Selection
- Standard_Integer answer = 1;
- Handle(TColStd_HSequenceOfTransient) list;
-
-// Selection, nommee ou via tcl. tcl : raccourcis admis
-// * donne iges-visible + xst-transferrable-roots
-// *r donne xst-model-roots (TOUTES racines)
-
- if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {
- di << "All Geometry Transfer"<<"\n";
- di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
- di<<" To modify : command param read.iges.bspline.continuity"<<"\n";
- Handle(XSControl_WorkSession) thesession = Reader.WS();
- thesession->ClearContext();
- XSDRAW::SetTransferProcess (thesession->MapReader());
- progress->NewScope ( 80, "Translation" );
- progress->Show();
- thesession->MapReader()->SetProgress ( progress );
-
- Reader.SetReadVisible (Standard_True);
- Reader.TransferRoots();
-
- thesession->MapReader()->SetProgress ( 0 );
- progress->EndScope();
- progress->Show();
-
- // result in only one shape for all the roots
- TopoDS_Shape shape = Reader.OneShape();
- // save the shape
- char fname[110];
- Sprintf(fname, "%s", rnom.ToCString());
- di << "Saving shape in variable Draw : " << fname << "\n";
- try {
- OCC_CATCH_SIGNALS
- DBRep::Set(fname,shape);
- }
- catch(Standard_Failure) {
- di << "** Exception : ";
- di << Standard_Failure::Caught()->GetMessageString();
- di<<" ** Skip"<<"\n";
- di << "Saving shape in variable Draw : " << fname << "\n";
- IGESToBRep::WriteShape (shape,1);
- }
- return 0;
- }
-
- if(fromtcl) {
- modepri = 0; // d office, une seule passe
- if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') {
- di<<"All Roots : ";
- list = XSDRAW::GetList ("xst-model-roots");
- }
- else {
- TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3);
- di<<"List given by "<<compart.ToCString()<<" : ";
- list = XSDRAW::GetList (compart.ToCString());
- }
- if (list.IsNull()) {
- di<<"No list defined. Give a selection name or * for all visible transferrable roots"<<"\n";
- continue;
- }
- }
- else {
- cout<<"Name of Selection :"<<flush;
- list = XSDRAW::GetList();
- if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
- }
-
- Standard_Integer nbl = list->Length();
- di<<"Nb entities selected : "<<nbl<<"\n";
- if (nbl == 0) continue;
- while (answer) {
- if (!fromtcl) {
- cout<<"Choice: 0 abandon 1 transfer all 2 with confirmation 3 list n0s ents :"<<flush;
- answer = -1;
- // anv 26.09.2003
- char str_answer[80];
- cin>>str_answer;
- answer = Draw::Atoi(str_answer);
- }
- if (answer <= 0 || answer > 3) continue;
- if (answer == 3) {
- for (Standard_Integer ill = 1; ill <= nbl; ill ++) {
- Handle(Standard_Transient) ent = list->Value(ill);
- di<<" ";// model->Print(ent,di);
- }
- di<<"\n";
- }
- if (answer == 1 || answer == 2) {
- Standard_Integer nbt = 0;
- Handle(XSControl_WorkSession) thesession = Reader.WS();
-
- XSDRAW::SetTransferProcess (thesession->MapReader());
- progress->NewScope ( 80, "Translation" );
- progress->Show();
- thesession->MapReader()->SetProgress ( progress );
-
- Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
- for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
-
- nent = Reader.Model()->Number(list->Value(ill));
- if (nent == 0) continue;
- if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
- else {
- nbs = Reader.NbShapes();
- char shname[30]; Sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
- di<<"Transfer entity n0 "<<nent<<" OK -> DRAW Shape: "<<shname<<"\n";
- di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
- TopoDS_Shape sh = Reader.Shape(nbs);
- DBRep::Set (shname,sh);
- nbt++;
- }
- }
- thesession->MapReader()->SetProgress ( 0 );
- progress->EndScope();
- progress->Show();
- di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
- answer = 0; // on ne reboucle pas
- }
- }
- }
- else di<<"Unknown mode n0 "<<modepri<<"\n";
- }
-
- // *New*
- //In order to clear memory after IGES reading you could add the following code
- Handle(XSControl_TransferReader) TR = Reader.WS()->TransferReader();
- Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
- TP->Clear();
- TR->Clear(2);
- Reader.WS()->Model()->Clear();
- Standard_Integer i =1;
- for( ; i <= 7; i++)
- Reader.WS()->ClearData(i);
- // *New*
-
- return 0;
-}
-
#include <Geom_Plane.hxx>
static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
{
if(argc!=2)
{
- di << "Usage : " << argv[0] << " MaxNbr" << "\n";
+ di << "Usage : " << argv[0] << " MaxNbr\n";
return -1;
}
Standard_Integer aMaxNbr = Draw::Atoi(argv[1]);
return 0;
}
-#include <Graphic3d_Vector.hxx>
-Standard_Integer OCC22762 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if (argc!=7)
- {
- di << "Wrong number of arguments" << "\n";
- return -1;
- }
- Standard_Real X1_Pnt = Draw::Atof(argv[1]);
- Standard_Real Y1_Pnt = Draw::Atof(argv[2]);
- Standard_Real Z1_Pnt = Draw::Atof(argv[3]);
- Standard_Real X2_Pnt = Draw::Atof(argv[4]);
- Standard_Real Y2_Pnt = Draw::Atof(argv[5]);
- Standard_Real Z2_Pnt = Draw::Atof(argv[6]);
-
- Graphic3d_Vector AV1(X1_Pnt, Y1_Pnt, Z1_Pnt);
- Graphic3d_Vector AV2(X2_Pnt, Y2_Pnt, Z2_Pnt);
-
- di << "Result is: " << (Graphic3d_Vector::IsParallel(AV1, AV2) ? "true" : "false") << "\n" ;
- return 0;
-}
-
-
-
-
#include <IntCurvesFace_ShapeIntersector.hxx>
#include <gp_Lin.hxx>
Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if(argc!=9)
{
- di << "Usage : " << argv[0] << " shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf" << "\n";
+ di << "Usage : " << argv[0] << " shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf\n";
return -1;
}
for (Standard_Integer i = 0; i < 2; i++)
aPartMask.Add(i);
- di << "aFullMask = 1111" << "\n";
- di << "aPartMask = 1100" << "\n";
+ di << "aFullMask = 1111\n";
+ di << "aPartMask = 1100\n";
Standard_Boolean isAffected;
return 0;
}
-#include <ShapeFix_FixSmallFace.hxx>
-Standard_Integer OCC22586 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-
- if (argc != 3) {
- di << "Usage : " << argv[0] << " shape resshape\n";
- return 1;
- }
-
- // try to read a shape:
- TopoDS_Shape aShape=DBRep::Get(argv[1]);
- ShapeFix_FixSmallFace aFixSmallFaces;
- aFixSmallFaces.Init (aShape);
- aFixSmallFaces.Perform();
- TopoDS_Shape aResShape = aFixSmallFaces.Shape();
- DBRep::Set(argv[2],aResShape);
-
- return 0;
-
-}
#include <NCollection_DataMap.hxx>
Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
return 0;
}
-Standard_Integer OCC23429(Draw_Interpretor& di,
+Standard_Integer OCC23429(Draw_Interpretor& /*di*/,
Standard_Integer narg, const char** a)
{
if (narg < 4) return 1;
return 0;
}
-#include <BOPTColStd_CArray1OfInteger.hxx>
-//=======================================================================
-//function : DumpArray
-//purpose :
-//=======================================================================
-void DumpArray(const BOPTColStd_CArray1OfInteger& aC,
- Draw_Interpretor& aDI)
-{
- Standard_Integer iLength, iFactLength, iBlockLength;
- //
- iLength=aC.Length();
- iFactLength=aC.FactLength();
- iBlockLength=aC.BlockLength();
- //
- aDI<< "Length: " <<iLength << "\n";
- aDI<< "FactLength: " <<iFactLength << "\n";
- aDI<< "BlockLength: " <<iBlockLength << "\n";
-}
-//=======================================================================
-//function : bcarray
-//purpose :
-//=======================================================================
-Standard_Integer bcarray (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-
- if (argc != 1) {
- di << "Usage : " << argv[0] << "\n";
- return 1;
- }
-
- Standard_Integer i, aBL;
- BOPTColStd_CArray1OfInteger aC;
- //
- aBL=100000;
- aC.SetBlockLength(aBL);
- //
- for (i=1; i<=10; ++i) {
- aC.Append(-i*10);
- }
- di<< "\nstate before release the unused memory\n";
- DumpArray(aC, di);
- //
- aC.Purge();
- //
- di<< "\nstate after release the unused memory\n";
- DumpArray(aC, di);
- //
- return 0;
-}
-
#include <ExprIntrp_GenExp.hxx>
Standard_Integer CR23403 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
OCC_CATCH_SIGNALS
myExpr->Process( aString );
}
- catch(Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- di << "Exception : " << aFail->GetMessageString() << "\n";
+ catch(Standard_Failure const& anException) {
+ di << "Exception : " << anException.GetMessageString() << "\n";
}
return 0;
}
-#include <Quantity_NameOfColor.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-Standard_Integer CR23234 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- // Check the command arguments
- if (argc != 2)
+Standard_Integer OCC28478 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer nbOuter = (argc > 1 ? Draw::Atoi(argv[1]) : 3);
+ Standard_Integer nbInner = (argc > 2 ? Draw::Atoi(argv[2]) : 2);
+ Standard_Boolean isInf = (argc > 3 && ! strcmp (argv[3], "-inf"));
+
+ // test behavior of progress indicator when using nested scopes with names set by Sentry objects
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di, 1);
+ aProgress->SetTextMode (Standard_True);
+ aProgress->SetTclOutput (Standard_True);
+
+ // Outer cycle
+ Message_ProgressSentry anOuter (aProgress, "Outer", 0, nbOuter, 1);
+ for (int i = 0; i < nbOuter && anOuter.More(); i++, anOuter.Next())
{
- di <<"Error: "<<argv[0]<<" - invalid number of arguments"<< "\n";
- di << "Usage : " << argv[0] << " mode(0/1)\n";
- return 1; //TCL_ERROR
+ // Inner cycle
+ Message_ProgressSentry anInner (aProgress, "Inner", 0, nbInner, 1, isInf);
+ for (int j = 0; j < nbInner && anInner.More(); j++, anInner.Next())
+ {
+ // Cycle body
+ }
}
- const Standard_Integer aMode = Draw::Atoi(argv[1]);
+ return 0;
+}
- //===================================================================
+Standard_Integer OCC31189 (Draw_Interpretor& theDI, Standard_Integer /*argc*/, const char ** /*argv*/)
+{
+ // redirect output of default messenger to DRAW (temporarily)
+ const Handle(Message_Messenger)& aMsgMgr = Message::DefaultMessenger();
+ Message_SequenceOfPrinters aPrinters;
+ aPrinters.Append (aMsgMgr->ChangePrinters());
+ aMsgMgr->AddPrinter (new Draw_Printer (theDI));
- Handle(AIS_InteractiveContext) aisContext = ViewerTest::GetAISContext();
- if (aisContext.IsNull())
+ // scope block to test output of message on destruction of a stream buffer
{
- di <<"Error: call 'vinit' first"<< "\n";
- return 1; //TCL_ERROR
+ Message_Messenger::StreamBuffer aSender = Message::SendInfo();
+
+ // check that messages output to sender and directly to messenger do not intermix
+ aSender << "Sender message 1: start ...";
+ aMsgMgr->Send ("Direct message 1");
+ aSender << "... end" << std::endl; // endl should send the message
+
+ // check that empty stream buffer does not produce output on destruction
+ Message::SendInfo();
+
+ // additional message to check that they go in expected order
+ aMsgMgr->Send ("Direct message 2");
+
+ // check that empty stream buffer does produce empty line if std::endl is passed
+ Message::SendInfo() << std::endl;
+
+ // last message should be sent on destruction of a sender
+ aSender << "Sender message 2";
}
- if (aisContext->HasOpenedContext())
- {
- aisContext->CloseAllContexts();
- aisContext->RemoveAll(false);
- aisContext->EraseSelected(false, false);
- }
- aisContext->EraseAll(false,false);
- Handle(Geom_Axis2Placement) trihedronAxis = new Geom_Axis2Placement(gp::XOY());
- Handle(AIS_Trihedron) trihedron = new AIS_Trihedron(trihedronAxis);
- if (aMode)
- trihedron->UnsetSelectionMode(); // this line causes an exception on OpenLocalContext
- trihedron->SetSize(20);
- trihedron->SetColor(Quantity_NOC_GRAY30);
- trihedron->SetArrowColor(Quantity_NOC_GRAY30);
- trihedron->SetTextColor(Quantity_NOC_DARKSLATEBLUE);
-
- //trihedron->SetColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
- //trihedron->SetArrowColor(Quantity_NameOfColor::Quantity_NOC_GRAY30);
- //trihedron->SetTextColor(Quantity_NameOfColor::Quantity_NOC_DARKSLATEBLUE);
-
-
- aisContext->Display(trihedron, true);
- aisContext->OpenLocalContext();
- //aisContext->ActivateStandardMode(TopAbs_ShapeEnum::TopAbs_EDGE);
- aisContext->ActivateStandardMode(TopAbs_EDGE);
- aisContext->SetSensitivity(8);
-
- return 0; //TCL_OK
+ // restore initial output queue
+ aMsgMgr->RemovePrinters (STANDARD_TYPE(Draw_Printer));
+ aMsgMgr->ChangePrinters().Append (aPrinters);
+
+ return 0;
}
void QABugs::Commands_11(Draw_Interpretor& theCommands) {
theCommands.Add("OCC136", "OCC136", __FILE__, OCC136, group);
theCommands.Add("BUC60610","BUC60610 iges_input [name]",__FILE__,BUC60610,group);
- theCommands.Add("BUC60661","BUC60661 file.igs",__FILE__,BUC60661, group);
-
-//====================================================
-//
-// Following commands are inserted from
-// /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
-// ( 75455 Apr 16 18:59)
-//
-//====================================================
theCommands.Add("OCC105","OCC105 shape",__FILE__,OCC105,group);
theCommands.Add("OCC9"," result path cur1 cur2 radius [tolerance]:\t test GeomFill_Pipe", __FILE__, pipe_OCC9,group);
theCommands.Add("OCC310","OCC310", __FILE__, OCC310bug, group);
//theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
- theCommands.Add("OCC277","OCC277 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC277bug, group);
-
- theCommands.Add("OCC333","OCC333 edge1 edge2 [toler domaindist]; Check overlapping edges", __FILE__, OCC333bug, group);
+ theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
// Must use OCC299
theCommands.Add("OCC524", "OCC524 LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix", __FILE__, OCC524, group);
theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group);
//theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
- theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC578, group);
+ theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group);
theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group);
theCommands.Add("OCC902", "OCC902 expression", __FILE__, OCC902, group);
theCommands.Add ("OCC1029_AISTransparency","OCC1029_AISTransparency (DOC, entry, [real])",__FILE__, OCC1029_AISTransparency, group);
- theCommands.Add ("OCC1030_AISColor", "OCC1030_AISColor (DOC, entry, [color])", __FILE__, OCC1030_AISColor, group);
theCommands.Add ("OCC1031_AISMaterial", "OCC1031_AISMaterial (DOC, entry, [material])", __FILE__, OCC1031_AISMaterial, group);
theCommands.Add ("OCC1032_AISWidth", "OCC1032_AISWidth (DOC, entry, [width])", __FILE__, OCC1032_AISWidth, group);
theCommands.Add ("OCC1033_AISMode", "OCC1033_AISMode (DOC, entry, [mode])", __FILE__, OCC1033_AISMode, group);
theCommands.Add ("OCC1034_AISSelectionMode", "OCC1034_AISSelectionMode (DOC, entry, [selectionmode])", __FILE__, OCC1034_AISSelectionMode, group);
//theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
- theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC1487, group);
+ theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
theCommands.Add("OCC1077", "OCC1077 result", __FILE__, OCC1077, group);
theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
- theCommands.Add("OCC6143", "OCC6143", __FILE__, OCC6143, group);
- theCommands.Add("OCC7141", "OCC7141 [nCount]", __FILE__, OCC7141, group);
+ theCommands.Add("OCC6143", "OCC6143 catching signals", __FILE__, OCC6143, group);
+ theCommands.Add("OCC30775", "OCC30775 catching signals in threads", __FILE__, OCC30775, group);
+ theCommands.Add("OCC7141", "OCC7141 [nCount] aPath", __FILE__, OCC7141, group);
theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);
theCommands.Add("OCC10138", "OCC10138 lower upper", __FILE__, OCC10138, group);
theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group);
theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group);
theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group);
- theCommands.Add("OCC18612", "OCC18612 [file else already loaded model] [name DRAW]", __FILE__, OCC18612igesbrep, group);
theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group);
theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
- theCommands.Add("OCC22586", "OCC22586 shape resshape", __FILE__, OCC22586, group);
theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
- theCommands.Add("bcarray", "bcarray", __FILE__, bcarray, group);
- theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
theCommands.Add("OCC22558", "OCC22558 x_vec y_vec z_vec x_dir y_dir z_dit x_pnt y_pnt z_pnt", __FILE__, OCC22558, group);
theCommands.Add("CR23403", "CR23403 string", __FILE__, CR23403, group);
theCommands.Add("OCC23429", "OCC23429 res shape tool [appr]", __FILE__, OCC23429, group);
- theCommands.Add("CR23234", "CR23234 mode(0/1)", __FILE__, CR23234, group);
+ theCommands.Add("OCC28478", "OCC28478 [nb_outer=3 [nb_inner=2] [-inf]: test progress indicator on nested cycles", __FILE__, OCC28478, group);
+ theCommands.Add("OCC31189", "OCC31189: check stream buffer interface of Message_Messenger", __FILE__, OCC31189, group);
return;
}