Revit 2016 unable to retrieve grid.Curve

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to retrieve the curve property of a grid object in my Revit 2016 document, but somehow it's not working. When I debug my code VS tells me grid.Curve is null. But I can't figure out why.
I've based my code on this example: https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/Revit-API/files/GUID-...
foreach (Grid gridinstance in xxGrids) { if (gridinstance.IsCurved) { Arc arc = gridinstance.Curve as Arc; } else { Line line = gridinstance.Curve as Line; } }
xxGrids in this case is a list of Grid objects and is populated with some orthogonal grid objects. The IsCurved property of all of them is false, so I should be able to retrieve a line object based on the grid.Curve property but this is always null.
When I use the snoop current selection tool I can see that the curve property is an actual line with endpoint coordinates and more. Why can't I retrieve this via code?
Anybody any thought on this?
Thanks in advance..