Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Multi-Format Pipeline #2

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,28 @@ This project provides a Node.js script that automatically runs a directory of IF
We can also use this project to test the conversion pipelines locally.

## Install

````npm install````
````bash
npm install
````

## Configure

Install the CLI tools we'll use in our conversion pipelines: IfcConvert, xeokit-metadata, ifc2gltf and convert2xkt.
Install the CLI tools that are required in the conversion pipelines: IfcConvert, xeokit-metadata, ifc2gltf and convert2xkt.

Then configure ````./convertconfig.json```` with paths to those tools - for example:
You can download pre-build packages here:
- IfcConvert: https://blenderbim.org/docs-python/ifcconvert/installation.html
- xeokit-metadata: https://github.com/bimspot/xeokit-metadata/releases
- ifc2gltf: https://github.com/Creoox/creoox-ifc2gltfcxconverter/releases

You might have to install some dependencies for the CLI tools to work.
- xeonet-metadata requires the .NET runtime. Installation instructions for Ubuntu:
https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu
- ifc2gltf requires c++ libraries. You can install them using the GNU Compiler Collection (GCC) suite.
````bash
sudo apt install build-essential
````

Configure `./convertconfig.json` with paths to those tools - for example:
````json
{
"paths": {
Expand All @@ -28,11 +40,10 @@ Then configure ````./convertconfig.json```` with paths to those tools - for exam

## Drop in your IFC Files

Drop the IFC files you want to convert into ````./inputFiles````.
Drop the IFC files you want to convert into `./inputFiles`.

For example:

````bash
````text
./inputFiles/
├── Archicad
│ ├── Archicad-Demoprojekt.ifc
Expand All @@ -49,12 +60,14 @@ For example:

Run the test script and build the HTML pages:

```npm run build```
````bash
npm run build
````

## Review results

When the test script has finished, the ````./results```` directory will contain converted XKT files, along with intermediate glTF and JSON files created by some of the pipelines. The directory will also contain logging output collected from the CLI tools.
````bash
When the test script has finished, the `./results` directory will contain converted XKT files, along with intermediate glTF and JSON files created by some of the pipelines. The directory will also contain logging output collected from the CLI tools.
````text
./results/
├── Archicad
│ ├── Archicad-Demoprojekt
Expand Down Expand Up @@ -137,9 +150,9 @@ When the test script has finished, the ````./results```` directory will contain

To review the test results, fire up an HTTP server:

````http-server````
`http-server`

Go to ````localhost:8080/index.html````:
Go to `localhost:8080/index.html`:


![](https://xeokit.github.io/img/modelConversionWebsite.png)
Expand Down
176 changes: 98 additions & 78 deletions _pages/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<meta content="xeokit - SDK for Browser-Based 3D BIM Visualization" name="description">
<meta content="Lindsay Kay" name="author">
<meta content="BIM,IFC,WebGL,JavaScript,Browser,BCF,Web,xeolabs,3D,3D Viewer,Lindsay Kay,xeokit,MedViz,ArchViz,Open Source,Browser,Viewer"
name="keywords">
<meta content="BIM,IFC,WebGL,JavaScript,Browser,BCF,Web,xeolabs,3D,3D Viewer,Lindsay Kay,xeokit,MedViz,ArchViz,Open Source,Browser,Viewer" name="keywords">

<title>xeokit - 3D Web Programming Toolkit for BIM and Engineering Visualization</title>

Expand All @@ -23,79 +22,82 @@

<body data-offset="50" data-spy="scroll" data-target=".navbar">

<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top ">
<span style="color: #ffffff;"><a class="navbar-home" href="http://xeolabs.com">xeolabs</a>/<a class="navbar-parent"
href="https://xeokit.io">xeokit&nbsp;SDK</a>/<a
class="navbar-parent" href="./index.html">Model Conversion</a>/<a class="navbar-parent" href="./tests.html">Tests</a>/</span><span
class="navbar-brand" href="./index.html">View IFC</span>
<!-- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">-->
<!-- <span class="navbar-toggler-icon"></span>-->
<!-- </button>-->
<!-- <div class="collapse navbar-collapse" id="navbarResponsive">-->
<!-- <ul class="navbar-nav ml-auto">-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="./index.html?foo=0">Home</a>-->
<!-- </li>-->
<!-- <li class="nav-item dropdown">-->
<!-- <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownDemos" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Demos </a>-->
<!-- <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownLearn">-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=RevitSamples&tab=models">Revit Sample IFC Model</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=MAPPointCloud">1.6M Point Cloud Model</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=MAP&tab=objects">Full-Precision IFC Model</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=OTCConferenceCenter&tab=storeys">Conference Center Model</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=Schependomlaan&tab=storeys">Schependomlaan Model</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=Schependomlaan_selectedStorey&tab=storeys">Schependomlaan Ground Floor</a>-->
<!-- </div>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.io/index.html?foo=1#features">Features</a>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.io/index.html?foo=1#faq">FAQ</a>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.io/blog.html">Blog</a>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.github.io/xeokit-sdk/examples/" target="_demos">Examples</a>-->
<!-- </li>-->
<!-- <li class="nav-item dropdown">-->
<!-- <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownLearn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Developers </a>-->
<!-- <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownLearn">-->
<!-- <a class="dropdown-item" href="https://www.notion.so/xeokit/xeokit-Documentation-4598591fcedb4889bf8896750651f74e">Documentation</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.github.io/xeokit-sdk/examples/" target="_examples">Examples</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.github.io/xeokit-sdk/docs/" target="_docs">API Reference</a>-->
<!-- <a class="dropdown-item" href="https://github.com/xeokit" target="_code">Source Code</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.github.io/xeokit-model-conversion-tests/index.html">Model Conversion</a>-->
<!-- </div>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.io/index.html?foo=2#pricing">Pricing</a>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.io/download.html">Download</a>-->
<!-- </li>-->
<!-- </ul>-->
<!-- </div>-->
</nav>

<div id="body">
<div class="row no-gutters pl-0">
<div class="col-12 pt-3">
<div id="modelConversionInfo"></div>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top ">
<span style="color: #ffffff;">
<a class="navbar-home" href="http://xeolabs.com">xeolabs</a>/
<a class="navbar-parent" href="https://xeokit.io">xeokit&nbsp;SDK</a>/
<a class="navbar-parent" href="./index.html">Model Conversion</a>/
<a class="navbar-parent" href="./tests.html">Tests</a>/
</span>
<span class="navbar-brand" href="./index.html">View IFC</span>
<!-- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">-->
<!-- <span class="navbar-toggler-icon"></span>-->
<!-- </button>-->
<!-- <div class="collapse navbar-collapse" id="navbarResponsive">-->
<!-- <ul class="navbar-nav ml-auto">-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="./index.html?foo=0">Home</a>-->
<!-- </li>-->
<!-- <li class="nav-item dropdown">-->
<!-- <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownDemos" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Demos </a>-->
<!-- <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownLearn">-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=RevitSamples&tab=models">Revit Sample IFC Model</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=MAPPointCloud">1.6M Point Cloud Model</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=MAP&tab=objects">Full-Precision IFC Model</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=OTCConferenceCenter&tab=storeys">Conference Center Model</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=Schependomlaan&tab=storeys">Schependomlaan Model</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.io/demo.html?projectId=Schependomlaan_selectedStorey&tab=storeys">Schependomlaan Ground Floor</a>-->
<!-- </div>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.io/index.html?foo=1#features">Features</a>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.io/index.html?foo=1#faq">FAQ</a>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.io/blog.html">Blog</a>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.github.io/xeokit-sdk/examples/" target="_demos">Examples</a>-->
<!-- </li>-->
<!-- <li class="nav-item dropdown">-->
<!-- <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownLearn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Developers </a>-->
<!-- <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownLearn">-->
<!-- <a class="dropdown-item" href="https://www.notion.so/xeokit/xeokit-Documentation-4598591fcedb4889bf8896750651f74e">Documentation</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.github.io/xeokit-sdk/examples/" target="_examples">Examples</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.github.io/xeokit-sdk/docs/" target="_docs">API Reference</a>-->
<!-- <a class="dropdown-item" href="https://github.com/xeokit" target="_code">Source Code</a>-->
<!-- <a class="dropdown-item" href="https://xeokit.github.io/xeokit-model-conversion-tests/index.html">Model Conversion</a>-->
<!-- </div>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.io/index.html?foo=2#pricing">Pricing</a>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="https://xeokit.io/download.html">Download</a>-->
<!-- </li>-->
<!-- </ul>-->
<!-- </div>-->
</nav>

<div id="body">
<div class="row no-gutters pl-0">
<div class="col-12 pt-3">
<div id="modelConversionInfo"></div>
</div>
</div>
</div>
<div class="row no-gutters">
<div class="col-3 pl-2">
<h5 class="pt-2 pl-2" id="infoArea">IFC Types:</h5>
<div id="treeViewContainer"></div>
</div>
<div class="col-9 text-center">
<canvas id="viewerCanvas"/>
<div class="row no-gutters">
<div class="col-3 pl-2">
<h5 class="pt-2 pl-2" id="infoArea">IFC Types:</h5>
<div id="treeViewContainer"></div>
</div>
<div class="col-9 text-center">
<canvas id="viewerCanvas" />
</div>
</div>
<canvas id="navCubeCanvas"></canvas>
</div>
<canvas id="navCubeCanvas"></canvas>
</div>
</body>

<script type="module">
Expand Down Expand Up @@ -127,7 +129,7 @@ <h5 class="pt-2 pl-2" id="infoArea">IFC Types:</h5>
<!-- IfcCommunityPipeline1 -->
<tr>
<td class="align-middle pl-3">
<a href="index.html#ifcCommunityPipeline1"><p>Community IFC Conversion Pipeline #1</p></a>
<a href="index.html#ifcCommunityPipeline1"><p>Community IFC Conversion Pipeline</p></a>
</td>
<td class="align-middle pl-2">
<a href="javascript:loadXKT('ifcCommunityPipeline1');"><button id="load_ifcCommunityPipeline1_xkt" type="button" class="btn btn-secondary btn-sm btn-success">XKT</button></a>
Expand Down Expand Up @@ -163,14 +165,30 @@ <h5 class="pt-2 pl-2" id="infoArea">IFC Types:</h5>
<td class="align-middle pl-2">
<a href="./results/${batchId}/${modelId}/ifcCXConverterPipeline1/log.txt"><button type="button" class="btn btn-secondary btn-sm btn-success">Log</button></a>
</td>
</tr>
<!-- Multi-Format IFC Conversion Pipeline -->
<tr>
<td class="align-middle pl-3">
<a href="index.html#xeokitMultiFormatPipeline"><p>Multi-Format IFC Conversion Pipeline</p></a>
</td>
<td class="align-middle pl-2">
<a href="javascript:loadXKT('ifcMultiFormatPipeline1');"><button id="load_ifcMultiFormatPipeline1_xkt" type="button" class="btn btn-secondary btn-sm btn-success">XKT</button></a>
</td>
<td class="align-middle pl-2">
<a href="./results/${batchId}/${modelId}/ifcMultiFormatPipeline1/model.xkt"><button id="download_ifcMultiFormatPipeline1_xkt" type="button" class="btn btn-secondary btn-sm btn-success">XKT</button></a>
<a href="./results/${batchId}/${modelId}/model.ifc"><button id="download_ifcMultiFormatPipeline1_ifc" type="button" class="btn btn-secondary btn-sm btn-success">IFC</button></a>
</td>
<td class="align-middle pl-2">
<a href="./results/${batchId}/${modelId}/ifcMultiFormatPipeline1/log.txt"><button type="button" class="btn btn-secondary btn-sm btn-success">Log</button></a>
</td>
</tr>
</tbody>
</table>`;


import {createViewer} from "./lib/viewer.js";
import { createViewer } from "./lib/viewer.js";

const {viewer, gltfLoader, cityJSONLoader, xktLoader} = createViewer({
const { viewer, gltfLoader, cityJSONLoader, xktLoader } = createViewer({
canvasId: "viewerCanvas",
navCubeCanvasId: "navCubeCanvas",
treeViewContainerId: "treeViewContainer"
Expand Down Expand Up @@ -256,10 +274,12 @@ <h5 class="pt-2 pl-2" id="infoArea">IFC Types:</h5>
if (i >= xktFiles.length) {
return;
}
const xktFileName = xktFiles[i];

const xktFilePath = `./results/${batchId}/${modelId}/${pipelineId}/${xktFiles[i]}`;

const model = xktLoader.load({
id: 'myModel',
src: `./results/${batchId}/${modelId}/${pipelineId}/${xktFileName}`
src: xktFilePath
});
models.push(model);
model.on("loaded", () => {
Expand Down Expand Up @@ -366,4 +386,4 @@ <h5 class="pt-2 pl-2" id="infoArea">IFC Types:</h5>

</script>

</html>
</html>
Loading