1 2 #ifdef OCCGEOMETRY 3 4 #include <mystdlib.h> 5 #include <occgeom.hpp> 6 #include "ShapeAnalysis_ShapeTolerance.hxx" 7 #include "ShapeAnalysis_ShapeContents.hxx" 8 #include "ShapeAnalysis_CheckSmallFace.hxx" 9 #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx" 10 #include "BRepAlgoAPI_Fuse.hxx" 11 #include "BRepCheck_Analyzer.hxx" 12 #include "BRepLib.hxx" 13 #include "ShapeBuild_ReShape.hxx" 14 #include "ShapeFix.hxx" 15 #include "ShapeFix_FixSmallFace.hxx" 16 #include "Partition_Spliter.hxx" 17 //#include "VrmlAPI.hxx" 18 //#include "StlAPI.hxx" 19 20 21 #include <GC_MakeSegment.hxx> 22 #include <BRepBuilderAPI_MakeEdge.hxx> 23 #include <BRepBuilderAPI_MakeWire.hxx> 24 #include <BRepPrimAPI_MakeBox.hxx> 25 // #include <BRep_Builder.hxx> 26 #include <TopoDS_Builder.hxx> 27 #include <BRepAlgoAPI_Cut.hxx> 28 #include <BRepAlgoAPI_Common.hxx> 29 #include <BRepAlgoAPI_Fuse.hxx> 30 #include <BRepAlgoAPI_Section.hxx> 31 #include <BRepOffsetAPI_Sewing.hxx> 32 //#include <BRepAlgo_Sewing.hxx> 33 #include <BRepOffsetAPI_MakeOffsetShape.hxx> 34 #include <ShapeFix_Shape.hxx> 35 namespace netgen 36 { 37 OCCConstructGeometry(OCCGeometry & geom)38 void OCCConstructGeometry (OCCGeometry & geom) 39 { 40 #ifdef NOTHING 41 cout << "OCC construction" << endl; 42 43 BRep_Builder builder; 44 BRepPrimAPI_MakeBox mbox(gp_Pnt(-10e5, -15e5, 0), gp_Pnt(20e5, 15e5, 10e5)); 45 46 47 /* 48 TopoDS_Shape air = TopoDS_Solid (mbox); 49 air = BRepAlgoAPI_Cut (air, geom.somap(1)); 50 air = BRepAlgoAPI_Cut (air, geom.somap(2)); 51 air = BRepAlgoAPI_Cut (air, geom.somap(3)); 52 air = BRepAlgoAPI_Cut (air, geom.somap(4)); 53 air = BRepAlgoAPI_Cut (air, geom.somap(5)); 54 air = BRepAlgoAPI_Cut (air, geom.somap(6)); 55 air = BRepAlgoAPI_Cut (air, geom.somap(7)); 56 // air = BRepAlgoAPI_Cut (air, geom.somap(8)); 57 air = BRepAlgoAPI_Cut (air, geom.somap(9)); 58 // air = BRepAlgoAPI_Cut (air, geom.somap(10)); 59 */ 60 61 /* 62 BRepOffsetAPI_MakeOffsetShape dom8plus (geom.somap(8), 1e4, 1e-6); 63 BRepOffsetAPI_MakeOffsetShape dom6plus (geom.somap(6), 1e4, 1e-6); 64 dom8plus.Build(); 65 ShapeFix_Shape fixshape(dom8plus.Shape()); 66 fixshape.Perform(); 67 68 ShapeFix_Shape fix_dom2(geom.somap(2)); 69 fix_dom2.Perform(); 70 71 72 BRepAlgoAPI_Cut dom2m8(fix_dom2.Shape(), fixshape.Shape()); 73 ShapeFix_Shape fix_dom2m8 (dom2m8); 74 fix_dom2m8.Perform(); 75 76 builder.Add (geom.shape, 77 BRepAlgoAPI_Cut 78 (BRepAlgoAPI_Cut (geom.somap(2), dom6plus), 79 dom8plus)); 80 // builder.Add (geom.shape, fix_dom2m8.Shape()); 81 // builder.Add (geom.shape, fixshape.Shape()); 82 */ 83 84 TopoDS_Shape my_fuse; 85 int cnt = 0; 86 for (TopExp_Explorer exp_solid(geom.shape, TopAbs_SOLID); exp_solid.More(); exp_solid.Next()) 87 { 88 if (cnt == 0) 89 my_fuse = exp_solid.Current(); 90 else 91 { 92 cout << "fuse, cnt = " << cnt << endl; 93 if (cnt != 7 && cnt != 9) 94 my_fuse = BRepAlgoAPI_Fuse (my_fuse, exp_solid.Current()); 95 } 96 cnt++; 97 } 98 builder.Add (geom.shape, my_fuse); 99 100 /* 101 ShapeUpgrade_ShellSewing ss; 102 ss.ApplySewing(geom.shape,1e5); 103 */ 104 105 /* 106 BRepAlgo_Sewing sewing(1.e5); 107 108 int cnt = 0; 109 for (TopExp_Explorer exp_solid(geom.shape, TopAbs_SOLID); exp_solid.More(); exp_solid.Next()) 110 { 111 cout << "swe, cnt = " << cnt << endl; 112 if (cnt != 7 && cnt != 9) 113 sewing.Add (exp_solid.Current()); 114 cnt++; 115 } 116 117 sewing.Perform(); 118 builder.Add (geom.shape, sewing.SewedShape()); 119 */ 120 121 122 /* 123 cout << "build air domain" << endl; 124 TopoDS_Shape air = BRepAlgoAPI_Cut (TopoDS_Solid (mbox), my_fuse); 125 126 cnt = 0; 127 for (TopExp_Explorer exp_solid(geom.shape, TopAbs_SOLID); exp_solid.More(); exp_solid.Next()) 128 { 129 cout << "section, cnt = " << cnt << endl; 130 if (cnt == 7) 131 { 132 builder.Add (geom.shape, 133 BRepAlgoAPI_Section (air, exp_solid.Current())); 134 } 135 cnt++; 136 } 137 */ 138 139 140 141 // builder.Add (geom.shape, air); 142 for (int i = 1; i <= 10; i++) 143 builder.Remove (geom.shape, geom.somap(i)); 144 145 146 147 148 geom.BuildFMap(); 149 geom.BuildVisualizationMesh(); 150 geom.changed = 1; 151 #endif 152 153 } 154 } 155 156 157 #endif 158