Batch IFC to RVT conversion

ifc

#1

Hi, can somebody help with conversation IFC files into RVT. As I cant find any suitable node to work w/ IFC. only few in Bakery package, and thats all. image


#2

I have the same issue

It seems dynamo has limited access to the Revit API when it comes to IFC’s…

Can anyone shed some light on this?


#3

Hi, I’ve enabled a public method in my plguin to permit call of the importer by code. The inputs are an ifc file name, a target revit file name, and a template file name.
Soon I will add an argument for configuration options.

It’s available in the latest build for 2017, and will be included in the next release for other versions. http://www.geometrygym.com/installing

What I’ve struggled with is how to correctly reference the dll and execute the method in python (or similar) in Dynamo. I’m sure this is just my lack of experience and knowledge of this, I’d be very interested to learn how. Loading my dll’s as zerotouch could work if you wade through all the public classes and methods. I wish zero touch could only load public methods etc explicitly tagged.

I’ve attached some test plugin code that shows how this can be executed. There is a reference to dll C:\Program Files\Geometry Gym\Revit\ggRevitIFC2017.dll If there is a way to post a zipped solution, let me know.

I look forward to learning more,

Jon

[Transaction(TransactionMode.Manual)]
public class ConvertIFCFiles : IExternalCommand
{
	public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
	{
		string ifcFileName = @"C:\My Work\Geometry Gym\Documents\GeometryGym\BIM\ifc\grasshopper\revit\170816 demo column.ifc";
		string revitFileName = @"C:\My Work\Geometry Gym\Documents\GeometryGym\BIM\ifc\grasshopper\revit\170816 demo column.rvt";
		string templateFileName = @"C:\ProgramData\Autodesk\RVT 2018\Templates\Australia\Structural Analysis-DefaultAUSENU.rte";
		string log = "";
		if(!GGYM.ggRevitIFC.ConvertFile(commandData.Application, ifcFileName, revitFileName,templateFileName, out log))
		{
			System.Windows.Forms.MessageBox.Show(log);
		}

		return Result.Succeeded;
	}
}

#4

@Jon_Mirtschin It would be very cool to have a GeometryGym package for Dynamo. I don’t have too much experience with making ZT nodes but I did experiment with importing the IFC Engine DLL a couple of years ago. What worked for me in terms of cleanup was the following: I created a wrapper class that would reference the DLL and only contained references for those methods I wanted as nodes (declaring them as public, of course).


#5

Well thanks to @Adam_Sheather, I’ve got this working.

You can install Revit 2017 from https://drive.google.com/file/d/0B8W4_4YXbIt4ek9mSkh6Y0pCVFk/view?usp=sharing (this link will die, go to the Geometry Gym downloads in the future) and I’ve attached a script and image. Look forward to adding more improvements and features in the very near future.

170913 dynamo convert ifc files.dyn (3.5 KB)


#6

@Jon_Mirtschin Great stuff. Just to clarify: this will use the import class mappings file referenced in the Revit.ini?


#7

That can be an input to this, I will soon release a new build with an input for various configuration settings to control this and other aspects of the import process. For time being, if you import a file manually prior, it should subsequently use same settings from dynamo. There is a dialog in the revit importer.


#8

There’s no problem in opening IFC directly with python, using the Application.OpenIFCDocument Method:
http://www.revitapidocs.com/2018/b7929f76-6c0f-1363-4683-8501a0d582a5.htm
Also there are some methods defining the IFC import options, so they could possibly be defined during the import process.

image

import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

#input IFC file path:
IFCfilepath = IN[0]
#define IFC import options:
IFC = Autodesk.Revit.DB.IFC
IFCopt = IFC.IFCImportOptions 

IFCopen = app.OpenIFCDocument(IFCfilepath)

#Save resulting Revit file to the destination path:
OUT = IFCopen.SaveAs(IN[1])

#9

Seems to be a cool thing, but unfortunately dont work on my end

. I`ve installed all your libraries image


#10

Thanks, which version of Revit are you using? I’ve uploaded 2018 to https://geometrygym.wordpress.com/downloads-windows/

It seems you have to replace the dynamo component though if you have a different version of Revit.
It is possible to build the dynamo dll yourself if you have a different version or Dynamo. I’ve opensourced this, https://github.com/jmirtsch/ggRevitDynamoIFC

Let me know if this doesn’t help. You should also test the importer manually in Revit, note there is a license required (you will be prompted). I do provide free access to academic use but rely on revenues from commercial users to sustain full time development and support of these tools.

Cheers,

Jon