Grid |
The GridSurfaceProperties type exposes the following members.
Name | Description | |
---|---|---|
![]() | Orientation | Gets the orientation of the grid (in degrees). |
![]() | SpacingX | Gets the distance between the grid lines in the X direction. |
![]() | SpacingY | Gets the distance between the grid lines in the Y direction. |
1/// <summary> 2/// Illustrates accessing Surface properties 3/// </summary> 4[CommandMethod("SurfaceProperties")] 5public void SurfaceProperties() 6{ 7 using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction()) 8 { 9 try 10 { 11 // Get the first surface in a document 12 // "doc" is the CivilApplication.ActiveDocument 13 ObjectId surfaceId = doc.GetSurfaceIds()[0]; 14 CivSurface oSurface = surfaceId.GetObject(OpenMode.ForRead) as CivSurface; 15 16 // print out general properties: 17 GeneralSurfaceProperties genProps = oSurface.GetGeneralProperties(); 18 String propsMsg = "\nGeneral Properties for " + oSurface.Name; 19 propsMsg += "\n-------------------"; 20 propsMsg += "\nMin X: " + genProps.MinimumCoordinateX; 21 propsMsg += "\nMin Y: " + genProps.MinimumCoordinateY; 22 propsMsg += "\nMin Z: " + genProps.MinimumElevation; 23 propsMsg += "\nMax X: " + genProps.MaximumCoordinateX; 24 propsMsg += "\nMax Y: " + genProps.MaximumCoordinateY; 25 propsMsg += "\nMax Z: " + genProps.MaximumElevation; 26 propsMsg += "\nMean Elevation: " + genProps.MeanElevation; 27 propsMsg += "\nNumber of Points: " + genProps.NumberOfPoints; 28 propsMsg += "\n--"; 29 30 editor.WriteMessage(propsMsg); 31 32 // Depending on the surface type, let's look at grid or TIN properties: 33 34 if (oSurface is TinSurface) 35 { 36 TinSurfaceProperties tinProps = ((TinSurface)oSurface).GetTinProperties(); 37 propsMsg = "\nTIN Surface Properties for " + oSurface.Name; 38 propsMsg += "\n-------------------"; 39 propsMsg += "\nMin Triangle Area: " + tinProps.MinimumTriangleArea; 40 propsMsg += "\nMin Triangle Length: " + tinProps.MinimumTriangleLength; 41 propsMsg += "\nMax Triangle Area: " + tinProps.MaximumTriangleArea; 42 propsMsg += "\nMax Triangle Length: " + tinProps.MaximumTriangleLength; 43 propsMsg += "\nNumber of Triangles: " + tinProps.NumberOfTriangles; 44 propsMsg += "\n--"; 45 46 editor.WriteMessage(propsMsg); 47 } 48 else if (oSurface is GridSurface) 49 { 50 GridSurfaceProperties gridProps = ((GridSurface)oSurface).GetGridProperties(); 51 propsMsg = "\\Grid Surface Properties for " + oSurface.Name; 52 propsMsg += "\n-------------------"; 53 propsMsg += "\n X Spacing: " + gridProps.SpacingX; 54 propsMsg += "\n Y Spacing: " + gridProps.SpacingY; 55 propsMsg += "\n Orientation: " + gridProps.Orientation; 56 propsMsg += "\n--"; 57 58 editor.WriteMessage(propsMsg); 59 } 60 61 } 62 catch (System.Exception e) { editor.WriteMessage(e.Message); } 63 } 64}