Check out the Self-Paced Guide “My First Plug-in” presented by the ADN Revit Team
http://www.autodesk.com/myfirstrevitplugin
Note on 5/11/2018: My First Plug-in is being migrated to Knowledge Base (similar to this forum). Right now, the marketing URL is not working. In a mean time, you can access here:
https://knowledge.autodesk.com/community/collection/my-first-autodesk-revit-plug
Still work in progress. Working on updating all the links, to the latest three releases, etc.
Are you an Autodesk Revit power user with an interest in becoming even more productive? Would you like to automate or extend the capabilities of Revit, but are new to computer programming? If so, then this guide is designed for you.
“My First Plug-in” is a self-paced tutorial guide for a smooth introduction into the programming world. This is a “one-stop shop” learning path for users who know Autodesk products but are absolutely new to programming and are thinking about taking the plunge. In this guide, you will be working with the Autodesk Revit .NET API and the C# programming language. The supported product version is Autodesk Revit Architecture 2011 and succeeding versions.
There are many resources available on the web for you to learn about the Autodesk Revit API (Application Programming Interface), however, these resources tend to be designed for people who already know programming. This guide is different: it assumes no previous programming knowledge and yet helps you build your first plug-in quickly, without swamping you with details. You’ll have a working application within an hour of starting this material, irrespective of your current level of programming expertise.
The guide will start by reviewing the benefits of customizing Autodesk software before progressing onto lessons covering the use of the Autodesk Revit API. The lessons will start by building a working plug-in before covering more detailed explanations of the underlying principles and further developing the application’s functionality.
Product: Autodesk Revit 2011 or higher
Programming Language: C#
Application Programming Interface (API): Revit .NET API
If you have any feedback on this new guide let us know at myfirstplugin@autodesk.com
Thats correct. The samples in the SDK are not really written for non-programmers but for someone with fair amount of knowledge and prior experience in programming with .NET.
The 'My First Plugin Series', was written as an introduction to the programming world with the focus on Revit API. I agree no less that to do something more serious with the Revit API, further dedicated learning of the .NET programming framework (including the language) will be the next step.
Thanks for the compliments on the explanations in the My First Revit plugin series. Much appreciated,
kind regards
I'm just now starting the “My First Plug-in” with Revit 2013. I've copied & pasted the code from here: Lesson 1
& I get:
"Autodesk.Revit.DB.Reference' does not contain a definition for 'Element' and no extension method 'Element' accepting a first argument of type 'Autodesk.Revit.DB.Reference' could be found (are you missing a using directive or an assembly reference?)"
I found the fix at the beginning of this thread: Element elem = doc.GetElement(pickedRef);
& I know this was written for 2011, but the 2012 guys at least got a warning & a suggestions on how to fix it, now we don't even get that. Could you please at lease update the Lesson 1 code on the page above to use the correct code for us noobs starting from scratch...?
Sorry I posted in referance to the wrong message, my bad.
Oops, I guess I didn't read far enought.
I think you should move the note about the 2013 changes up at the bottom of section 10, not at the end of section 12.
The note on the changes with Revit 2013 has infact been included in # 12 since it is in this section that we are talking about compiling the code and if readers are using 2013 version of the API, they would see the error during compilation and see the note on how to fix it. This was the thought we had when we inserted the note on 2013 changes.
Glad to know you were able to work through the initial build errors.
thanks
Thanks for letting us know that the modifications have been done and it seems the build issues have been resolved.
Good luck!
Hi,
I hope this is the correct thread to post questions.
In lesson 4 I get the attached error message when clicking Start Debugging.
However, if I navigate to the named exe file it will launch Revit Arch 2013.
What have I done wrong please?
Jimi
Dear Jimi,
Thanks for letting us know this. Yes, this is the right place to give feedback on Revit's "My First Plug-in".
The error looks wield. I think it is kind of related to the specific enviornment.
Can you reproduce it in other computers?
Issue resolved.
the lesson 4 tutorial state this:
<PropertyGroup> . . . <StartAction>Program</StartAction> <StartProgram>C:\Program Files\Autodesk\Revit Architecture 201x\Program\Revit.exe </StartProgram> </PropertyGroup>
You are welcome, Jimi.
Thanks for confirming that the suggestion helped resolve the error.
Good luck!
I was able to build dll files successfully. But cont find it in External Tools section. Interestingly, i can manully load it and run. I am useing Revit 2013 student version and following steps exactly the way they explained in "My First Plug-in" page.
Thanks & Regards,
Basava
HI Basava,
The issue should be about the addin manifest file.
You need make sure that the manifest file contains the correct dll path and file name. And copy the addin manifest file to the right sub-folder.
Hello,
This "My First Plug-in" was updated for Revit 2014.
If you want to get more indepth guide for Revit 2014, please visit the Revit 2014 developer guide.
http://wikihelp.autodesk.com/Revit/enu/2014/Help/3665-Developers
Hey guys, I have a problem wih lesson 4.
With regard to getting this when i open "Lab1PlaceGroup.csproj" :
<PropertyGroup> . . . <StartAction>Program</StartAction> <StartProgram>C:\Program Files\Autodesk\Revit Architecture 201x\Program\Revit.exe</StartProgram> </PropertyGroup>
I get this:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>
Could someone offer some suggestions as to how to solve this problem please!!
I am having problem running Lesson 1. I am getting following error:
Failed to initialize the add-in “Lab1PlaceGroup” because the class “Lab1PlaceGroup” cannot be found in the add-in-assembly.
The FullClassName provides the entry point for Revit to call the add-in application. For Revit to run the add-in, you must ensure this class implements the “Autodesk.Revit.UIExternalCommand”
I am using VisualBasic Express 2013 and Revit Structure 2015. Here is my Manifiest file:
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>
C:\Users\xyz\Documents\Visual Studio 2013\Projects\Lab1PlaceGroup\Lab1PlaceGroup\obj\Debug\Lab1PlaceGroup.dll
</Assembly>
<ClientId>502fe383-2648-4e98-adf8-5e6047f9dc34</ClientId>
<FullClassName>Lab1PlaceGroup</FullClassName>
<Text>Lab1PlaceGroup</Text>
<VendorId>ADSK</VendorId>
<VisibilityMode>AlwaysVisible</VisibilityMode>
</AddIn>
</RevitAddIns>
Any help will be appriciated.
sjm
Hi,
I started the guide "My First Plug-in", I am using Revit 2015 and the framework 4.5 in Microsoft Visual Studio Express 2013.
I did manage to create the plugin Lab1PlaceGroup and get it to show in the Revit Add on Tab. I get to use the plugin and select the first group but when I pick a point to place group then I get the following error:
I hope you can give me any pointers here. I have been working with Revit since 2007 and have some programming background with MatLab but C# is new to me.
Regards
Johannes
Hello,
I'm having an problem with debugging in lesson #4.
At step 4 of lesson 4...
"At the end of this tag, i.e. right before the close tag , insert the two lines with the and node (highlighted in bold). The Lab1PlaceGroup.csproj file should look like this:"
After I place the two lines in theLab1PlaceGroup.csproj file and start debugging I get the following error in the Output window.
"The program '[8020] Revit.exe' has exited with code -529697949 (0xe06d7363) 'Microsoft C++ Exception'."
Please help and thank you,
Bernie
Lots of words in that error message but it appears that you have a problem at line 40. I'd review that line very carefully.