Revit建筑2012:如何改变幕墙中的任何墙壁以及如何管理幕墙线

本文关键字:管理 任何墙 何管理 改变 2012 Revit 何改变 建筑 | 更新日期: 2023-09-27 18:03:20

我有一个程序,可以选择一面墙,得到不同的参数,但是我不知道如何改变幕墙中的一面墙。然后我想控制墙壁上线条的数量和具体位置。我加入我的代码,但它不工作。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB.Structure;
namespace test2011
{
  [TransactionAttribute(TransactionMode.Automatic)]
  [RegenerationAttribute(RegenerationOption.Manual)]
  public class Class1 : IExternalCommand
  {
    public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, 
      ref string message, ElementSet elements)
    {
      // Select some elements in Revit before invoking this command
      // Get the handle of current document.
      UIDocument uidoc = commandData.Application.ActiveUIDocument;
      // Get the element selection of current document.
      Selection selection = uidoc.Selection;
      ElementSet collection = selection.Elements;
      if (0 == collection.Size)
      {
        // If no elements selected.
        TaskDialog.Show("Revit", "You haven't selected any elements.");
      }
      else
      {
        TaskDialog.Show("revit", "On entre dans le else");
        foreach (Wall wall in collection)
        {
          LocationCurve locationCurve = wall.Location as LocationCurve;
          XYZ endPoint0 = locationCurve.Curve.get_EndPoint(0);
          XYZ endPoint1 = locationCurve.Curve.get_EndPoint(1);
          TaskDialog.Show("revit", "point 0: " + endPoint0.ToString() + 
                                   " 'npoint 1: " + endPoint1.ToString()+
                                   " 'nWallType: "+ 
                                   wall.WallType.Kind.ToString());
          //Create curtain line
          //Create the Points
          double x1 = endPoint0.X;
          double y1 = endPoint0.Y - 3;
          double z = endPoint0.Z;
          double x2 = endPoint1.X;
          double y2 = endPoint1.Y - 3;
          XYZ point1 = uidoc.Application.Application.Create.NewXYZ(x1, y1, z);
          XYZ point2 = uidoc.Application.Application.Create.NewXYZ(x2, y2, z);
          //Create line
          Line line = 
            uidoc.Application.Application.Create.NewLineBound(point1, point2);
          DetailCurve detailCurve = 
            uidoc.Document.Create.NewDetailCurve(uidoc.Document.ActiveView, 
              line);
          TaskDialog.Show("Done", "Line Created");
        }
      }
      return Result.Succeeded;
    }
  }
}

Revit建筑2012:如何改变幕墙中的任何墙壁以及如何管理幕墙线

使用一些RevitPythonShell功夫,这里有一些Revit API用于将选定的墙设置为幕墙:

# get the selected wall
wall = selection[0]
# find a curtain wall type
wallTypes = list(FilteredElementCollector(doc).OfClass(WallType))
curtainWallType = [wt for wt in wallTypes if wt.Kind == WallKind.Curtain][0]
# set the wall type
transaction = Transaction(doc, 'Setting wall type to curtain wall')
transaction.Start()
wall.WallType = curtainWallType
transaction.Commit()