@@ -3,6 +3,7 @@ import * as BUI from "@thatopen/ui";
33import Stats from "stats.js" ;
44import * as OBC from "@thatopen/components" ;
55
6+ import * as WEBIFC from "web-ifc" ;
67import * as CLAY from "../../.." ;
78
89const container = document . getElementById ( "container" ) ! ;
@@ -33,7 +34,7 @@ model.wasm = { path: "https://unpkg.com/
[email protected] /", absolute: true };
3334await model . init ( ) ;
3435
3536const simpleWallType = new CLAY . SimpleWallType ( model ) ;
36- //
37+
3738const wall1 = simpleWallType . addInstance ( ) ;
3839world . scene . three . add ( ...wall1 . meshes ) ;
3940wall1 . startPoint = new THREE . Vector2 ( 1 , 1 ) ;
@@ -96,48 +97,48 @@ const panel = BUI.Component.create<BUI.PanelSection>(() => {
9697 return BUI . html `
9798 < bim-panel label ="Simple Walls Tutorial " class ="options-menu ">
9899 < bim-panel-section collapsed label ="Controls ">
99-
100+
100101 < div style ="display: flex; gap: 12px ">
101-
102+
102103 < bim-number-input slider step ="0.1 " label ="Start X " vertical ="true " value ="${ wall1 . startPoint . x } " @change ="${ (
103104 event : any ,
104105 ) => {
105106 wall1 . startPoint . x = event . target . value ;
106107 wall1 . update ( true ) ;
107108 simpleWallType . updateCorners ( ) ;
108109 } } "> </ bim-number-input >
109-
110+
110111 < bim-number-input slider step ="0.1 " label ="Start Y " vertical ="true " value ="${ wall1 . startPoint . y } " @change ="${ (
111112 event : any ,
112113 ) => {
113114 wall1 . startPoint . y = event . target . value ;
114115 wall1 . update ( true ) ;
115116 simpleWallType . updateCorners ( ) ;
116117 } } "> </ bim-number-input >
117-
118+
118119 </ div >
119-
120+
120121 < div style ="display: flex; gap: 12px ">
121-
122+
122123 < bim-number-input slider step ="0.1 " label ="End X " vertical ="true " value ="${ wall1 . endPoint . x } " @change ="${ (
123124 event : any ,
124125 ) => {
125126 wall1 . endPoint . x = event . target . value ;
126127 wall1 . update ( true ) ;
127128 simpleWallType . updateCorners ( ) ;
128129 } } "> </ bim-number-input >
129-
130+
130131 < bim-number-input slider step ="0.1 " label ="End Y " vertical ="true " value ="${ wall1 . endPoint . y } " @change ="${ (
131132 event : any ,
132133 ) => {
133134 wall1 . endPoint . y = event . target . value ;
134135 wall1 . update ( true ) ;
135136 simpleWallType . updateCorners ( ) ;
136137 } } "> </ bim-number-input >
137-
138-
138+
139+
139140 </ div >
140-
141+
141142 < bim-number-input slider step ="0.05 " label ="Elevation " value ="${ wall1 . elevation } " @change ="${ (
142143 event : any ,
143144 ) => {
@@ -147,7 +148,7 @@ const panel = BUI.Component.create<BUI.PanelSection>(() => {
147148 wall1 . update ( true ) ;
148149 simpleWallType . updateCorners ( ) ;
149150 } } "> </ bim-number-input >
150-
151+
151152 < bim-number-input slider step ="0.01 " label ="Offset " value ="${ wall1 . offset } " @change ="${ (
152153 event : any ,
153154 ) => {
@@ -157,23 +158,23 @@ const panel = BUI.Component.create<BUI.PanelSection>(() => {
157158 wall2 . update ( true ) ;
158159 simpleWallType . updateCorners ( ) ;
159160 } } "> </ bim-number-input >
160-
161+
161162 < bim-number-input slider step ="0.05 " label ="Thickness " value ="${ simpleWallType . width } " @change ="${ (
162163 event : any ,
163164 ) => {
164165 simpleWallType . width = event . target . value ;
165166 simpleWallType . update ( true ) ;
166167 simpleWallType . updateCorners ( ) ;
167- } } "> </ bim-number-input >
168-
168+ } } "> </ bim-number-input >
169+
169170 < bim-number-input slider step ="0.05 " label ="Height " value ="${ wall1 . height } " @change ="${ (
170171 event : any ,
171172 ) => {
172173 wall1 . height = event . target . value ;
173174 wall1 . update ( true ) ;
174175 simpleWallType . updateCorners ( ) ;
175176 } } "> </ bim-number-input >
176-
177+
177178 </ bim-panel-section >
178179 </ bim-panel >
179180 ` ;
@@ -199,26 +200,21 @@ document.body.append(button);
199200
200201// window.addEventListener("keydown", async (e) => {
201202// if (e.code === "KeyP") {
202- // const directoryHandle = await window.showDirectoryPicker();
203- // async function writeIFC() {
204- // const buffer = model.ifcAPI.SaveModel(model.modelID);
205- //
206- // console.log(buffer);
207- //
208- // const fileName = "example.ifc";
209- // const fileHandle = await directoryHandle.getFileHandle("example.ifc", {
210- // create: true,
211- // });
212- //
213- // // Create a FileSystemWritableFileStream to write to.
214- // const writable = await fileHandle.createWritable();
215- // await writable.truncate(0);
216- // // Write the contents of the file to the stream.
217- // await writable.write(buffer);
218- // // Close the file and write the contents to disk.
219- // await writable.close();
203+ // simpleWallType.attributes = {};
204+ // console.log("hey");
205+ // if (model._modelID === undefined) {
206+ // throw new Error("Malformed model!");
220207// }
208+ // // TODO: Fix memory leak
209+ // const asdf = model._ifcAPI.SaveModel(model._modelID);
210+ //
211+ // model._ifcAPI.Dispose();
212+ // model._ifcAPI = null as any;
213+ // model._ifcAPI = new WEBIFC.IfcAPI();
221214//
222- // setInterval(() => writeIFC(), 1000);
215+ // await model.init();
216+ // model._modelID = model._ifcAPI.OpenModel(asdf, {
217+ // TAPE_SIZE: 5000000, // 5MB
218+ // });
223219// }
224220// });
0 commit comments