GithubHelp home page GithubHelp logo

cambrian-chen / web-ifc-viewer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thatopen/web-ifc-viewer

0.0 1.0 0.0 48.79 MB

Graphics engine and toolkit for client applications.

License: MIT License

JavaScript 96.70% TypeScript 3.26% CSS 0.03% HTML 0.01%

web-ifc-viewer's Introduction

ifc.js | documentation | demo | discord | usage example | npm package

web-ifc-viewer

npm opencollective

This library is an extension of web-ifc-three, which is the official IFCLoader for THREE.js. This doesn't only parse and generate the Three.js geometry of IFC models in JavaScript, but also provides multiple tools to easily build BIM tools, such as 3d dimensions, clipping planes, 2D plan navigation and generation, etc.

Status

web-ifc-viewer offers multiple tools to create awesome BIM tools in no time. While the tools are quite stable, the state of this repository is tightly coupled with the state of web-ifc-three and web-ifc.

Check out their README files to better understand where the project currently is.

Demo

Test IFC.js Web IFCviewer with your IFC models in our online Demo

Documentation

Check out our official docs for API reference, guides and tutorials.

Install

npm install web-ifc-viewer or yarn add web-ifc-viewer

Quick setup

First, create a JavaScript file that imports the library and creates a scene:

import { IfcViewerAPI } from 'web-ifc-viewer';

const container = document.getElementById('viewer-container');
const viewer = new IfcViewerAPI({ container });
viewer.axes.setAxes();
viewer.grid.setGrid();

const input = document.getElementById("file-input");

input.addEventListener("change",

  async (changed) => {
   
    const file = changed.target.files[0];
    const ifcURL = URL.createObjectURL(file);
    viewer.IFC.loadIfcUrl(ifcURL);
  },

  false
);

You can bundle this file using any bundler. This is an example configuration file using rollup:

import resolve from '@rollup/plugin-node-resolve';

export default {
  input: 'index.js',
  output: {
    file: "bundle.js",
    format: 'esm'
  },
  plugins: [ resolve() ]
};

Now you display it in an HTML page like this:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link rel="icon" type="image/png" href="./favicon.ico" />
    <link rel="preconnect" href="https://fonts.gstatic.com" />
    <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="./styles.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>IFC.js</title>
  </head>
  <body>
    <input type="file" id="file-input" accept=".ifc, .ifcXML, .ifcZIP">
    <div id="viewer-container"></div>
    <script src="./bundle.js"></script>
  </body>
</html>

Content

This project consists of the following folders:

  • viewer: contains the source code.

  • example: contains one example of how to use the library.

Contributing

Want to help out? Great!

Please checkout our contribution suggestsions or speak to us directly in Discord.

web-ifc-viewer's People

Contributors

agviegas avatar apemann avatar bragamat avatar brifitz avatar craigliesinger avatar eng-luciano-julien avatar gp4ck avatar harrycollin avatar jmcouffin avatar jvdmbgdd avatar lmeow avatar mudin avatar sinsunsan avatar tiberiog avatar tonyk24 avatar vegarringdal avatar zegeri avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.