Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Check out the self-paced guide “My First Plug-in”

81 REPLIES 81
Reply
Message 1 of 82
saikat
17107 Views, 81 Replies

Check out the self-paced guide “My First Plug-in”

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

 



Saikat Bhattacharya
Senior Manager - Technology Consulting
Tags (2)
81 REPLIES 81
Message 21 of 82
saikat
in reply to: zhangle

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



Saikat Bhattacharya
Senior Manager - Technology Consulting
Message 22 of 82
b_ralphs
in reply to: saikat

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...?

Message 23 of 82
jaboone
in reply to: plawton5092

Sorry I posted in referance to the wrong message, my bad.

Learning as I go
Message 24 of 82
b_ralphs
in reply to: b_ralphs

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.

Message 25 of 82
jboone
in reply to: b_ralphs

My apologize. I read the wrong statement. I made a mod already. Sorry. JAMES BOONE Electrical Designer STEVENS & WILKINSON ARCHITECTURE ENGINEERING INTERIORS 1501 Main St. Columbia, SC 29201 D 803.576.5371 | T 803.765.0320 | F 803.254.6209 E jboone@stevens-wilkinson.com | www.stevens-wilkinson.com The information contained in this electronic mail message is confidential, may be privileged and is intended for the use of the individual or entity above. Only the addressee, or person(s) authorized by the addressee, has permission to disseminate, distribute, or copy this message. If you have received this message in error, please notify the sender immediately. Thank you.
Message 26 of 82
saikat
in reply to: saikat

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

 



Saikat Bhattacharya
Senior Manager - Technology Consulting
Message 27 of 82
saikat
in reply to: jboone

Thanks for letting us know that the modifications have been done and it seems the build issues have been resolved.

 

Good luck!



Saikat Bhattacharya
Senior Manager - Technology Consulting
Message 28 of 82
bimandict
in reply to: saikat

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

Regards,


Jimi Clarke

BIM Manager - London
Microsoft Cloud Services Partner
Message 29 of 82
Joe.Ye
in reply to: bimandict

 

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?



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 30 of 82
bimandict
in reply to: bimandict

Issue resolved.

 

the lesson 4 tutorial state this:

  • At the end of this tag, i.e. right before the close tag </PropertyGroup>, insert the two lines with the <StartAction> and <StartProgram> node (highlighted in bold). The Lab1PlaceGroup.csproj file should look like this:
      <PropertyGroup>
        . . .
        <StartAction>Program</StartAction>
        <StartProgram>C:\Program Files\Autodesk\Revit Architecture 201x\Program\Revit.exe         </StartProgram>  </PropertyGroup>
    The fix to the issue:
    "The StartProgram line being split across multiple lines. Can you change this line to be the following."
    Revit API fix.jpg
    Thank you Saikat.
     
    Joe, I could not test on another PC as I do this training in isolation.
     
    Regards,
     
    Jimi
Regards,


Jimi Clarke

BIM Manager - London
Microsoft Cloud Services Partner
Message 31 of 82
saikat
in reply to: saikat

You are welcome, Jimi.

 

Thanks for confirming that the suggestion helped resolve the error.

 

Good luck!



Saikat Bhattacharya
Senior Manager - Technology Consulting
Message 32 of 82
basava
in reply to: saikat

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

Tags (1)
Message 33 of 82
jalcarazsd
in reply to: saikat

Will there be a 2014 guide?

Message 34 of 82
Joe.Ye
in reply to: 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.

 



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 35 of 82
Joe.Ye
in reply to: jalcarazsd

 

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

 



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 36 of 82
tangjingyuanivan
in reply to: saikat

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!!

Message 37 of 82
sjmacad
in reply to: saikat

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

 

Message 38 of 82

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:

 

error Revit.PNG

 

 

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

 

Message 39 of 82
Anonymous
in reply to: saikat

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

Message 40 of 82
Anonymous
in reply to: johannes.bjarnason

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community