The Building Coder

DirectObjLoader for Revit 2017

Here is a last quick Sunday morning post before I head off on vacation, prompted by truevis' comment on the DirectObjLoader GitHub issue #2:

Question

What do we have to change to get this to work in Revit 2017? Seems there are changes in DirectShape.CreateElement and TessellatedShapeBuilderResult.

Answer

I migrated the sample to Revit 2017 for you.

Here is what I did:

That produced two warnings:

The warning is completely self-explanatory and trivial.

To fix it, just do what the man says.

The error is caused by the changes described in What's New in the Revit 2017 API:

TessellatedShapeBuilder Changes

The options for building are now set as options in the TessellatedShapeBuilder itself. Access these options through the new properties:

Furthermore, the build result is now accessible through GetBuildResult instead of being returned by the Build method.

I published a new release 2017.0.0.0 including the corresponding changes.

You can compare the changes to see exactly what I did.

Here is the code for Revit 2017:

The flat migration works fine, and this image was produced as a result from a 6 MB OBJ apartment model:

DirectObjLoader loaded a 6 MB OBJ model of an apartment