0022886: Bug in Boolean
[occt.git] / tests / bugs / modalg_7 / bug22750
1 puts "========"
2 puts "OCC22750"
3 puts "========"
4 puts ""
5 #######################################################
6 # Boolean operation: Bug in Fuse
7 #######################################################
8
9 # Step 1: Create surface wing
10
11 # Create sections as ellipses 2D (possible to create directly in 3D)
12 ellipse e1 0 0 30 20
13 ellipse e2 0 0  20 10
14 ellipse e3  0 0 16 8
15
16 # Convert 2d Curves in 3d Curves, and place them along Z axis
17 to3d ee1 e1
18 to3d ee2 e2; translate ee2 0 0 100
19 to3d ee3 e3; translate ee3 0 0 200
20
21 rotate ee2 0 0 100 0 1 0 10
22 rotate ee3 0 0 200 0 1 0 20
23
24 #Approximate the ellipses by Bsplines
25 appro c1 16 ee1
26 appro c2 16 ee2
27 appro c3 16 ee3
28
29 #Make a surface by approximation passing throught a set of curves
30 # and create a face
31 appsurf s1 c1 c2 c3
32 mkface f1 s1
33
34 #Make a surface by approximation passing throught a set of ellipse
35 # and create a face
36 appsurf s2 ee1 ee2 ee3
37 mkface f2 s2
38
39 # Step 2: Create surface for fuselage
40
41 #Create circles in 3D along axe X
42 circle c1 -100 0 0 1 0 0 10
43 circle c2 -50 0 0 1 0 0 30
44 circle c3 50 0 0 1 0 0  29
45 circle c4 100 0 0 1 0 0 20
46 circle c5 150 0 0 1 0 0 10
47
48 #Make a surface by approximation passing throught a set of circles
49 # and create a face
50 appsurf s3 c1 c2 c3 c4 c5
51 mkface f3 s3
52
53
54 # Step 3: Create a Solid for the Wing
55 # Build edges from ellipse, wires with edges, faces on wires
56 # It's necessary to sew the faces to create the Shell, because the faces don't shared the same edge
57 #sewing will create a shell, it remains to create the solid from the shell
58
59 mkedge ed1 ee1
60 mkedge ed3 ee3
61
62 wire w1 ed1
63 wire w3 ed3
64
65 mkplane f5 w1
66 mkplane f6 w3
67
68 sewing r f2 f5 f6
69 ###mksol so1 r
70 shape so1 So
71 add r so1
72
73 checkshape so1
74 # The shape so1 is valid
75
76 #Step 4: Create a Solid for fuselage
77 # We will extract the edge from the face f3, and use them to buid faces, the edge will be shared and we 
78 # can rebuild a sh and a solid with the basic and fast method
79
80 nexplode f3 e
81 #nexplode give same order of exploration in different sessions
82
83 wire w1 f3_1
84 wire w3 f3_3
85 mkplane f7 w1 1
86 mkplane f8 w3 1
87
88 mkvolume so2 f3 f7 f8 -ni
89 checkshape so2
90
91 # Step 5: Fuse the Wing to the fuselage
92 ttranslate so1 0 0 10
93 bop so1 so2
94 bopfuse rrr
95
96 checkshape rrr
97 checknbshapes rrr -face 5 -wire 5 -shell 1 -solid 1
98 checkprops rrr -s 57448.9 -v 664969
99
100 # Step 6: Create the othe wing using copy and rotation
101 tcopy so1 so3
102 trotate so3 0 0 0 1 0 0 180
103
104 # Step 7: Fuse the Wing to the fuselage
105 bop rrr so3
106 bopfuse result
107
108 checkshape result
109 checknbshapes result -wire 8 -face 7 -shell 1 -solid 1
110 checkprops result -s 73752.9 -v 784375
111
112 checkview -display result -2d -path ${imagedir}/${test_image}-2d.png