RevitAPI: how to find code examples for macro of python or ruby?

中文链接

By Aaron Lu

One of the new features of Revit 2016 API is that Revit now supports macro written in Python or Ruby.

How to find python macro exmaples-create macro

But there is no Python or Ruby code examples in Revit 2016 SDK. So how to get started? Well, most of people did not notice that the code examples are hidden in the default macro projects created by macro manager, see below image, the project is the default python project, there are several "if False" statements, if you remove the line of "if False", uncomment and unindent 4 spaces to methods below it, the methods will become available macros and appear in the macro manager, and you will see the same "if false" in Ruby projects too:

How to find python macro exmaples


Comments

5 responses to “RevitAPI: how to find code examples for macro of python or ruby?”

  1. Hey Aaron Lu thanx for your article and code…helped me…

  2. hello dude a great article….by the way which IDE you are using

  3. he’s using SharpDevelop. it comes revit apparently and is an opensource IDE

  4. Actually let me mention this. you also have to hi the Build Button under the Build so that SharpDevelop can “recompile” it i guess. you do this after you either comment out or remove the “if false” statement for the ones you want. you have to unindent all the definitions under the If False statement that you deleted/commented out

  5. Gaurav Odhyan Avatar
    Gaurav Odhyan

    How do i debug a python code in Revit Macros, the Step Into button does not work

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading