博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Revit API遍历房间Room创建空间Space
阅读量:7006 次
发布时间:2019-06-27

本文共 929 字,大约阅读时间需要 3 分钟。

遍历全部房间,为每个房间创建对应的空间。
[TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public
 
class
 cmdRoom : IExternalCommand
{
    
public
 Result Execute(ExternalCommandData commandData, 
ref
 
string
 messages, ElementSet elements)
    {
        UIApplication uiApp 
=
 commandData.Application;
        Document doc 
=
 uiApp.ActiveUIDocument.Document;
        Selection sel 
=
 uiApp.ActiveUIDocument.Selection;
        Transaction ts 
=
 
new
 Transaction(doc, 
"
http://revit.5d6d.com
"
);
        ts.Start();
        
//
遍历所有房间
        FilteredElementCollector collector 
=
 
new
 FilteredElementCollector(doc);
        collector.OfCategory(BuiltInCategory.OST_Rooms);
        
foreach
 (Element el 
in
 collector)
        {
            Room room 
=
 el 
as
 Room;
            LocationPoint roomPoint 
=
 room.Location 
as
 LocationPoint;
            
//
为房间创建空间
            doc.Create.NewSpace(room.Level, 
new
 UV(roomPoint.Point.X, roomPoint.Point.Y));
        }
        ts.Commit();
        
return
 Result.Succeeded;
    }
}
from:

转载于:https://www.cnblogs.com/greatverve/archive/2012/01/01/api-all-room-space.html

你可能感兴趣的文章
VNC重启无法使用问题(原创)
查看>>
iOS HealthKit 使用方法和注意点
查看>>
浅谈HTTPS
查看>>
优化 Go 中的 map 并发存取
查看>>
style-loader详细使用说明
查看>>
socket.io
查看>>
line-height和vertical-align实现多行文字水平垂直居中效果
查看>>
手拉手教你实现一门编程语言 Enkel, 系列 18
查看>>
iOS 自定义日历(日期选择)控件
查看>>
postMessage 简介
查看>>
双向通信之Comet
查看>>
http请求参数之Query String Parameters、Form Data、Request Payload
查看>>
论道经营分析体系的建设 - 《用数据决策》读后感
查看>>
手把手教你在Flutter项目优雅的使用ORM数据库--下篇
查看>>
前端时光机(神技)
查看>>
阿里巴巴普惠体前端应用
查看>>
每周分享第 8 期(20181228)
查看>>
微商怎么引流精准客源微商怎么加好友快速成交
查看>>
计算机网络之网络配置基础
查看>>
GuavaCache入门
查看>>