@@ -40,31 +40,50 @@ function App() {
40
40
const firstRenderRef = useRef ( true ) ;
41
41
42
42
useEffect ( ( ) => {
43
- // if (firstRenderRef.current) {
44
- // firstRenderRef.current = false;
45
- // return;
46
- // }
43
+ if ( process . env . REACT_APP_ENVIRONMENT !== 'production' &&
44
+ firstRenderRef . current ) {
45
+ firstRenderRef . current = false ;
46
+ return ;
47
+ }
47
48
init ( ) ;
48
49
} , [ ] )
49
50
50
51
const createVaseByLoft = async ( bitbybit ?: BitByBitOCCT , scene ?: THREE . Scene ) => {
51
52
if ( scene && bitbybit ) {
52
- const wire1 = await bitbybit . occt . shapes . wire . createCircleWire ( { radius : 10 + addRadiusNarrow , center : [ 0 , 0 , 0 ] , direction : [ 0 , 1 , 0 ] } ) ;
53
- const wire2 = await bitbybit . occt . shapes . wire . createEllipseWire ( { radiusMinor : 20 + addRadiusWide , radiusMajor : 25 + addRadiusWide , center : [ 0 , 20 + addMiddleHeight , 0 ] , direction : [ 0 , 1 , 0 ] } ) ;
54
- const wire3 = await bitbybit . occt . shapes . wire . createCircleWire ( { radius : 10 + addRadiusNarrow , center : [ 0 , 30 + addMiddleHeight , 0 ] , direction : [ 0 , 1 , 0 ] } ) ;
55
- const wire4 = await bitbybit . occt . shapes . wire . createCircleWire ( { radius : 15 + addRadiusWide , center : [ 0 , 40 + addMiddleHeight + addTopHeight , 0 ] , direction : [ 0 , 1 , 0.1 ] } ) ;
53
+ const wire1 = await bitbybit . occt . shapes . wire . createCircleWire ( {
54
+ radius : 10 + addRadiusNarrow ,
55
+ center : [ 0 , 0 , 0 ] ,
56
+ direction : [ 0 , 1 , 0 ]
57
+ } ) ;
58
+ const wire2 = await bitbybit . occt . shapes . wire . createEllipseWire ( {
59
+ radiusMinor : 20 + addRadiusWide ,
60
+ radiusMajor : 25 + addRadiusWide ,
61
+ center : [ 0 , 20 + addMiddleHeight , 0 ] ,
62
+ direction : [ 0 , 1 , 0 ]
63
+ } ) ;
64
+ const wire3 = await bitbybit . occt . shapes . wire . createCircleWire ( {
65
+ radius : 10 + addRadiusNarrow ,
66
+ center : [ 0 , 30 + addMiddleHeight , 0 ] ,
67
+ direction : [ 0 , 1 , 0 ]
68
+ } ) ;
69
+ const wire4 = await bitbybit . occt . shapes . wire . createCircleWire ( {
70
+ radius : 15 + addRadiusWide ,
71
+ center : [ 0 , 40 + addMiddleHeight + addTopHeight , 0 ] ,
72
+ direction : [ 0 , 1 , 0.1 ]
73
+ } ) ;
56
74
const lAdvOpt = new Inputs . OCCT . LoftAdvancedDto ( [ wire1 , wire2 , wire3 , wire4 ] ) ;
57
75
const loft = await bitbybit . occt . operations . loftAdvanced ( lAdvOpt ) ;
58
76
const loftFace = await bitbybit . occt . shapes . face . getFace ( { shape : loft , index : 0 } ) ;
59
77
const baseFace = await bitbybit . occt . shapes . face . createFaceFromWire ( { shape : wire1 , planar : true } ) ;
60
78
const shell = await bitbybit . occt . shapes . shell . sewFaces ( { shapes : [ loftFace , baseFace ] , tolerance : 1e-7 } ) ;
61
79
const fillet = await bitbybit . occt . fillets . filletEdges ( { shape : shell , radius : 10 } ) ;
62
80
const thick = await bitbybit . occt . operations . makeThickSolidSimple ( { shape : fillet , offset : - 2 } )
63
- const chamfer = await bitbybit . occt . fillets . chamferEdges ( { shape : thick , distance : 0.3 } ) ;
81
+ const vase = await bitbybit . occt . fillets . chamferEdges ( { shape : thick , distance : 0.3 } ) ;
82
+
83
+ const group = await addShapeToScene ( bitbybit , vase , scene , 0.05 ) ;
64
84
65
- const group = await addShapeToScene ( bitbybit , chamfer , scene , 0.05 ) ;
66
85
setGroup ( group ) ;
67
- setVase ( chamfer ) ;
86
+ setVase ( vase ) ;
68
87
}
69
88
}
70
89
0 commit comments