You might be aware that you can use CPython script inside pyRevit using #! python3
at the beginning of your script file. The library which allow this is pythonnet. I encountered some issues:
pathlib
module was not working because it was using ironpython version frompyrevitlib
. Why ? python path. CPythonsite-packages
path came after ironpythonsites-packages
path. Workaround: putpathlib.pyc
in your<extension_path>\lib
folder but it might be an issue if another script uses ironpython version. See issue #1287.- I have not found yet how to make a GUI inside Revit inside a CPython script.
tkinter
is not packaged with embedded python interpreter.wpf
does not work the same way with pythonnet. Windows Forms might work.
What the script does at the moment is creating a .rvt
file for each producer. It creates materials including main thermal properties. It also create hatches and apply colors based on a .json
template produced with ExportMaterialsGraphics
script which serialize all this parameters. Doing so I discovered how complex hatch are stored with in a list of FillGrid
. Whatever the shape of your hatch, it is stored as a list of segments.
Source code is available here. I made a short video (in French) to explain how to use it currently.