File: occconstruction.cpp

package info (click to toggle)
netgen 6.2.2601%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,076 kB
  • sloc: cpp: 166,627; tcl: 6,310; python: 2,868; sh: 528; makefile: 90
file content (157 lines) | stat: -rw-r--r-- 3,975 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

#ifdef OCCGEOMETRY

#include <mystdlib.h>
#include <occgeom.hpp>  
#include "ShapeAnalysis_ShapeTolerance.hxx"
#include "ShapeAnalysis_ShapeContents.hxx"
#include "ShapeAnalysis_CheckSmallFace.hxx"
#include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
#include "BRepAlgoAPI_Fuse.hxx"
#include "BRepCheck_Analyzer.hxx"
#include "BRepLib.hxx"
#include "ShapeBuild_ReShape.hxx"
#include "ShapeFix.hxx"
#include "ShapeFix_FixSmallFace.hxx"
#include "Partition_Spliter.hxx"
//#include "VrmlAPI.hxx"
//#include "StlAPI.hxx"


#include <GC_MakeSegment.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
// #include <BRep_Builder.hxx>
#include <TopoDS_Builder.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Section.hxx>
#include <BRepOffsetAPI_Sewing.hxx>
//#include <BRepAlgo_Sewing.hxx>
#include <BRepOffsetAPI_MakeOffsetShape.hxx>
#include <ShapeFix_Shape.hxx>
namespace netgen
{

  void OCCConstructGeometry (OCCGeometry & geom)
  {
#ifdef NOTHING
    cout << "OCC construction" << endl;

    BRep_Builder builder;
    BRepPrimAPI_MakeBox mbox(gp_Pnt(-10e5, -15e5, 0), gp_Pnt(20e5, 15e5, 10e5));


    /*
    TopoDS_Shape air = TopoDS_Solid (mbox);
    air = BRepAlgoAPI_Cut (air, geom.somap(1));
    air = BRepAlgoAPI_Cut (air, geom.somap(2));
    air = BRepAlgoAPI_Cut (air, geom.somap(3));
    air = BRepAlgoAPI_Cut (air, geom.somap(4));
    air = BRepAlgoAPI_Cut (air, geom.somap(5));
    air = BRepAlgoAPI_Cut (air, geom.somap(6));
    air = BRepAlgoAPI_Cut (air, geom.somap(7));
    // air = BRepAlgoAPI_Cut (air, geom.somap(8));
    air = BRepAlgoAPI_Cut (air, geom.somap(9));
    // air = BRepAlgoAPI_Cut (air, geom.somap(10));
    */

    /*
    BRepOffsetAPI_MakeOffsetShape dom8plus (geom.somap(8), 1e4, 1e-6);
    BRepOffsetAPI_MakeOffsetShape dom6plus (geom.somap(6), 1e4, 1e-6);
    dom8plus.Build();
    ShapeFix_Shape fixshape(dom8plus.Shape());
    fixshape.Perform();
    
    ShapeFix_Shape fix_dom2(geom.somap(2));
    fix_dom2.Perform();


    BRepAlgoAPI_Cut dom2m8(fix_dom2.Shape(), fixshape.Shape());
    ShapeFix_Shape fix_dom2m8 (dom2m8);
    fix_dom2m8.Perform();

    builder.Add (geom.shape, 
		 BRepAlgoAPI_Cut 
		 (BRepAlgoAPI_Cut (geom.somap(2), dom6plus),
		  dom8plus));
    // builder.Add (geom.shape, fix_dom2m8.Shape());
    //     builder.Add (geom.shape, fixshape.Shape());
    */

    TopoDS_Shape my_fuse;
    int cnt = 0;
    for (TopExp_Explorer exp_solid(geom.shape, TopAbs_SOLID); exp_solid.More(); exp_solid.Next())
      {
	if (cnt == 0)
	  my_fuse = exp_solid.Current();
	else
	  {
	    cout << "fuse, cnt = " << cnt << endl;
	    if (cnt != 7 && cnt != 9)
	      my_fuse = BRepAlgoAPI_Fuse (my_fuse, exp_solid.Current());
	  }
	cnt++;
      }
    builder.Add (geom.shape, my_fuse);

    /*
    ShapeUpgrade_ShellSewing ss;
    ss.ApplySewing(geom.shape,1e5);
    */

    /*
    BRepAlgo_Sewing sewing(1.e5);
    
    int cnt = 0;
    for (TopExp_Explorer exp_solid(geom.shape, TopAbs_SOLID); exp_solid.More(); exp_solid.Next())
      {
	cout << "swe, cnt = " << cnt << endl;
	if (cnt != 7 && cnt != 9)
	  sewing.Add (exp_solid.Current());
	cnt++;
      }

    sewing.Perform();
    builder.Add (geom.shape, sewing.SewedShape());
    */


    /*
    cout << "build air domain" << endl;
    TopoDS_Shape air = BRepAlgoAPI_Cut (TopoDS_Solid (mbox), my_fuse);

    cnt = 0;
    for (TopExp_Explorer exp_solid(geom.shape, TopAbs_SOLID); exp_solid.More(); exp_solid.Next())
      {
	cout << "section, cnt = " << cnt << endl;
	if (cnt == 7)
	  {
	    builder.Add (geom.shape, 
			 BRepAlgoAPI_Section (air, exp_solid.Current()));
	  }
	cnt++;
      }
    */



    //    builder.Add (geom.shape, air);
    for (int i = 1; i <= 10; i++)
      builder.Remove (geom.shape, geom.somap(i));




    geom.BuildFMap();
    geom.BuildVisualizationMesh();
    geom.changed = 1;
#endif

  }
}


#endif