- Home /
Integrate Xbim Tool external library into Unity
I'm trying to transfer geometric and architectural data from an .ifc file into Unity In order to accomplish this task, I'm using Xbim Tool's C# libraries
Github Link here
Nuget Link here
Libraries are Xbim Essentials and Xbim Geometries.
I followed this tutorial to make Visual studio accept the packages and prevent them to be wiped out by the rebuild Unity does at every start up.
Since Unity only accept dlls to be stored into the asset folder, I've used the package "Nuget for Unity" to download the packages into the asset folder.
This is the code I wrote
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Xbim.Ifc;
using Xbim.ModelGeometry.Scene;
public class Testprogetto : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
const string fileName = "Muro finestrato.ifc";
using (var Stepmodel = IfcStore.Open(fileName, null, -1))
{
Stepmodel.SaveAs("Muro finestrato.ifcxml");
}
using (var model = IfcStore.Open("Muro finestrato.ifcxml"))
{
var context = new Xbim3DModelContext(model);
context.CreateContext();
}
}
// Update is called once per frame
void Update()
{
}
}
In visual studio this compiles heavenly, but in Unity the internal compiler returns the error like I missed to import the libraries.
Answer by SolidVirtual · Feb 06, 2020 at 03:09 PM
@Wolgraph Did you get it?
Yeah. I solved the problem by downloading the packages, compile the in order to get the .dll files and saving them in the folder “Plugins” I created within the project directory.
I'm able to compile de .dll files and put them in a Plugins directory but once a copy into the plugins folder some errors appeared. Duplicate assemblies and others ... did it happen to you?
Answer by Wolgraph · Feb 09, 2020 at 10:11 PM
It's been around 7 months since last time I used xbimtool so I don't remember much about it. I think I got that error a couple of time. If you downloaded packages from nuget or other ways, try deleting every reference of them. As the error says, it finds two version of the assembly and it doesn't know which to use. Since this error doesn't depend specifically on xbimtool or Unity, you may also try search the error message on internet. I'm sure you'll find something.
Another solution may be to create a new project and migrate the assets. This way you'll have a fresh project file and it shouldn't have that error
Answer by FrostbiteX11 · Jun 28, 2020 at 10:54 PM
@Wolgraph : Did you develop the solution or yet to create a solution regarding that? I'm a graduate student trying to look into developing tools to cross=platform between unity-unreal-Revit at a single go. It is pretty tough but I guess it is not impossible!