// 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 // + edge, face #include #include #include #include #include #include #include #include #include #include #include #include #include // + edgeregul/updtol #include // + fillface #include #include #include #include #include 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 XSHAPE_edgeregul (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { //cky/rln 03.02.99 To eliminate dependence of SWDRAW on TKXSBase (to use only ShapeHealing) Standard_Real tolang = -1; // = Interface_Static::RVal("XSTEP.encoderegularity.angle"); // if (argc < 3) di<<"Current value for regularity angle : "< 2) tolang = atof (arg2); if (tolang <= 0) { di<<"Not a suitable value : "< samerange shape" << "\n"; di << "or" << "\n"; di << "> samerange newcurve curve2d first last newfirst newlast" << "\n"; } return 0; } // ######################################## // ## DECLARATIONS ## // ######################################## static int initactor = 0; void SWDRAW_ShapeTool::InitCommands (Draw_Interpretor& theCommands) { 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 ("edgeregul","shape val", __FILE__,XSHAPE_edgeregul,g); theCommands.Add ("samerange","{ shape | result curve2d first last newfirst newlast }", __FILE__,samerange,g); }