EaBIM

标题: 大神求助看看这个代码怎么改才能用 [打印本页]

作者: fjz666    时间: 2017-4-18 11:03
标题: 大神求助看看这个代码怎么改才能用
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.UI.Selection;



[TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class RevitCommand : IExternalCommand
{
    public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
    {
   
       FilteredElementCollector collector = new FilteredElementCollector(document);
       ICollection<Element>collection=collector.OfClass(typeof(FamilySymbol)).ToElements();


foreach (Element d in collection)
{
  familysymbol = d as FamilySymbol;
if (null != familysymbol.Category)
    {
     if (familysymbol.Name == "自建族名称")
       {
        fs = familysymbol as Family Symbol;
        break;
        }
     }
}

a = curve.Length * 304.8;
b = 7200.00;  
while (c < 1)
{
XYZ location = new XYZ(curve.Evaluate(c, true).X, curve.Evaluate(c, true).Y , curve.Evaluate(c, true).Z);
Family Instance  instance  =  document.Create.New Family Instance(location,  fs,
Structural Type.Non Structural);
i += 1;
c = b * i / a;
}
    }
}

作者: EaBIM门户编辑    时间: 2017-5-8 10:14
很好。 来学习一下
作者: EaBIM门户编辑    时间: 2017-5-16 10:33
来学习
作者: EaBIM门户编辑    时间: 2017-5-23 10:28
只想充实在知识的海洋
作者: EaBIM门户编辑    时间: 2017-5-26 10:17
很好的呢




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