- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I referred to Jeremy's Post "Inserting a Column" at Revit 2019, but there are errors .
-CmdResult
-Filter
-doc.get_Elements
CmdResult rc = CmdResult.Failed; Application app = commandData.Application; Document doc = app.ActiveDocument; List<Element> symbols = new List<Element>(); Filter filter = app.Create.Filter.NewFamilyFilter( family_name ); doc.get_Elements( filter, symbols );
So i tried another way but the errors too.
This code is my second try.
// Get a Column type from Revit
FilteredElementCollector collector = new FilteredElementCollector(doc);
collector.OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_StructuralColumns);
FamilySymbol columnType = collector.FirstElement() as FamilySymbol;
Level level = Level.Create(doc, 20);
FamilyInstance instance = null;
if (null != columnType)
{
// Create a column at the origin
XYZ origin = new XYZ(0, 0, 0);
instance = doc.Create.NewFamilyInstance(origin, columnType, level, StructuralType.Column);
}
Someone helps me plz!
I use c#.
Solved! Go to Solution.