|
| 1 | +<p align="center"> |
| 2 | + <a href="https://thatopen.com/">TOC</a> |
| 3 | + | |
| 4 | + <a href="https://docs.thatopen.com/intro">documentation</a> |
| 5 | + | |
| 6 | + <a href="https://thatopen.github.io/engine_components/examples/IfcLoader/index.html">demo</a> |
| 7 | + | |
| 8 | + <a href="https://people.thatopen.com/">community</a> |
| 9 | + | |
| 10 | + <a href="https://www.npmjs.com/org/thatopen">npm package</a> |
| 11 | +</p> |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +<h1>Open BIM Components <img src="https://thatopen.github.io/engine_components/resources/favicon.ico" width="32"/></h1> |
| 16 | + |
| 17 | +[![NPM Package][npm]][npm-url] |
| 18 | +[![NPM Package][npm-downloads]][npm-url] |
| 19 | + |
| 20 | +This library is a collection of BIM tools based on [Three.js](https://github.com/mrdoob/three.js/) and other libraries. It includes pre-made features to easily build browser-based 3D BIM applications, such as postproduction, dimensions, floorplan navigation, DXF export and much more. |
| 21 | + |
| 22 | + |
| 23 | +## 🤝 Want our help? |
| 24 | +Are you developing a project with our technology and would like our help? |
| 25 | +Apply now to join [That Open Accelerator Program](https://thatopen.com/accelerator)! |
| 26 | + |
| 27 | +## Packages |
| 28 | + |
| 29 | +This library contains 2 packages: |
| 30 | + |
| 31 | +`@thatopen/components` - The core functionality. Compatible both with browser and Node.js environments. |
| 32 | + |
| 33 | +`@thatopen/components-front` - Features exclusive for browser environments. |
| 34 | + |
| 35 | +## Usage |
| 36 | + |
| 37 | +You need to be familiar with [Three.js API](https://github.com/mrdoob/three.js/) to be able to use this library effectively. In the following example, we will create a cube in a 3D scene that can be navigated with the mouse or touch events. You can see the full example [here](https://github.com/ThatOpen/engine_components/blob/main/packages/core/src/core/Worlds/example.ts) and the deployed app [here](https://thatopen.github.io/engine_components/examples/Worlds/index.html). |
| 38 | + |
| 39 | +```js |
| 40 | +/* eslint import/no-extraneous-dependencies: 0 */ |
| 41 | + |
| 42 | +import * as THREE from "three"; |
| 43 | +import * as OBC from "../.."; |
| 44 | + |
| 45 | +const container = document.getElementById("container")!; |
| 46 | + |
| 47 | +const components = new OBC.Components(); |
| 48 | + |
| 49 | +const worlds = components.get(OBC.Worlds); |
| 50 | + |
| 51 | +const world = worlds.create< |
| 52 | + OBC.SimpleScene, |
| 53 | + OBC.SimpleCamera, |
| 54 | + OBC.SimpleRenderer |
| 55 | +>(); |
| 56 | + |
| 57 | +world.scene = new OBC.SimpleScene(components); |
| 58 | +world.renderer = new OBC.SimpleRenderer(components, container); |
| 59 | +world.camera = new OBC.SimpleCamera(components); |
| 60 | + |
| 61 | +components.init(); |
| 62 | + |
| 63 | +const material = new THREE.MeshLambertMaterial({ color: "#6528D7" }); |
| 64 | +const geometry = new THREE.BoxGeometry(); |
| 65 | +const cube = new THREE.Mesh(geometry, material); |
| 66 | +world.scene.three.add(cube); |
| 67 | + |
| 68 | +world.scene.setup(); |
| 69 | + |
| 70 | +world.camera.controls.setLookAt(3, 3, 3, 0, 0, 0); |
| 71 | +``` |
| 72 | + |
| 73 | + |
| 74 | +[npm]: https://img.shields.io/npm/v/@thatopen/components |
| 75 | +[npm-url]: https://www.npmjs.com/package/@thatopen/components |
| 76 | +[npm-downloads]: https://img.shields.io/npm/dw/@thatopen/components |
0 commit comments