Вопрос

I did a dumb thing. I got all excited about Revit 2014 allowing macros in Ruby, installed RevitRubyShell, and wrote what is going to become an add-in.

Slight problem -- there's no DLL compiler for IronRuby. D'oh!

So, I'm going to convert my code to Python (and use the excellent RevitPythonShell), which is what I was using for Revit API work before Revit 2014 Ruby came along.

My question is -- after I've converted my Ruby code to Python, (how) can I create a Revit Add-In DLL? I know that you can compile Python to a .NET DLL, but every example of Revit Add-Ins seems to be in C#. I want to stay in the interpreted environment because it's very fast to develop in Revit this way. But there's no point in doing all my dev in Python (or Ruby) if I have to convert everything to C# to make an Add-in that conforms to the IExternalApplication interface.

Has anyone done a Revit Add-In in Python?

Thanks!

Andy

Это было полезно?

Решение

Check out this blog post: Deploying RPS scripts with DeployRpsAddin.

In that article, I describe a functionality of the RevitPythonShell, that let's you create a distributable version of your RevitPythonShell (RPS) scripts - a bunch of scripts to ship.

The main way this is done is by providing a wrapper DLL written in C# that stores your scripts and a configuration file as resources and executes them with IronPython at runtime. This still means that your python code is not "compiled" to IL, but you get to bundle it up for installation on a separate computer. Check out the DesignPerformanceViewer for an elaborate example of such an AddIn.

Другие советы

Never mind. After more digging, found this stackoverflow answer that indicates IronPython DLLs are NOT portable/callable from anything but IronPython, so that leaves out Revit Add-ins.

Build .NET DLLs from Python code? (the answer, per this link, is "No.")

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top