|
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;
}
}
}
|
|