Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write the code of Revit development template

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the Revit development template code how to write the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this Revit development template code how to write the article will have a harvest, let's take a look at it.

The code is as follows:

Using System

Using System.Collections.Generic

Using System.Linq

Using System.Text

Using System.Windows.Forms

Using System.IO

References to the using System.Data; system part

This paragraph is a reference so that we can write fewer lines of code.

References to the using Autodesk.Revit; Revit section

Using Autodesk.Revit.UI

Using Autodesk.Revit.UI.Selection

Using Autodesk.Revit.DB

Using Autodesk.Revit.DB.Architecture

For example: Selection se = uiDoc.Selection;// Select component

If we don't quote it, we have to write:

Autodesk.Revit.UI.Selection.Selection se = uiDoc.Selection

Whether it is troublesome or not, therefore, using reference space can give us time to scratch our feet.

/ / the long section below is the program template, which will be explained later. It would be nice for everyone to save it and use it as a template.

Namespace template

{

[Autodesk.Revit.Attributes.Transaction (Autodesk.Revit.Attributes.TransactionMode.Manual)]

[Autodesk.Revit.Attributes.Regeneration (Autodesk.Revit.Attributes.RegenerationOption.Manual)]

[Autodesk.Revit.Attributes.Journaling (Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]

Public class CheckCode: IExternalCommand

{

Public Autodesk.Revit.UI.Result Execute (ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)

{

/ / create an application object

Autodesk.Revit.ApplicationServices.Application app = commandData.Application.Application

/ / create a document object

Autodesk.Revit.DB.Document doc = commandData.Application.ActiveUIDocument.Document

/ / create an application object

Autodesk.Revit.UI.UIApplication uiapp = commandData.Application

/ / create a document object

Autodesk.Revit.UI.UIDocument uiDoc = uiapp.ActiveUIDocument

/ / start transaction

Transaction ts = new Transaction (doc, "standard check")

Ts.Start ()

Write code in between

Ts.Commit ()

Return Result.Succeeded

This is the end of the article on "how to write the code for Revit development templates". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to write the code of the Revit development template". If you want to learn more knowledge, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report