Sets the Surface's style Id.

Namespace: Autodesk.Civil.DatabaseServices
Assembly: AeccDbMgd (in AeccDbMgd.dll) Version: 10.3.488.0

Syntax

C#
public override ObjectId StyleId { set; }
Visual Basic
Public Overrides WriteOnly Property StyleId As ObjectId
	Set
Visual C++
public:
virtual property ObjectId StyleId {
	void set (ObjectId value) override;
}

Examples

CopyC#
 1/// <summary>
 2/// Illustrates surfaces styles
 3/// </summary>
 4[CommandMethod("SurfaceStyle")]
 5public void SurfaceStyle()
 6{
 7    using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
 8    {
 9
10        // create a new style called 'example style':
11        ObjectId styleId = doc.Styles.SurfaceStyles.Add("example style");
12
13        // modify the style:
14        SurfaceStyle surfaceStyle = styleId.GetObject(OpenMode.ForWrite) as SurfaceStyle;
15
16        // display surface triangles
17        surfaceStyle.GetDisplayStylePlan(SurfaceDisplayStyleType.Triangles).Visible = true;
18        surfaceStyle.GetDisplayStyleModel(SurfaceDisplayStyleType.Triangles).Visible = true;
19
20        // display boundaries:
21        surfaceStyle.GetDisplayStylePlan(SurfaceDisplayStyleType.Boundary).Visible = true;
22        surfaceStyle.BoundaryStyle.DisplayExteriorBoundaries = true;
23        surfaceStyle.BoundaryStyle.DisplayInteriorBoundaries = false;
24
25        // display major contours:
26        surfaceStyle.GetDisplayStylePlan(SurfaceDisplayStyleType.MajorContour).Visible = true;
27
28        // turn off display of other items:
29        surfaceStyle.GetDisplayStylePlan(SurfaceDisplayStyleType.MinorContour).Visible = false;
30        surfaceStyle.GetDisplayStylePlan(SurfaceDisplayStyleType.UserContours).Visible = false;
31        surfaceStyle.GetDisplayStylePlan(SurfaceDisplayStyleType.Directions).Visible = false;
32        surfaceStyle.GetDisplayStylePlan(SurfaceDisplayStyleType.Elevations).Visible = false;
33        surfaceStyle.GetDisplayStylePlan(SurfaceDisplayStyleType.Slopes).Visible = false;
34        surfaceStyle.GetDisplayStylePlan(SurfaceDisplayStyleType.SlopeArrows).Visible = false;
35        surfaceStyle.GetDisplayStylePlan(SurfaceDisplayStyleType.Watersheds).Visible = false;
36
37        // do the same for all model display settings as well
38        surfaceStyle.GetDisplayStyleModel(SurfaceDisplayStyleType.Boundary).Visible = true;
39        surfaceStyle.GetDisplayStyleModel(SurfaceDisplayStyleType.MajorContour).Visible = true;
40        surfaceStyle.GetDisplayStyleModel(SurfaceDisplayStyleType.MinorContour).Visible = false;
41        surfaceStyle.GetDisplayStyleModel(SurfaceDisplayStyleType.UserContours).Visible = false;
42        surfaceStyle.GetDisplayStyleModel(SurfaceDisplayStyleType.Directions).Visible = false;
43        surfaceStyle.GetDisplayStyleModel(SurfaceDisplayStyleType.Elevations).Visible = false;
44        surfaceStyle.GetDisplayStyleModel(SurfaceDisplayStyleType.Slopes).Visible = false;
45        surfaceStyle.GetDisplayStyleModel(SurfaceDisplayStyleType.SlopeArrows).Visible = false;
46        surfaceStyle.GetDisplayStyleModel(SurfaceDisplayStyleType.Watersheds).Visible = false;
47
48        // assign the style to the first surface in the document:
49        CivSurface surf = doc.GetSurfaceIds()[0].GetObject(OpenMode.ForWrite) as CivSurface;
50        surf.StyleId = styleId;
51
52        // commit the transaction
53        ts.Commit();
54    }
55}

Exceptions

ExceptionCondition
System..::..ArgumentException Thrown when newVal is invalid or its type is not Autodesk.Civil.DatabaseServices.Styles.SurfaceStyle.

See Also