// Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // 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. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. // 25.12.98 pdn renaming // 02.02.99 cky/rln PRO17746: transmitting 'sketch' command to XSDRAWEUC // 23.02.99 abv: method ShapeFix::FillFace() removed // 02.03.99 cky/rln: command edgeregul only accepts tolerance // 15.06.99 abv/pdn: command comptol added (from S4030) #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // + edge, face // + edgeregul/updtol // + fillface static Standard_Integer XSHAPE_edge (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc < 2) { di<<"donner un nom de shape\n"; return 1 /* Error */; } Standard_CString arg1 = argv[1]; TopoDS_Shape Shape = DBRep::Get(arg1); if (Shape.IsNull()) { di< 2) { Standard_CString arg2 = argv[2]; TopoDS_Shape aLocalShape = DBRep::Get(arg2); F = TopoDS::Face ( aLocalShape ); } Standard_Integer i,num = 0, nbw, nbe = 0; TopTools_IndexedMapOfShape map; for (TopoDS_Iterator ext(W); ext.More(); ext.Next()) { if (ext.Value().ShapeType() != TopAbs_EDGE) continue; TopoDS_Edge E = TopoDS::Edge (ext.Value()); nbe ++; num = map.Add(E); } int* nbs = new int[nbe+1]; for (i = 0; i <= nbe; i ++) nbs[i] = 0; di<<"TopoDS_Iterator(EDGE) donne "< 1 fois en MULTWE_num\n"; if (nbs[0] > 0) di<<"NB : Edge n0 0 comptee "< 1) { di<<"Edge n0 "< Freeing\n"; Shape.Free(Standard_True); } TopoDS_Shell sh = TopoDS::Shell (Shape); TopoDS_Solid solid; BRep_Builder B; B.MakeSolid (solid); B.Add (solid,sh); // Pas encore fini : il faut une bonne orientation BRepClass3d_SolidClassifier bsc3d (solid); bsc3d.PerformInfinitePoint(BRepBuilderAPI::Precision()); if (bsc3d.State() == TopAbs_IN) { // Ensuite, inverser C-A-D REPRENDRE LES SHELLS // (l inversion du solide n est pas bien prise en compte) di<<"NB : Shell to be reversed\n"; TopoDS_Solid soli2; B.MakeSolid (soli2); // on recommence sh.Reverse(); B.Add (soli2,sh); solid = soli2; } DBRep::Set(argv[2],solid); return 0; // Done } static Standard_Integer samerange (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if ( argc ==2 ) { TopoDS_Shape Shape = DBRep::Get(argv[1]); if (Shape.IsNull()) { di<<"Shape unknown: "< samerange shape\n"; di << "or\n"; di << "> samerange newcurve curve2d first last newfirst newlast\n"; } return 0; } // ######################################## // ## DECLARATIONS ## // ######################################## void SWDRAW_ShapeTool::InitCommands (Draw_Interpretor& theCommands) { static int initactor = 0; if (initactor) { return; } initactor = 1; const char* g; g = "DE: old"; theCommands.Add ("anaedges","nom shape", __FILE__,XSHAPE_edge,g); theCommands.Add ("expwire","nom wire [nom face]", __FILE__,XSHAPE_explorewire,g); theCommands.Add ("ssolid","nom shell + nouveau nom solid", __FILE__,XSHAPE_ssolid,g); theCommands.Add ("samerange","{ shape | result curve2d first last newfirst newlast }", __FILE__,samerange,g); }