Change Section View Type and Hide Cut Line

Leo raised a couple of questions on section view creation in his comment which Rudolf Honke very kindly answers thus:

1. Hide view: To hide the cutting line in a plan view, you can use this parameter:

  viewSection.get_Parameter( BuiltInParameter
    .SECTION_COARSER_SCALE_PULLDOWN_METRIC )
      .Set( 1 );

2. Generate section view: In Revit 2013, you can use the static method

  public static ViewSection CreateSection(
    Document document,
    ElementId viewFamilyTypeId,
    BoundingBoxXYZ sectionBox
  )

In Revit 2012, you can use document.Create.NewViewSection( BoundingBoxXYZ );

3. Change the type of a detail view: Each view has a view type, e.g. a section view symbol. These symbols have no category to help identify them, they are just generic ElementType instances. The types can be retrieved using their name, e.g. "Section" etc. Once you have a view symbol, you can change the view type by simply setting its type id:

  viewSection.ChangeTypeId( symbolSection.Id ); 

Since section symbols are identified by name, they are language dependent and there is no guarantee to find them at all, depending on the template being used.

Many thanks to Rudolf for these important hints!