-
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.
feat: enable creation of curtain walls (#18)
* Enabled creation of plates * Enabled creation of members and began curtain wall feature * Enable basic functionality for generation of curtain wall elements * Fixed bug in curtain wall generation algorithm * Cleaned algorithm and fixed other bugs * separated algorithm into instantiation and updates * fixed bug when instantiating geomtry --------- Co-authored-by: cristian sotomayor <[email protected]>
- Loading branch information
1 parent
906c8ce
commit 9d5a080
Showing
14 changed files
with
996 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" | ||
/> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
<link rel="stylesheet" href="../../../../resources/styles.css" /> | ||
<link | ||
rel="stylesheet" | ||
href="https://fonts.googleapis.com/icon?family=Material+Icons" | ||
/> | ||
<link | ||
rel="icon" | ||
type="image/x-icon" | ||
href="../../../../resources/favicon.ico" | ||
/> | ||
<title>Tools Component</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.full-screen { | ||
width: 100vw; | ||
height: 100vh; | ||
position: relative; | ||
overflow: hidden; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="full-screen" id="container"></div> | ||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"three": "https://unpkg.com/[email protected]/build/three.module.js", | ||
"openbim-components": "https://thatopen.github.io/engine_components/resources/openbim-components.js", | ||
"openbim-clay": "../../../../resources/openbim-clay.js", | ||
"web-ifc": "https://unpkg.com/[email protected]/web-ifc-api.js", | ||
"stats.js/src/Stats.js": "https://unpkg.com/[email protected]/src/Stats.js", | ||
"three/examples/jsm/libs/lil-gui.module.min": "https://unpkg.com/[email protected]/examples/jsm/libs/lil-gui.module.min.js", | ||
"three/examples/jsm/controls/TransformControls": "https://unpkg.com/[email protected]/examples/jsm/controls/TransformControls.js" | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> | ||
<script type="module"> | ||
import * as THREE from "three"; | ||
import * as OBC from "openbim-components"; | ||
import * as CLAY from "openbim-clay"; | ||
import * as WEBIFC from "web-ifc"; | ||
|
||
import Stats from "stats.js/src/Stats.js"; | ||
import * as dat from "three/examples/jsm/libs/lil-gui.module.min"; | ||
import { TransformControls } from "three/examples/jsm/controls/TransformControls"; | ||
|
||
const container = document.getElementById("container"); | ||
|
||
const components = new OBC.Components(); | ||
|
||
components.scene = new OBC.SimpleScene(components); | ||
components.renderer = new OBC.PostproductionRenderer(components, container); | ||
components.camera = new OBC.SimpleCamera(components); | ||
components.raycaster = new OBC.SimpleRaycaster(components); | ||
|
||
components.init(); | ||
|
||
components.renderer.postproduction.enabled = true; | ||
|
||
const scene = components.scene.get(); | ||
|
||
components.camera.controls.setLookAt(3, 3, 3, 0, 0, 0); | ||
|
||
components.scene.setup(); | ||
|
||
const grid = new OBC.SimpleGrid(components, new THREE.Color(0x666666)); | ||
|
||
const customEffects = components.renderer.postproduction.customEffects; | ||
customEffects.excludedMeshes.push(grid.get()); | ||
|
||
const axesHelper = new THREE.AxesHelper(1); | ||
scene.add(axesHelper); | ||
|
||
// IFC API | ||
|
||
const model = new CLAY.Model(); | ||
model.ifcAPI.SetWasmPath("https://unpkg.com/[email protected]/", true); | ||
await model.init(); | ||
|
||
const curtainWallType = new CLAY.SimpleCurtainWallType(model, 5, 5); | ||
|
||
curtainWallType.height = 5 | ||
curtainWallType.startPoint.x = -10; | ||
curtainWallType.startPoint.y = 0; | ||
curtainWallType.endPoint.x = 0; | ||
curtainWallType.endPoint.y = 10; | ||
|
||
curtainWallType.update(true); | ||
|
||
const curtainWall = curtainWallType.addInstance(); | ||
|
||
scene.add(...curtainWall.meshes); | ||
|
||
const gui = new dat.GUI(); | ||
|
||
gui | ||
.add(curtainWallType.startPoint, "x") | ||
.name("Start X") | ||
.min(-10) | ||
.max(10) | ||
.step(1) | ||
.onChange(() => { | ||
curtainWallType.update(true); | ||
}); | ||
|
||
gui | ||
.add(curtainWallType.startPoint, "y") | ||
.name("Start Y") | ||
.min(-10) | ||
.max(10) | ||
.step(1) | ||
.onChange(() => { | ||
curtainWallType.update(true); | ||
}); | ||
|
||
|
||
gui | ||
.add(curtainWallType.endPoint, "x") | ||
.name("End X") | ||
.min(-10) | ||
.max(10) | ||
.step(1) | ||
.onChange(() => { | ||
curtainWallType.update(true); | ||
}); | ||
|
||
gui | ||
.add(curtainWallType.endPoint, "y") | ||
.name("End Y") | ||
.min(-10) | ||
.max(10) | ||
.step(1) | ||
.onChange(() => { | ||
curtainWallType.update(true); | ||
}); | ||
|
||
gui | ||
.add(curtainWallType, "height") | ||
.name("Height") | ||
.min(1) | ||
.max(10) | ||
.step(1) | ||
.onChange(() => { | ||
curtainWallType.update(true); | ||
}); | ||
|
||
gui.add(curtainWallType, "frameWidth").name("Frame Width").min(0.127).max(1).step(0.01).onChange(() => { | ||
curtainWallType.update(true); | ||
}); | ||
|
||
</script> |
Oops, something went wrong.