C# Macro for Revit - First sample
using System;
using Autodesk.Revit;
using Autodesk.Revit.Creation;
using Autodesk.Revit.Elements;
using Autodesk.Revit.Geometry;
using Autodesk.Revit.Symbols;
using Autodesk.Revit.Structural.Enums;
namespace versione2009
{
[System.AddIn.AddIn("ThisDocument", Version = "1.0", Publisher = "", Description = "")]
public partial class ThisDocument
{
private void Module_Startup(object sender, EventArgs e)
{
}
private void Module_Shutdown(object sender, EventArgs e)
{
}
#region VSTA generated code
private void InternalStartup()
{
this.Startup += new System.EventHandler(Module_Startup);
this.Shutdown += new System.EventHandler(Module_Shutdown);
}
#endregion
public void primoesempio()
{
string fileName = @"C:\Stefano\versionecsharp\pilastroFascia.rfa";
//prova a caricare la famiglia
FamilySymbol family = null;
string list = "pilastroFascia";
if (!Document.LoadFamilySymbol(fileName, list, out family))
{
throw new Exception("Unable to load " + fileName);
}
int i;
int n = 9;
for (i = 0; i <= n; i = i + 1)
{
XYZ location = Application.Create.NewXYZ(0.0, 0.0, i * 10);
FamilyInstance unico = Create.NewFamilyInstance(location, family, StructuralType.NonStructural);
Parameter generico = unico.get_Parameter("topolino");
generico.Set(Math.PI * 0.5 * i/10);
}
}
}
}
Commenti recenti