Looking for C++ Samples for Revit 2017 AddIn

Looking for C++ Samples for Revit 2017 AddIn

Anonymous
Not applicable
2,916 Views
6 Replies
Message 1 of 7

Looking for C++ Samples for Revit 2017 AddIn

Anonymous
Not applicable

As I look through the Revit 2017 documentation it looks like C++ has become nearly a first class citizen. I am mostly familiar with starting AddIn Revit AddIn projects using the AddIn Wizard for C#. Is there something comparable for C++? And/or is there sample code or a tutorial on implementing a Revit 2017 AddIn using C++ instead of C# or VB? 

0 Likes
2,917 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable

I don't think that there are c++ samples. Found this post though:

http://thebuildingcoder.typepad.com/blog/2010/10/c-revit-add-in.html

 

0 Likes
Message 3 of 7

jeremytammik
Autodesk
Autodesk

This thread is a duplicate of 

 

http://forums.autodesk.com/t5/revit-api-forum/looks-for-c-samples-for-revit-2017-addin/m-p/6744702

 

C++ has always been a first-class citizen in the .NET world, just like any other language supporting .NET, which was added to C++ with the introduction of managed C++ over a decade ago.

 

The Visual Studio C# and VB .NET wizards are very easy to create from scratch, and so is a C++ Revit add-in and a wizard for it.

 

  • Use the standard Visual Studio class wizard to create a class.
  • Add references to the Revit API assemblies.
  • Implement an external command or external application.
  • Done.

 

The files that you create manually through these steps can be packaged into a ZIP file and reused to create a Revit C++ add-in wizard.

 

Look at the descriptions of creating, modifying and updating the C# and VB wizards to see how the same can be achieved for C++:

 

 

Here is an old description of a C++ Revit add-in and some other discussions on related topics::

 

 

I wish you lots of fun and success making use of C++ with the Revit API!

 

Please let us know how it goes and what you find out.

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 4 of 7

Anonymous
Not applicable

Thank you! I like the Visual C++ Revit Add-In step-by-step article. Regrettably the Visual Studio 2015 "New Project" function no longer includes "Class Library" as one of its options (screen shot provided below). Any thoughts on the alternative "New Project" template to utilize to initially create C++ based Revit Add-In in Visual Studio 15 for Revit 2017? Or if is a recommendation on which version of the .NET Framework to select?

0 Likes
Message 5 of 7

Anonymous
Not applicable

Can't help you with the template, but the .NET framework I can, that should be 4.5 or higher, since Reivt 2017 needs 4.5 or higher.

0 Likes
Message 6 of 7

jeremytammik
Autodesk
Autodesk

Visual Studio > File > New > Project > Templates > Other Languages > Visual C++ > CLR > Class Library.

 

Add references to the Revit API assemblies.

 

Implement your external application or command.

 

The Revit 2017 API requires version the .NET framework version 4.5.2.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 7 of 7

jeremytammik
Autodesk
Autodesk

I summarised, cleaned up and published this Q&A on the blog:

 

http://thebuildingcoder.typepad.com/blog/2016/12/viewport-bring-to-front-and-c-revit-add-in.html#4

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes