Revit secondary development experience and revit Secondary Development

Source: Internet
Author: User

Revit secondary development experience and revit Secondary Development

Recently I changed my work, and the previous Internet companies moved into BIM software development. The specific reason is not to mention that as a programmer, learning is endless. Below is a second development of Revit in the Hello World experience.

 

Prerequisites

VS

Revit 1, 2017

 

Two dll files are used in the secondary development of Revit to provide access to the project data in Revit. The two dll files are named RevitAPI. dll and RevitAPIUI. dll. Obtaining Method: In the Revit installation directory, my local Revit is installed on the elastic drive, E: \ Autodesk \ 2017 \ Revit 2017. These two files will exist in this path, copy it to your project and add it as a project reference or download it through Nuget.

 

 

Getting started with HelloWorld

 

1. Create a class library project named RevitHelloWorld, create a DLL folder, copy the two DLL files mentioned above, and finally introduce these two files into the project. The final effect is as follows:

 

 

2. Create a HelloCommand file and implement the IExternalCommand interface.

 

 

 

In the red box, you need to implement the functions you need.

In this example, the code is as follows:

 

Note that the above two features must be added. You can take a look at the specific functions. If you do not add it to Revit later, a prompt will be displayed.

 

 

Project compilation is obtained in the bin directory.

 

 

3. Open Revit and create a project

 

 

 

4. Add the previously written function to Revit.

 

Click the following interface:

 

Select Load to introduce the generated dll file.

 

 

Click the run button to see the effect of the Code.

 

 

 

The first HelloWorld function is complete.

 

Revit plug-in Startup Mode

Configure addin file startup

 

Create an addin file in this directory. The file content is as follows:

 

You can use VS to create a GUID under the tool menu and paste the generated data:

 

After that, start Revit. You can see in the attachment function:

 

 

Project debugging

 

In many cases, function development always requires debugging, so that you can track the execution steps of the program and discover possible defects in the code. Here we use VS for debugging.

 

 

 

Select revit.exe to attach the current program to Revit. Add breakpoints to the code.

 

 

In this case, you can see the following results by running the program in the following section:

 

 

 

 

Install the external tools and Revit Lookup in the attachment module.

The external tool is used to debug the program, while Revit Lookup is used to help developers find properties.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.