Message 1 of 2
Returning value from a function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear all,
I am trying to create a function to get the ElementId from the SolidPattern from FillPatternElement.
My functions seems fails to return the solidFillPatternId, instead, it seems returning a null(Not Sure).
Could anybody corrects my code if it is wrong?
//Get the Solid Fill Pattern public ElementId GetSolidFillPatternId(Document doc) { List<FillPatternElement> fillPatternList = new FilteredElementCollector(doc).WherePasses(new ElementClassFilter(typeof(FillPatternElement))). ToElements().Cast<FillPatternElement>().ToList(); ElementId solidFillPatternId = null; foreach (FillPatternElement fp in fillPatternList) { if (fp.GetFillPattern().IsSolidFill) { solidFillPatternId = fp.Id; } } return solidFillPatternId; }
Thanks!!