A simple client-side IFC parser
GitHub repository »
Access IFC sample files
·
View Demo
·
Report Bug
·
Request Feature
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.
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
- 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 returnProperty Sets
for each object (IFC Entity)
- A
config object
is provided - A new IfcFile object is created
- The constructor handle the aforementioned
config object
- parseStepFile() iterates over each line and calls generateStepInstance()
- generateStepInstance() generates a so-called
STEP Instance
object
In this particular case, a STEP Instance
object is one of the following
- IfcPropertySet
- IfcPropertySingleValue
- IfcRelDefinesByProperties
- IfcBuildingElement, which is denoted as a
genericEntity
- parsestepinstanceattributes() is used to aid the aforementioned
generateStepInstance()
. - mapPropertySingleValuesToPropertySet() maps a IfcPropertySingleValue to a IfcPropertySet
- mapPropertySetsToGenericEntities() maps a IfcPropertySet to a IfcBuildingElement/GenericEntity using an objectified relationship (IfcRelDefinesByProperties)
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.
- 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
Start by looking at the stepFile Class. This is the base and deals with STEP / ISO 10303.
In other words:
- The stepFile Class handles the parsing of a STEP file.
- The IfcFile Class builds the relationship between objects (IFC Entites) according to the IFC Schema.
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
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!
- Primary email: kontakt@andrewisen.se
- Secondary email: andre.wisen@gmail.com
- LinkedIn: https://linkedin.com/in/andrewisen/
Not what you're looking for? Check out these projects instead!