给我一段revit中生成柱子的代码
时间: 2023-03-15 17:38:25 浏览: 184
答:在Revit中生成柱子的代码示例如下:Document doc = this.ActiveUIDocument.Document;// Create a new family instance of a column
FamilyInstance column = doc.Create.NewFamilyInstance(new XYZ(0, 0, 0), doc.FamilyLibrary.get_Item("Column"), StructuralType.Column);// Set the parameters of the column
column.Symbol.LookupParameter("Width").Set(1.2);
column.Symbol.LookupParameter("Height").Set(3.5);
相关问题
给我一段在revit里生成柱子的代码
在Revit里生成柱子的代码如下:using Autodesk.Revit.DB;
using Autodesk.Revit.UI;namespace GenerateColumns
{
public class GenerateColumns
{
public void GenerateColumn(Document doc)
{
// 创建柱子
FamilySymbol columnType = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).Cast<FamilySymbol>().FirstOrDefault(x => x.Name == "柱子");
if (columnType != null)
{
// 创建参照点
XYZ point = new XYZ(0, 0, 0);
// 创建柱子
FamilyInstance column = doc.Create.NewFamilyInstance(point, columnType, Autodesk.Revit.DB.Structure.StructuralType.Column);
}
}
}
}
给我一段revit生成柱子的C#代码
在Revit中,可以使用以下代码来生成柱子:Document doc = uidoc.Document;FamilySymbol columnSymbol = new FilteredElementCollector(doc) .OfClass(typeof(FamilySymbol)) .WhereElementIsElementType() .Cast<FamilySymbol>() .FirstOrDefault(s => s.Family.Name == "Column");// Create the columnLocationPoint point = new XYZ(0, 0, 0);Level level = new FilteredElementCollector(doc).OfClass(typeof(Level)).Cast<Level>().FirstOrDefault(l => l.Name == "Level 1");if (columnSymbol != null) {FamilyInstance column = doc.Create.NewFamilyInstance(point, columnSymbol, level, StructuralType.NonStructural);}
阅读全文