- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm starting C# programming and I'm trying to run this code to understand how it works. I'm interested in being able to insert columns. Can you help me understand why I can't run it. Thank you so much
#region Creando un pilar Metodo 2 ICollection BatchCreateColumns(Autodesk.Revit.DB.Document document, Level level) { List fiCreationDatas = new List(); ICollection elementSet = null; //Try to get a FamilySymbol FamilySymbol familySymbol = null; FilteredElementCollector collector = new FilteredElementCollector(document); 1ICollection collection = collector.OfClass(typeof(FamilySymbol)).ToElements(); foreach (Element e in collection) { familySymbol = e as FamilySymbol; if (null != familySymbol.Category) { if ("Structural Columns" == familySymbol.Category.Name) { break; } } } if (null != familySymbol) { //Create 10 FamilyInstanceCreationData items for batch creation for (int i = 1; i < 11; i++) { XYZ location = new XYZ(i * 10, 100, 0); FamilyInstanceCreationData fiCreationData = new FamilyInstanceCreationData(location, familySymbol, level, StructuralType.Column); if (null != fiCreationData) { fiCreationDatas.Add(fiCreationData); } } if (fiCreationDatas.Count > 0) { // Create Columns elementSet = document.Create.NewFamilyInstances2(fiCreationDatas); } else { throw new Exception("Batch creation failed."); } } else { throw new Exception("No column types found."); } return elementSet; } #endregion
Solved! Go to Solution.