Message 1 of 6
Applying a number value to a parameter based on Text parameter

Not applicable
12-08-2014
08:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I wrote a code for 2015 that should apply a number based on the discipline that is applied to the sheet, and i want to have a version that applies to sheets only or to sheets and placeholders. I cant get the place holder filter to work correctly. If i remove the placeholder and just run the build it builds a solution but causes an error when running within revit. Any suggestions would be appreciated
public void Ranking() { Document doc = this.Document; FilteredElementCollector collector = new FilteredElementCollector(doc).OfClass(typeof(ViewSheet)).WhereElementIsNotElementType(ViewSheet.IsPlaceholder); using(Transaction trans = new Transaction(doc, "DrawinglistRank")) { trans.Start(); int sheetRank = 1; foreach (Element Sheet in collector){ Parameter paramDisc = Sheet.LookupParameter("SHEET DISCIPLINE"); string sheetDiscipline = paramDisc.AsString(); sheetRank+=1; if(sheetDiscipline == "GENERAL"){ sheetRank=1; }else if(sheetDiscipline == "ARCHITECTURAL"){ sheetRank=2; }else if(sheetDiscipline == "MECHANICAL"){ sheetRank=3; }else if(sheetDiscipline == "ELECTRICAL"){ sheetRank=4; }else if(sheetDiscipline == "PLUMBING"){ sheetRank=5; }else if(sheetDiscipline == "FIREPROTECTION"){ sheetRank=6;} Parameter paramRank = Sheet.LookupParameter("DISCIPLINE_RANK"); paramRank.Set(sheetRank); trans.Commit(); } TaskDialog.Show("Drawing List", "Drawing List Has Been Updated"); } }