• 大小: 26KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-01
  • 语言: 其他
  • 标签: revit开发  

资源简介

里面是revit二次开发一个实例,还有一个视频,文件太大一起传不上去。就分开传的,在我上传资源里有一个详细说明怎么弄sdk最后到获取revit信息的视频 。这个是一个实例

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using System.Windows.Forms;
using Autodesk.Revit.UI.Selection;


namespace RevitDevTV
{
    [Transaction(TransactionMode.Automatic)]
    [Regeneration(RegenerationOption.Automatic)]
    public class DevTVHelloworld :IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData ref string messages ElementSet elements)
        {
            MessageBox.Show(“Hello World created from DevTV“);
            return Result.Succeeded;
        }        
    }

    [Transaction(TransactionMode.Automatic)]
    [Regeneration(RegenerationOption.Automatic)]
    public class ArgumentUsage : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData ref string messages ElementSet elements)
        {
            UIApplication uiApp = commandData.Application;
            Autodesk.Revit.ApplicationServices.Application app = uiApp.Application;
            Document doc = uiApp.ActiveUIDocument.Document;

            string strAppInfo = app.VersionBuild + “;“ + app.VersionName + “;“ + app.VersionNumber;
            Autodesk.Revit.UI.Selection.Selection sel = uiApp.ActiveUIDocument.Selection;
            foreach (Element elem in sel.Elements)
            {
                elements.Insert(elem);
            }

            messages = “当前选择集中包含如下对象“;

            //为了显示错误信息框需要返回Failed
            return Result.Failed;
        }
    }

    [Transaction(TransactionMode.Automatic)]
    [Regeneration(RegenerationOption.Automatic)]
    public class StartAPP : IExternalApplication
    {
        public Result onstartup(UIControlledApplication app)
        {
            MessageBox.Show(“Revit is starting“);
            return Result.Succeeded;
        }
        public Result OnShutdown(UIControlledApplication app)
        {
            MessageBox.Show(“Revit is existing“);
            return Result.Succeeded;
        }
       
    }

    [Transaction(TransactionMode.Automatic)]
    [Regeneration(RegenerationOption.Automatic)]
    public class GetAllWindows : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData ref string messages ElementSet elements)
        {
            UIApplication uiApp = commandData.Application;
            Autodesk.Revit.ApplicationServices.Application app = uiApp.Application;
            Document doc = uiApp.ActiveUIDocument.Document;

            //获得所有窗户
            FilteredElementCollector collector = new FilteredElementCollector(doc);
            collector.OfClass(typeof(FamilyInstance)).OfCategory(BuiltInCategory.OST_Windows);
            IList lists = collector.ToElements();
            string strMsg = string.Format(“There are {0} windows in current model“ lists.Coun

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       9216  2010-05-13 18:33  RevitDevTV\RevitDevTV\bin\Debug\RevitDevTV.dll

     文件      22016  2010-05-13 18:33  RevitDevTV\RevitDevTV\bin\Debug\RevitDevTV.pdb

     文件       8191  2010-05-13 18:33  RevitDevTV\RevitDevTV\Class1.cs

     文件      41388  2010-05-13 17:23  RevitDevTV\RevitDevTV\obj\Debug\ResolveAssemblyReference.cache

     文件        521  2010-05-13 18:06  RevitDevTV\RevitDevTV\obj\Debug\RevitDevTV.csproj.FileListAbsolute.txt

     文件       9216  2010-05-13 18:33  RevitDevTV\RevitDevTV\obj\Debug\RevitDevTV.dll

     文件      22016  2010-05-13 18:33  RevitDevTV\RevitDevTV\obj\Debug\RevitDevTV.pdb

     文件       1460  2010-05-13 17:12  RevitDevTV\RevitDevTV\Properties\AssemblyInfo.cs

     文件       3186  2010-05-13 17:23  RevitDevTV\RevitDevTV\RevitDevTV.csproj

     文件        920  2010-05-13 17:12  RevitDevTV\RevitDevTV.sln

    ..A..H.     22016  2010-05-18 10:14  RevitDevTV\RevitDevTV.suo

     目录          0  2010-05-13 17:23  RevitDevTV\RevitDevTV\bin\Debug\en-US

     目录          0  2010-05-13 17:23  RevitDevTV\RevitDevTV\bin\Debug\zh-CN

     目录          0  2010-05-13 17:12  RevitDevTV\RevitDevTV\obj\Debug\TempPE

     目录          0  2010-05-13 17:23  RevitDevTV\RevitDevTV\bin\Debug

     目录          0  2010-05-13 18:33  RevitDevTV\RevitDevTV\obj\Debug

     目录          0  2010-05-13 17:11  RevitDevTV\RevitDevTV\bin

     目录          0  2010-05-13 17:11  RevitDevTV\RevitDevTV\obj

     目录          0  2010-05-13 17:12  RevitDevTV\RevitDevTV\Properties

     目录          0  2010-05-13 18:33  RevitDevTV\RevitDevTV

     目录          0  2015-11-10 14:13  RevitDevTV

----------- ---------  ---------- -----  ----

               140146                    21


评论

共有 条评论

相关资源