How to change the Draw by in sheet list

How to change the Draw by in sheet list

Anonymous
Not applicable
1,510 Views
2 Replies
Message 1 of 3

How to change the Draw by in sheet list

Anonymous
Not applicable

Hi, every body,

i am a newbie for Revit API. Now i have a problems with the change name of Drawy by in Sheet list

Sheet List.png 

 

Here is my code to filter all the schedule in the document. But i don't how to take and change the value or parameter in List Sheet schedule.

 

UIApplication uiap = commandData.Application;
UIDocument uidoc = uiap.ActiveUIDocument;
Document doc = uidoc.Document;
string ListSchedule = "";
FilteredElementCollector fi = new FilteredElementCollector(doc);
fi.OfCategory(BuiltInCategory.OST_Schedules);
fi.OfClass(typeof(ViewSchedule));
foreach (ViewSchedule sht in fi)
{
ListSchedule += sht.Name.ToString()+Environment.NewLine;
}
TaskDialog.Show("All Schedules in the document", ListSchedule);

Thank you so much for your help!

0 Likes
Accepted solutions (1)
1,511 Views
2 Replies
Replies (2)
Message 2 of 3

Troy_Gates
Advocate
Advocate
Accepted solution

The "Drawn By" parameter is stored in the sheet view object. Here is a quick bit of code to change the parameter value on all sheets...

 

public void ReplaceDrawnBy()
{
    Document doc = this.ActiveUIDocument.Document;
    
    string newValue = "Joe Drafter";
    
    using (Transaction t = new Transaction(doc, "Replace Drawn By Parameter"))
    {
        t.Start();
        
        foreach (ViewSheet vs in new FilteredElementCollector(doc).OfClass(typeof(ViewSheet)))
        {
            vs.get_Parameter(BuiltInParameter.SHEET_DRAWN_BY).Set(newValue);
        }
        
        t.Commit();
    }
}
Message 3 of 3

Anonymous
Not applicable

Thank you for your help. It works well.

0 Likes