-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import * as BUI from "@thatopen/ui"; | |
import Stats from "stats.js"; | ||
import * as OBC from "@thatopen/components"; | ||
|
||
import * as WEBIFC from "web-ifc"; | ||
import * as CLAY from "../../.."; | ||
|
||
const container = document.getElementById("container")!; | ||
|
@@ -33,7 +34,7 @@ model.wasm = { path: "https://unpkg.com/[email protected]/", absolute: true }; | |
await model.init(); | ||
|
||
const simpleWallType = new CLAY.SimpleWallType(model); | ||
// | ||
|
||
const wall1 = simpleWallType.addInstance(); | ||
world.scene.three.add(...wall1.meshes); | ||
wall1.startPoint = new THREE.Vector2(1, 1); | ||
|
@@ -96,48 +97,48 @@ const panel = BUI.Component.create<BUI.PanelSection>(() => { | |
return BUI.html` | ||
<bim-panel label="Simple Walls Tutorial" class="options-menu"> | ||
<bim-panel-section collapsed label="Controls"> | ||
<div style="display: flex; gap: 12px"> | ||
<bim-number-input slider step="0.1" label="Start X" vertical="true" value="${wall1.startPoint.x}" @change="${( | ||
event: any, | ||
) => { | ||
wall1.startPoint.x = event.target.value; | ||
wall1.update(true); | ||
simpleWallType.updateCorners(); | ||
}}"></bim-number-input> | ||
<bim-number-input slider step="0.1" label="Start Y" vertical="true" value="${wall1.startPoint.y}" @change="${( | ||
event: any, | ||
) => { | ||
wall1.startPoint.y = event.target.value; | ||
wall1.update(true); | ||
simpleWallType.updateCorners(); | ||
}}"></bim-number-input> | ||
</div> | ||
<div style="display: flex; gap: 12px"> | ||
<bim-number-input slider step="0.1" label="End X" vertical="true" value="${wall1.endPoint.x}" @change="${( | ||
event: any, | ||
) => { | ||
wall1.endPoint.x = event.target.value; | ||
wall1.update(true); | ||
simpleWallType.updateCorners(); | ||
}}"></bim-number-input> | ||
<bim-number-input slider step="0.1" label="End Y" vertical="true" value="${wall1.endPoint.y}" @change="${( | ||
event: any, | ||
) => { | ||
wall1.endPoint.y = event.target.value; | ||
wall1.update(true); | ||
simpleWallType.updateCorners(); | ||
}}"></bim-number-input> | ||
</div> | ||
<bim-number-input slider step="0.05" label="Elevation" value="${wall1.elevation}" @change="${( | ||
event: any, | ||
) => { | ||
|
@@ -147,7 +148,7 @@ const panel = BUI.Component.create<BUI.PanelSection>(() => { | |
wall1.update(true); | ||
simpleWallType.updateCorners(); | ||
}}"></bim-number-input> | ||
<bim-number-input slider step="0.01" label="Offset" value="${wall1.offset}" @change="${( | ||
event: any, | ||
) => { | ||
|
@@ -157,23 +158,23 @@ const panel = BUI.Component.create<BUI.PanelSection>(() => { | |
wall2.update(true); | ||
simpleWallType.updateCorners(); | ||
}}"></bim-number-input> | ||
<bim-number-input slider step="0.05" label="Thickness" value="${simpleWallType.width}" @change="${( | ||
event: any, | ||
) => { | ||
simpleWallType.width = event.target.value; | ||
simpleWallType.update(true); | ||
simpleWallType.updateCorners(); | ||
}}"></bim-number-input> | ||
}}"></bim-number-input> | ||
<bim-number-input slider step="0.05" label="Height" value="${wall1.height}" @change="${( | ||
event: any, | ||
) => { | ||
wall1.height = event.target.value; | ||
wall1.update(true); | ||
simpleWallType.updateCorners(); | ||
}}"></bim-number-input> | ||
</bim-panel-section> | ||
</bim-panel> | ||
`; | ||
|
@@ -199,26 +200,21 @@ document.body.append(button); | |
|
||
// window.addEventListener("keydown", async (e) => { | ||
// if (e.code === "KeyP") { | ||
// const directoryHandle = await window.showDirectoryPicker(); | ||
// async function writeIFC() { | ||
// const buffer = model.ifcAPI.SaveModel(model.modelID); | ||
// | ||
// console.log(buffer); | ||
// | ||
// const fileName = "example.ifc"; | ||
// const fileHandle = await directoryHandle.getFileHandle("example.ifc", { | ||
// create: true, | ||
// }); | ||
// | ||
// // Create a FileSystemWritableFileStream to write to. | ||
// const writable = await fileHandle.createWritable(); | ||
// await writable.truncate(0); | ||
// // Write the contents of the file to the stream. | ||
// await writable.write(buffer); | ||
// // Close the file and write the contents to disk. | ||
// await writable.close(); | ||
// simpleWallType.attributes = {}; | ||
// console.log("hey"); | ||
// if (model._modelID === undefined) { | ||
// throw new Error("Malformed model!"); | ||
// } | ||
// // TODO: Fix memory leak | ||
// const asdf = model._ifcAPI.SaveModel(model._modelID); | ||
// | ||
// model._ifcAPI.Dispose(); | ||
// model._ifcAPI = null as any; | ||
// model._ifcAPI = new WEBIFC.IfcAPI(); | ||
// | ||
// setInterval(() => writeIFC(), 1000); | ||
// await model.init(); | ||
// model._modelID = model._ifcAPI.OpenModel(asdf, { | ||
// TAPE_SIZE: 5000000, // 5MB | ||
// }); | ||
// } | ||
// }); |