1
2
3ObjectId surfaceId = TinSurface.Create(_acaddoc.Database, "Example Surface");
4TinSurface surface = surfaceId.GetObject(OpenMode.ForWrite) as TinSurface;
5Point3dGenerator p3dgen = new Point3dGenerator();
6Point3dCollection locations = p3dgen.AsPoint3dCollection();
7surface.AddVertices(locations);
8
9
10
11
12
13Database acadDb = _acaddoc.Database;
14BlockTable blockTable = tr.GetObject(acadDb.BlockTableId, OpenMode.ForRead) as BlockTable;
15BlockTableRecord blockTableRec = tr.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
16
17Polyline polyline = new Polyline();
18polyline.SetDatabaseDefaults();
19polyline.AddVertexAt(0, new Point2d(10, 10), 0, 0, 0);
20polyline.AddVertexAt(1, new Point2d(20, 10), 0, 0, 0);
21polyline.AddVertexAt(2, new Point2d(40, 35), 0, 0, 0);
22polyline.AddVertexAt(3, new Point2d(60, 40), 0, 0, 0);
23polyline.Closed = false;
24blockTableRec.AppendEntity(polyline);
25tr.AddNewlyCreatedDBObject(polyline, true);
26
27
28
29
30Point3dCollection samples = surface.SampleElevations(polyline.ObjectId);
31foreach (Point3d point in samples)
32{
33 write(String.Format("Elevation at {0},{1}:{2}\n",
34 point.X, point.Y, point.Z));
35}