A lightweight gbXML export module for Revit, WIP. Sometimes we find the Revit model much too complex for an accurate and lightweight gbXML export. There may be broken space boundaries, shattered surfaces, or tiny twisted patches, thus leading to failures in the building energy simulation. Here in this toy project we try to create a simple BREP-like space crafting addin with fuzzy space detection and simplification, aside from the native gbXML export module either based on room/space definition or energy analysis model. However, we've just started and the algorithm needs many improvements.
gingerbread
└ /Gingerbread
├ /Properties - Assembly info
├ /Resources
│ ├ /ico - Icons
│ ├ /lib - Clipper.cs
│ └ /spider - Spider gbXML viewer
├ /Views - WPF
├ /Core - Reserved mehtod
├ App.cs - App entry
├ Cmd*.cs - Button entry
├ Ext*.cs - External event
├ Util*.cs - Utility method
└ Gingerbread.addin - App manifest
Dependencies
- Clipper 6.1.3
- CefSharp 65.0.1
- spider-gbXML-tools basic V7
Compile
- Revit 2022 - CefSharp 65.0.1 - Visual Studio 2022
- Make sure the Build/Debug platform is switched to x64
- Post-build event settings:
if exist "$(AppData)\Autodesk\REVIT\Addins\2022" copy "$(ProjectDir)*.addin" "$(AppData)\Autodesk\REVIT\Addins\2022"
if exist "$(AppData)\Autodesk\REVIT\Addins\2022" mkdir "$(AppData)\Autodesk\REVIT\Addins\2022\Gingerbread" mkdir "$(AppData)\Autodesk\REVIT\Addins\2022\Gingerbread\Spider"
copy "$(ProjectDir)$(OutputPath)*.dll" "$(AppData)\Autodesk\REVIT\Addins\2022\Gingerbread"
copy "$(ProjectDir)$(OutputPath)\Resources\spider\*.*" "$(AppData)\Autodesk\REVIT\Addins\2022\Gingerbread\Spider"
Demo
Development Log
Please test it with Technical_school-current_m.rvt
that shipped with Revit.
Note
There is something I though might be useful for beginners with the Revit addin development. I'll leave the notes here.
- All WPF windows interit from one basewindow class where the border and title bar are customized. You may refer to
BaseWindow.cs
andBaseWindowStyle.xaml
and see how that works. - We use
Properties.Settings.Default
to cache some user settings and bind them in XAML textbox. - External events are called by clicking the button on WPF window. Likely, with
Delegate
andDispatcher
, a progressbar is added to the main window monitoring the processing of an external event.DoEvent
is not optimal. Here's a greate sample of this kind of progressbar: engthiago/WPFMonitorRevitAPI - Several ways to implement the embedded Web browser. 1. Using CefSharp in line with Revit and call local website dynamically (in .cs), but I don't know how to pass variable to JavaScript because there seems a conflict between addin and Revit when initializing a browser. 2. Still with CefSharp but initializing local website within XAML. This is the current solution. Without the data communication users have to load XML manually which is dumb. 3. Try other C# dependencies like DotNetBrowser that has no conflicts with Revit (Not free). 4. Open up another process for addin's CefSharp. Refer to Kim Sivonen
If you got better solution please let me know Many thanks.