Here is a last quick Sunday morning post before I head off on vacation, prompted by truevis' comment on the DirectObjLoader GitHub issue #2:
What do we have to change to get this to work in Revit 2017? Seems there are changes in
I migrated the sample to Revit 2017 for you.
Here is what I did:
- Updated the Revit API references
- Incremented the .NET framework from 4.5 to 4.5.2
- Reinstalled the FileFormatWavefront NuGet package
That produced two warnings:
- Error CS1501 No overload for method 'Build' takes 3 arguments DirectObjLoader C:\a\vs\DirectObjLoader\DirectObjLoader\Command.cs 126 Active
- Warning CS0618 'DirectShape.CreateElement(Document, ElementId, string, string)' is obsolete: 'This function will be obsolete in Revit 2017. Use DirectShape.CreateElement(Document, ElementId) instead. Use DirectShape.ApplicationId, DirectShape.ApplicationDataId properties to set application id and application data id.' DirectObjLoader C:\a\vs\DirectObjLoader\DirectObjLoader\Command.cs 131 Active
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:
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
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: