buildingSMART Forums

Presenting Blender as a new IFC authoring tool

@GOBA thanks for testing, and even more thanks for reporting! You can report on https://community.osarch.org or https://github.com/IfcOpenShell/IfcOpenShell/issues or send me an email at dion@thinkmoult.com - you can also use https://send.firefox.com/ to send me confidential or large files, which I will only use for the purposes of debugging and will not share publicly.

1 Like

Hi @Moult! I’ve sent you an email. I’m also going to check those pages, just I don’t have time now :blush:

1 Like

Thanks @GOBA! Both are bugs related to the new features in the latest release.

One is related to me forgetting to check for unit types, this is now fixed: https://github.com/IfcOpenShell/IfcOpenShell/commit/32c621139b68c5f5980615abcfa515d6663cd9e1

Another is related to where I assume subcontexts are used, but in your model, it seems as though only a context is used without any subcontext. I think in order for an IFC file to be meaningful, the subcontext should be specified so that I know what repesentation type I am looking at (e.g. Body representations). Nevertheless, this should not be a fatal error, and this is now fixed: https://github.com/IfcOpenShell/IfcOpenShell/commit/dd525d8a30beed88ec018e05c6e7475ab64ca25c

If you are comfortable with editing the files of your add-on with the fixes in the two links above, you can then import your files successfully :slight_smile:

Thanks again for reporting!

Edit: with your permission, can I keep those test files and publish it in a repository I am preparing of IFC test files for people (and automated test suites) to test with?

Thanks @Moult! Yes, you can keep those files, no problem.

I don’t know if I will be able to edit the files (my knowledge of IFC is limited), but I will try!

There is no need to edit the IFC files. You need to update the import_ifc.py file with the new fixed version. If you use Windows, this will be in: C:\Users\YOUR_USERNAME\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\blenderbim\bim\import_ifc.py

Just download this new import_ifc.py and replace your existing one in that folder. Restart Blender, and try importing again :slight_smile:

1 Like

It works! Thanks! :slight_smile:

1 Like

@Herb - IFCClash is now packaged for both Windows and Linux (Mac need somebody with a Mac, I guess?). It now also has a basic Blender UI to allow people to perform basic clash detection without needing to run CLI commands, but of course you can still run it CLI if you want to.

See relevant commit: https://github.com/IfcOpenShell/IfcOpenShell/commit/64fe2e978e06f1555dd07182216837f2c1f5275b

Python 3.7 64-bit Windows FCL build here: https://blenderbim.org/builds/fcl-py37-win.zip

IFC-native clash detection, here we come!

3 Likes

@Herb - and now even more updates there is a PyPi windows wheel build: https://pypi.org/project/python-fcl-win32/

pip install python-fcl-win32

BlenderBIM Add-on v0.0.200525 has been released with yet another 30 new features and fixes. The BlenderBIM Add-on is 100% free and open source software that lets you author and document BIM data fully to ISO standards. Get it today: https://blenderbim.org/

Highlights include improved clash detection features, more robust round-tripping including object re-use, basic cove.tool environmental analysis integration, and new experimental IFCXML and IFCJSON support!

New features:

  • New feature to convert from local to global (georeferenced) coordinates
  • Custom Qto definitions can now be exported
  • IfcClash can now patch global coordinates to aid in accuracy of clashes
  • IfcClash can now be used standalone or as a library in any project
  • IfcClash is now bundled with the BlenderBIM Add-on for Windows and Linux (any Mac volunteers who want to build it?)
  • Exporting two IfcProjects will now merge them into a single IFC project
  • Experimental IFCXML can now be imported
  • The relative placements of the spatial hierarchy are now imported and exported
  • IfcClash now supports clashing many-to-many / multiple IFC files at once
  • IfcClash now lets users configure clash tolerance
  • IfcClash now reports the worst-case distance clash in the case of multiple clashes with the same two objects
  • IfcOpenShell now has a utility module to let you conveniently do geolocation, element filtering, and getting element properties
  • IfcClash now supports element filtering, with filter rules, and/or statements, inclusion and exclusion rules
  • IfcClash now supports internal collision checks - to check for collisions within a single group of objects
  • IfcClash now supports clash sets to be defined so you don’t need to setup the rules again each time
  • The BlenderBIM Add-on has a new UI to create and run clash sets with IfcClash
  • The BlenderBIM Add-on now has a feature to export and import clash sets
  • Simple integration with cove.tool for basic energy and daylight analysis
  • You can now export experimentally to IFCJSON format (Thanks Ioannis!)
  • BIMTester updated to latest MicroMVD syntax specification
  • BlenderBIM Add-on now allows you to specific relationship checks during IFC Diff execution
  • When importing the same file or updated files twice, existing rooted elements (spatial elements, objects, types, etc) are reused instead of duplicating
  • You can now export psets related to spatial elements
  • Users can now switch easily between IFC4 and IFC2X3 when exporting
  • New feature to select / highlight all clash results in your current 3D viewport

New fixes:

  • Rewrite IfcClash system to drastically increase quality of clash detection results
  • Fix bug where monetary units can cause an import to fail
  • Fix bug where an IFC without a subcontext can cause an import to fail
  • Fix bug when exporting / round-tripping IFC2X3 to IFC4 classifications
  • Fix broken export when object names are too long
  • Fix bug where importing mapped type representations may accidentally reuse other meshes
  • More lenient parsing to skip invalid representations and not stop halfway (as discovered in ArchiCAD-produced files)
4 Likes

Hi Moult!

How do you export with quantities?

Hi @GOBA ! Sorry for the late reply. You can add a Qto just like adding a Pset and enter in values manually in the Object properties tab.

Originally, there was another feature where automatic quantities were calculated at export time, but these were never exposed through the UI as it was a very early release and the UI has changed significantly. Would you mind creating a bugreport about that, and I can re-add it in the next release :slight_smile:

1 Like

Hi @Moult, done :slight_smile:

1 Like

BlenderBIM Add-on v0.0.200621 has been released with nearly 40 new features and fixes. The BlenderBIM Add-on is 100% free and open source software that lets you author and document BIM data fully to ISO standards. It’s built by the AEC community, for the AEC community. Get it today: https://blenderbim.org/

Highlights include improved import optimisations, experimental support for native parametric geometry round-tripping, more stable multiprocessing, and custom cove.tool geometry integration for environmental analysis.

New features:

  • A project is now setup automatically at export-time if you haven’t done so already
  • cove.tool integration now supports submitting custom geometry for bespoke designs
  • cove.tool integration now reads north angle from project geolocation
  • Improved stability on multiprocessing import, for much faster importing, give it a spin!
  • Both materials and style overrides are retains on import, so you can see the full hierarchy of materials and styles
  • IFC geometry type is stored on import
  • IFC4 georeferencing data is now imported
  • Users are now prompted to assign a class before accessing IFC metadata
  • UI panel names are now a bit more standardised
  • Rebar is now imported without needing to enable curve import
  • New user option to enable native element geometry processing on import
  • Not just rebar, but all generic IfcSweptDiskSolid is now processed as native geometry
  • Extrusions which use IfcArbitraryClosedProfileDef is now imported as native geometry instead of being meshed
  • Extrusions which use IfcRectangleProfileDef is now imported as native geometry instead of being meshed
  • Bundled latest IfcOpenShell which a ton of new improvements
  • Native geometry now supports surface styles
  • The division between distinct representation items is now stored on import for native elements
  • It is now possible for opening elements to create a boolean relationship on import
  • Support partial importing, with whitelisting and blacklisting using IFC query / selector syntax
  • Native elements now have multiprocessing support
  • New IFCPatch recipe to split up an IFC file by building storey without data loss
  • Mesh cleaning is now disabled for large files for optimising import times
  • Optimise the creation of material slots to prevent duplicates, especially for BIM programs which abuse surface styles like Revit
  • Big optimisations to importing files - like, much, much faster
  • Faceted BREPs are now imported as native geometry instead of being meshed
  • Components of a representation, like an extrusion profile or direction are now stored on import
  • Export of extrusions are now supported, allowing native geometry round-tripping

New fixes:

  • Objects without any placements can now be imported
  • Switching contexts are now more tolerant of invalid IFC files
  • Fix bug where types can be incorrectly assigned on export if names aren’t unique
  • Disable limited dissolve during mesh cleaning, which can lead to invalid material assignments
  • Fix crash when doing an “undo” operation after adding annotations
  • Fix invalid materials being potentially created when using the temporary section plane tool
  • Don’t fail importing case insensitive file extensions
  • Fix issue where IfcGroup subclasses can be imported as the wrong class
7 Likes

Hi Moult,
I have a question regarding IfcBlender:
-can I use the ifc entities GlobalId to find the corresponding object in blender?(I see the in blender it is shown by type/name, but sometimes becomes duplicate and blender adds number to it)

@KavehAll Use IfcSearch in Scene properties :

2 Likes

@Cyril is right :slight_smile: Keep in mind if you manually duplicate an object, it will also temporarily duplicate the GlobalId. You can then choose to resolve this manually by regenerating the GlobalId of one of the objects, to decide which object was the “original”, or you can just leave it alone and on export-time it’ll auto-resolve and choose one by itself to regenerate to preserve uniqueness.

The number adding is for human convenience. Referring to Chair.023 is easier to talk to your colleague than “Oh, no, not that chair, the chair with, uh, GlobalId starting with, 2h1XlL… no, yeah, lowercase L, no, and ending with 42bf… f, yes, ah, I’ll just send you an email” (some implementations count up 1 at a time, so we have to check all the way to the last digit, and I’ve seen quite a few clashes on case sensitivity already on implementations with less random UUID versions which makes searching annoying…)

BlenderBIM Add-on v0.0.200722 has been released with nearly 50 new features and fixes. The BlenderBIM Add-on is 100% free and open source software that lets you author and document BIM data fully to ISO standards. It’s built by the AEC community, for the AEC community. Get it today: https://blenderbim.org/

Highlights include IFC person / organisation management, new quantity take off calculation tools, improved BIMTester for BIM auditing, and improved recording of design constraints and intentions.

New features:

  • Objects now have an IFC class assignment panel for convenience
  • New “unassign class” to convert from a BIM object to non-BIM
  • Improved absolute coordinate import from DDS-CAD based IFCs
  • You can now remove a representation subcontext
  • Object proxying now works in a simplified manner, letting you directly reference Blender files with high poly geometry
  • New UI to manage IFC constraints
  • You can now export IFC constraints based on the UI, making the older CSV definitions obsolete
  • You can now assign constraints to individual objects and export them
  • New UI for managing and creating IfcPeople
  • New UI for managing and creating IfcOrganisation
  • Support invalid grids coming from Revit
  • Support import of triangular grids
  • Support export of IfcSpatialElementTypes
  • You can now export IFC2X3 “Style” classes in IFC4
  • IfcOpenShell utilities now comes with geolocation functions
  • All aggregates are now grouped in their own collection for convenience
  • No need to manually select types for collections when exporting
  • New feature when producing documentation, to recut the entire model or only selected objects
  • Materials assigned to portions of an object no longer need to be using object links
  • Support export of IfcPositioningElements
  • You can now define an owner history from your collection of people and organisations, or have no history at all
  • New feature to allow users to profile the import procedure
  • BIMTester UI updated to new Gherkin conventions
  • The IfcOpenShell selector utility now supports selecting COBie classes as its own selector
  • IfcObjective constraints are now imported
  • TK interface for BIMTester has been removed
  • Quantity UI now provides manual calculation buttons for generating lengths, areas, and volumes
  • You can now export a mesh edge for structural curve members
  • The geometry type data field now supports “None”, if it has no body representation
  • New feature to automatically calculate quantities during export
  • Allow for wildcard expansion in IFCCSV exports, allowing you to export a series of properties belonging to the same set
  • Failed BIMTester tests now have improved error reporting
  • BIMTester test reporting is now super sexy
  • BIMTester can now be run without packaging as a simple library
  • BIMTester can now be run from the Blender UI
  • BIMTester can now audit predefined types

New fixes:

  • Booleaned native objects will fall back to non-native import to support it
  • Fix bug where a slot without materials won’t export
  • Fix bug where some absolute coordinates would not properly be converted to local coordinates
  • IFCPatch ResetAbsoluteCoordinates has improved absolute coordinate handling
  • Allow for empty data in non-mandatory georeferencing data
  • Fix incorrect dimension export of rectangle profiles
  • Scaled curve bevel objects are now properly exported
  • Invalid psets now are no longer exported with empty relationships
  • Fix bug where imported materials with the same name as an existing material could be incorrectly assigned
  • Fix bug where IfcOpenShell selector utility was just broken
  • Fix bug where truncated material names can cause import failure
6 Likes

Hi Dion,
can I trigger the import Ifc from BlenderBim from my own addon interface? I have already the name of Ifc file and just want to pass it to automate my workflow. Is it possible?
bpy.ops.bim… (There is no import operator in the list ) though in BlenderBIm code there is a ImportIFC class which is an operator.
Thanks
Kaveh

@KavehAll absolutely. By design it lets you use the import and export from any custom script. You can also override quantity calculations, or particular parametric geometry exports and imports by overloading the import functions. For example, the Archipack add-on actually overrides the export function to handle its parametric objects.

You don’t need to call the operator, as that’ll trigger a file dialog. That’s all it does.

You may want to import BlenderBIM add-on libs first :slight_smile:

import bpy
import logging
import blenderbim.bim.import_ifc # For import
import blenderbim.bim.export_ifc # For export
import blenderbim.bim.qto # For quantity calculation

Here’s an example of import. (see operator)

ifc_import_settings = blenderbim.bim.import_ifc.IfcImportSettings.factory(bpy.context, '/home/dion/testa.ifc', logging.getLogger('ImportIFC'))
ifc_importer = blenderbim.bim.import_ifc.IfcImporter(ifc_import_settings)
ifc_importer.execute()

Exporting is a few more lines of code. (see operator)

settings = blenderbim.bim.export_ifc.IfcExportSettings.factory(bpy.context, '/home/dion/testa.ifc', logging.getLogger('ExportIFC'))
qto_calculator = blenderbim.bim.qto.QtoCalculator()
ifc_parser = blenderbim.bim.export_ifc.IfcParser(settings, qto_calculator)
ifc_exporter = blenderbim.bim.export_ifc.IfcExporter(settings, ifc_parser)
ifc_exporter.export(bpy.context.selected_objects)

I encourage people to play around and dig into the IFC import and exports - it’s a great educational tool to discover how data is managed in IFC and how translations may happen. In fact, a half of the export is actually agnostic of Blender as a tool.

By the way - you may want to ask these questions on https://community.osarch.org/ in the future - as buildingSMART’s forums was not intended to be a support forums for a particular tool.

1 Like

I should’ve mentioned, the example I gave is if you want granular control. If you just want to import or export, it’s only one line of code:

Importing:

bpy.ops.import_ifc.bim(filepath='/home/dion/testb.ifc')

Exporting:

bpy.ops.export_ifc.bim(filepath='/home/dion/testb.ifc')

(note that’s from the master branch, I think the latest stable has a different name, like bpy.ops.bim.import_ifc.)

I’ve documented it all here for future reference: https://wiki.osarch.org/index.php?title=BlenderBIM_Add-on_code_examples