代码之家  ›  专栏  ›  技术社区  ›  Uchiha Itachi

Revit元素。到XYZ的位置

  •  1
  • Uchiha Itachi  · 技术社区  · 8 年前

    我正在尝试创建一个 List<XYZ> XYZ[ ] 来自 List<Element> 二者都 Location XYZ 是Autodesk.Revit的成员。DB命名空间,但似乎没有转换方法。有人知道吗,或者你创造了一些可以帮助我的东西?

    1 回复  |  直到 8 年前
        1
  •  6
  •   Jeremy Tammik    8 年前

    当然下面是:

      List<Element> walls = new List<Element>();
    
      XYZ p;
      List<XYZ> wall_start_points
        = walls.Select<Element, XYZ>( e => {
          Util.GetElementLocation( out p, e );
            return p; } )
              .ToList<XYZ>();
    

    这使用 GetElementLocation 在构建编码器样本中定义的方法 Util 类别:

    https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/Util.cs#L873-L910