Unity-IFCEngine
Import scripts for IFC files.
Features working:
- Geometry
- Project scale in Milli, Deci and Centimeters
- Assign materials according to material definitions in Unity component
- Get georeference latitude, longitude, elevation from IFC file
Feature ToDo:
- Read IFC materials and create Unity ones accordingly
- Read IFC properties and make them usable
Note: Implementation is based on my IfcEngineWrapper project, which is currently not available as OSS, and IFCEngine http://rdf.bg/ifc-engine-dll.html?page=products
Please see the license terms of IFCEngine DLL before trying to use this project.
Installation
- Create a new Unity 2017.2 project
- Import CielaSpike's ThreadNinja from the Unity Asset Store: https://www.assetstore.unity3d.com/en/#!/content/15717
- Download this repository as ZIP file and extract it to the project root OR
- Download a release package from "Releases" and import it using Assets -> Import Package -> Custom Package
- If you've used a release package, copy the contents of IFCImporter/IFCDefines to the Unity project root directory
- Open the IFCImporter/ExampleImport map to see how it's used!
Usage
The import scripts basically consist of the files ImportIFC.cs and MaterialAssignment.cs.
- Create an empty game object
- Attach the ImportIFC component to the game object
- Attach the MaterialAssignment component to the game object
- Assign the MaterialAssignment component to the ImportIFC component
- Change the length of the material array and add defines for "IFCClass"->"Material" (case sensitive)
- Create your own scripting class, calling the component and using the Init() and ImportFile() function
- Use the callback function to do further stuff, when the import is finished.
- Note: Objects created in play mode are not persistant to the game world. However, prefabs will be created upon initial import, so you can then drag and drop them in editor (or write your own serialization method). This may be needed to change texture scaling because of auto-generated UV coordinates.
-
Import some IFC files!
-
Access common IFC properties via the IFCVariables component attached to the child gameobjects
Release
Be sure to include the IFC2X3-Settings.xml +.exp and IFC4-Settings.xml + .exp, IFCEngine.dll and IfcEngineWrapper.dll into your binary directory!
Contributing
Create a pull request. Only pull requests corresponding to an issue will be considered, so please create an issue accordingly to the feature or bug you're submitting code for, if there isn't any.