Beginners Guide to Getting Started with Revit API
This video is an introduction for beginners on how to setup a Visual Studio project for Revit 2017. It’s helpful for someone learning the Revit API to understand the first steps on how the Visual Studio code interacts with Revit.
The first sample is starting the project with a blank page. The steps need to setup the copying of the files to the add-ins folder. How to setup the project to launch Revit. The IExternalCommand and the Execute code in your class file. How to setup the manifest file that is the check point for your project. Where to find the Revit API libraries “RevitAPI” and “RevitAPIUI”.
The second sample is using a Revit wizard add-in template which you can download. The project is ready to be debugged with just a couple of adjustments. This is recommended for someone interested in getting started quickly.
Useful items for this video are:
Text to copy files to add-ins folder:
copy "$(TargetDir)*.*" "$(AppData)\Autodesk\REVIT\Addins\2017\”
Location of Revit.exe:
C:\Program Files\Autodesk\Revit 2017\Revit.exe
Give Revit access to launch:
Options>Debugging>Use Managed Compatibility Mode
A sample of Manifest code:
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Text>Command helloWorld</Text>
<Description>Some description for helloWorld</Description>
<Assembly>helloWorld.dll</Assembly>
<FullClassName>helloWorld.Command</FullClassName>
<ClientId>45648a45-5646-4ddf-b4e3-bb50f9134fcc</ClientId>
<VendorId>com.typepad.thebuildingcoder</VendorId>
<VendorDescription>The Building Coder, http://thebuildingcoder.typepad.com</VendorDescription>
</AddIn>
</RevitAddIns>
Sample of Class code:
[Transaction(TransactionMode.Manual)]
public class Command : IExternalCommand
{
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
return Result.Succeeded;
}
}
The Building Coder Website:
Comments
Post a Comment