This Revit Macro will create a horizontal reference plane in a section view. Note: This code may not be original. I would give credit to the source, but I have forgotten where I got it from.
public void CreateRefPlaneInSection()
{
UIDocument uidoc = ActiveUIDocument;
Document doc = ActiveUIDocument.Document;
Autodesk.Revit.DB.View pView = ActiveUIDocument.Document.ActiveView;
using (Transaction t = new Transaction(doc, "new ref planes"))
{
t.Start();
//these planes are all horiz. lines when viewed from above
/*
XYZ bubbleEnd = new XYZ(0,10, 1 ); // bubble end applied to reference plane
XYZ freeEnd = new XYZ(0, -10, 1 ); // free end applied to reference plane
// Cut vector should be perpendicular to bubbleEnd-freeEnd vector
XYZ cutVec = new XYZ(0, 0, 1); // cut vector applied to reference plane
// Create the reference plane, applying the active view
ReferencePlane refPlane = doc.Create.NewReferencePlane(bubbleEnd, freeEnd, cutVec, doc.ActiveView);
refPlane.Name = "Vert";
refPlane.
XYZ bubbleEnd1 = new XYZ(-5.77,5.77, 1 ); // bubble end applied to reference plane
XYZ freeEnd1 = new XYZ(5.77, -5.77, 1 ); // free end applied to reference plane
// Cut vector should be perpendicular to bubbleEnd-freeEnd vector
XYZ cutVec1 = new XYZ(0, 0, 1); // cut vector applied to reference plane
// Create the reference plane, applying the active view
ReferencePlane refPlane1 = doc.Create.NewReferencePlane(bubbleEnd1, freeEnd1, cutVec1, doc.ActiveView);
refPlane1.Name = "Angled";
XYZ bubbleEnd2 = new XYZ(-10,0, 1 ); // bubble end applied to reference plane
XYZ freeEnd2 = new XYZ(10, 0, 1 ); // free end applied to reference plane
// Cut vector should be perpendicular to bubbleEnd-freeEnd vector
XYZ cutVec2 = new XYZ(0, 0, 1); // cut vector applied to reference plane
// Create the reference plane, applying the active view
ReferencePlane refPlane2 = doc.Create.NewReferencePlane(bubbleEnd2, freeEnd2, cutVec2, doc.ActiveView);
refPlane2.Name = "Horiz";
t.Commit ();
*/
//these planes are all horiz. lines when viewed from a section
//vary y, and make x the cut vector - a vertical line in plan, and a horiz line in section
XYZ bubbleEnd = new XYZ(10,0, 3 ); // bubble end applied to reference plane
XYZ freeEnd = new XYZ(-10, 0, 3 ); // free end applied to reference plane
// Cut vector should be perpendicular to bubbleEnd-freeEnd vector
XYZ cutVec = new XYZ(0, 1, 0); // cut vector applied to reference plane
// Create the reference plane, applying the active view
ReferencePlane refPlane = doc.Create.NewReferencePlane(bubbleEnd, freeEnd, cutVec, doc.ActiveView);
refPlane.Maximize3DExtents();
refPlane.Name = "Horiz1";
//these planes are all horiz. lines when viewed from a section
//vary y, and make x the cut vector - a vertical line in plan, and a horiz line in section
XYZ bubbleEnd1 = new XYZ(10,0, 4 ); // bubble end applied to reference plane
XYZ freeEnd1 = new XYZ(-10, 0, 4 ); // free end applied to reference plane
// Cut vector should be perpendicular to bubbleEnd-freeEnd vector
XYZ cutVec1 = new XYZ(0, 1, 0); // cut vector applied to reference plane
// Create the reference plane, applying the active view
ReferencePlane refPlane1 = doc.Create.NewReferencePlane(bubbleEnd1, freeEnd1, cutVec1, doc.ActiveView);
refPlane1.Name = "Horiz2";
//vary x, and make Y the cut vector - a horiz line in plan, and a horiz line in sect
//XYZ bubbleEnd2 = new XYZ(-10,0, 2 ); // bubble end applied to reference plane
//XYZ freeEnd2 = new XYZ(10, 0, 2 ); // free end applied to reference plane
// Cut vector should be perpendicular to bubbleEnd-freeEnd vector
//XYZ cutVec2 = new XYZ(0, 1, 0); // cut vector applied to reference plane
// Create the reference plane, applying the active view
//ReferencePlane refPlane2 = doc.Create.NewReferencePlane(bubbleEnd2, freeEnd2, cutVec2, doc.ActiveView);
//.Name = "Horiz";
t.Commit ();
}
}