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

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

saikat
Autodesk Autodesk
21,195 Views
81 Replies
Message 1 of 82

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

saikat
Autodesk
Autodesk

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
21,196 Views
81 Replies
Replies (81)
Message 21 of 82

saikat
Autodesk
Autodesk

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
0 Likes
Message 22 of 82

b_ralphs
Advocate
Advocate

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

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

Learning as I go
0 Likes
Message 24 of 82

b_ralphs
Advocate
Advocate

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

Anonymous
Not applicable
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
Autodesk
Autodesk

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

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
0 Likes
Message 28 of 82

Anonymous
Not applicable

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

0 Likes
Message 29 of 82

Joe.Ye
Alumni
Alumni

 

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
0 Likes
Message 30 of 82

Anonymous
Not applicable

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
0 Likes
Message 31 of 82

saikat
Autodesk
Autodesk

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

Anonymous
Not applicable

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

0 Likes
Message 33 of 82

Anonymous
Not applicable

Will there be a 2014 guide?

0 Likes
Message 34 of 82

Joe.Ye
Alumni
Alumni

 

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
0 Likes
Message 35 of 82

Joe.Ye
Alumni
Alumni

 

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
0 Likes
Message 36 of 82

Anonymous
Not applicable

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

0 Likes
Message 37 of 82

sjmacad
Participant
Participant

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

 

0 Likes
Message 38 of 82

Anonymous
Not applicable

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

 

0 Likes
Message 39 of 82

Anonymous
Not applicable

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

0 Likes
Message 40 of 82

Anonymous
Not applicable

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.

0 Likes