Message 1 of 6

Not applicable
05-20-2018
06:45 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi.
I want to create dimensions between grids.
I tried two ways but it fails.
the first is
List<Curve> gridCurves = new List<Curve>(); var grids = new FilteredElementCollector(doc).OfClass(typeof(Grid)).Cast<Grid>(); foreach (var grid in grids) { var curves = grid.GetCurvesInView(DatumExtentType.ViewSpecific, view); // grid.GetCurvesInView(DatumExtentType.Model, view); if (curves.Count() > 0) { if (curves.first().Reference != null) gridCurves.Add(curves.First()); } }
and the second is
var options = new Options(); options.ComputeReferences = true; options.IncludeNonVisibleObjects = true; options.View = view; List<Curve> gridCurves = new List<Curve>(); var grids = new FilteredElementCollector(doc).OfClass(typeof(Grid)).Cast<Grid>(); foreach (var grid in grids) { foreach (GeometryObject geoObj in grid.get_Geometry(options)) { if (geoObj is Line) { var line = geoObj as Line; if (line.Reference != null) gridCurves.Add(line); } } }
oh, and I tried grid.Curve.GetEndPointReference(0);
I can't get the reference for the grid.
null reference error when creating dimension.
I need your help!
thank you 🙂
Solved! Go to Solution.