EaBIM

标题: Revit API根据房间Room创建空间Space [打印本页]

作者: 萧闫子    时间: 2014-1-9 12:33
标题: Revit API根据房间Room创建空间Space

根据房间的Level和Location得到NewSpace()的参数Level和UV

  1. [TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]
  2. public class cmdRoom : IExternalCommand
  3. {
  4.     public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
  5.     {
  6.         UIApplication uiApp = commandData.Application;
  7.         Document doc = uiApp.ActiveUIDocument.Document;
  8.         Selection sel = uiApp.ActiveUIDocument.Selection;

  9.         Transaction ts = new Transaction(doc, "http://revit.5d6d.com");
  10.         ts.Start();

  11.         Room room = doc.GetElement(sel.PickObject(ObjectType.Element, "选择一个房间")) as Room;
  12.         LocationPoint roomPoint = room.Location as LocationPoint;
  13.         //doc.Create.NewSpace(room.Level, room.PhaseCreated, new UV(roomPoint.Point.X, roomPoint.Point.Y));
  14.         doc.Create.NewSpace(room.Level, new UV(roomPoint.Point.X, roomPoint.Point.Y));

  15.         ts.Commit();

  16.         return Result.Succeeded;
  17.     }
  18. }
复制代码
from:
http://revit.5d6d.com/thread-1314-1-1.html



作者: 月の月    时间: 2014-2-20 14:47
顶起来…………




欢迎光临 EaBIM (https://eabim.net/) Powered by Discuz! X3.2