Thursday, June 05, 2014

View Schedule with Detail Numbers Macro for Revit

A question was posted on about showing a view's detail number in a view list schedule. Revit has a parameter for the Detail Number (see first image) but it isn't accessible to add in a view list schedule.

Original post:


Step 1
Create a View List schedule (or edit an existing one) and add a new text Parameter named "Detail_Number" (notice the _ in the name)

Step 2
Create a new macro with the following routine and run it

public void DetailNumber()
    UIDocument uidoc = this.ActiveUIDocument;
    Document doc = uidoc.Document;
    string strDetailNumber = "Detail_Number";         
    FilteredElementCollector collector = new FilteredElementCollector(doc);
    ICollection<Element> collection = collector.OfClass(typeof(View)).ToElements();
    using (Transaction t = new Transaction(doc, "Detail Number"))
        foreach(Element e in collection)
            View v = e as View;
                Parameter bpDetailNumber = v.get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER);

All the views that are on sheets now have the Detail Number copied into the Detail_Number parameter.

Run the macro whenever you want to update the values in the new parameter to reflect the current state of the project (aka is doesn't auto update and needs to be run manually).


Taylor Odell said...

Could this also work to link door schedules to door details that have been placed on sheets?

Adding a parameter to the door families that will allow a detail drawings to fill in a head, jamb, sill detail section of the door schedule with the drawings (detail) number and sheet when that detail view is placed on a sheet?

Ian Nelson said...

Hi. I am interested in your Macro that does this automatically