Skip to content

Latest commit

 

History

History
203 lines (145 loc) · 8.88 KB

typedoc.md

File metadata and controls

203 lines (145 loc) · 8.88 KB

Logo

Welcome to the BIMWHALE.js docs

A simple client-side IFC parser
GitHub repository »

Access IFC sample files · View Demo · Report Bug · Request Feature

Introduction

The primary docs for The BIM Whale Project can be found at: https://andrewisen.gitbook.io/bim-whale/

The purpose of this website is to provide additional documentation. This site will focus on the code itself; the classes and methods used.

Please note that actual source code is NOT included here. This site is built using TypeDoc. The content is automatically generated from the TypeScript source code.

Again, to clarify: This documentation will go into more details. It will (try to) explain how the code works.

If you feel overwheled by this, then head back to the original documentations.

Code Architecture

Folder Structure

The overall folder structure is shown below.

bim-whale
├───dist
└───src
    ├───utils
    ├───config
    ├───step-parser
    │   └───step-parser.ts
    └───ifc-parser
        └───ifc-parser.ts

Please note that the ifc-parser is an extensions of the step-parser. Each method is put inside it's own file to keep things more organized.

bim-whale
└───src
    └───ifc-parser
       ├───ifc-parser.ts
       └───methods
            ├───parse-ifc-file.ts
            ├───map-property-single-values-to-property-set.ts
            └───map-property-sets-to-generic-entities.ts

Getting started

  • A config object is created.

The main repository uses a config file. The public demo creates a config object inside the function.

Both approaches are valid.

  • A new IfcFile object is created
let ifcFile = new BIMWHALE.IfcFile(lines, config);

The class IfcFile is an extension of the class StepFile. In other words, the IfcFile's constructor is inherited from the StepFile's constructor.

  • The IfcFile object parse an IFC file and return Property Sets for each object (IFC Entity)

In more detail

  1. A config object is provided
  2. A new IfcFile object is created
  3. The constructor handle the aforementioned config object
  4. parseStepFile() iterates over each line and calls generateStepInstance()
  5. generateStepInstance() generates a so-called STEP Instance object

In this particular case, a STEP Instance object is one of the following

  1. parsestepinstanceattributes() is used to aid the aforementioned generateStepInstance().
  2. mapPropertySingleValuesToPropertySet() maps a IfcPropertySingleValue to a IfcPropertySet
  3. mapPropertySetsToGenericEntities() maps a IfcPropertySet to a IfcBuildingElement/GenericEntity using an objectified relationship (IfcRelDefinesByProperties)

Why TypeScript?

I prefer TS for one simple reason:

Developer tooling support / Enhanced IDE support

See: TypeScript in 100 Seconds

In my option, TS makes it much easier to work with IFC.

A word about performance

  • Avoid unwanted loops
  • Avoid nested loops
  • Avoid using try-catch-finally
  • Set correct variable scope
  • Use modern ES6 features (e.g. Object Destructuring, Spread Operator, template literals)

TODO

Where should I start?

Start by looking at the stepFile Class. This is the base and deals with STEP / ISO 10303.

In other words:

Example

Let's take a look at the example file SimpleWall. Here's an extract of the file:

#297= IFCPROPERTYSINGLEVALUE('Description',$,IFCTEXT('_DESCRIPTION_'),$);
#298= IFCPROPERTYSINGLEVALUE('Fire Rating',$,IFCTEXT('_FIRE-RATING_'),$);
#299= IFCPROPERTYSINGLEVALUE('Keynote',$,IFCTEXT('_KEYNOTE_'),$);
#300= IFCPROPERTYSINGLEVALUE('Manufacturer',$,IFCTEXT('_MANUFACTURER_'),$);
#301= IFCPROPERTYSINGLEVALUE('Model',$,IFCTEXT('MODEL'),$);
#302= IFCPROPERTYSINGLEVALUE('Type Comments',$,IFCTEXT('_TYPE-COMMENTS_'),$);
#303= IFCPROPERTYSINGLEVALUE('Type Mark',$,IFCTEXT('_TYPE-MARK_'),$);
#304= IFCPROPERTYSINGLEVALUE('Type Name',$,IFCTEXT('Bearing Wall'),$);
#305= IFCPROPERTYSINGLEVALUE('URL',$,IFCTEXT('_URL_'),$);
#306= IFCPROPERTYSINGLEVALUE('Family Name',$,IFCTEXT('Basic Wall'),$);

Each line consist of an entity instance. This can simply be referred to as an entity or an instance ("entity instance" is a long word).

Each line contains the following:

  • Instance name
  • Entity name
  • Attributes

Let's examine the first line in the example above:

  • Instance name: #294
  • Entity name: IFCPROPERTYSINGLEVALUE
  • Attributes: 'Description',$,IFCTEXT('_DESCRIPTION_'),$

The terminology above will be used throughout this site.

The method generateStepInstance() is used to build an entity instance.

In other words: stepFile Class will use generateStepInstance() to generate each IFC Entity.

MORE INFO WILL COME

But, I don't understand

No worries. The goal with The BIM Whale is to teach people how to work with IFC. However, the learning resources are not ready yet. Have some patience!

Contact

Extra

Not what you're looking for? Check out these projects instead!