Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am currently working on a routine that i would be able to add additional columns to an existing schedule. However, would like to limit the routine to only be able to work on mechanical equipment. I have tried using Viewschedule.Category.Name to try to narrow that down but i don't seem to be getting anywhere with it. Is it possible to retrieve the category information from the schedule?
public void addtoschedule()
{
Document doc = this.Document;
ViewSchedule mvs = doc.ActiveView as ViewSchedule;
Category mcat = null;
using (Transaction t = new Transaction(doc, "create Schedule"))
{
t.Start();
{
if(mvs.Category.Name.ToLower()=="mechanical equipment")
{
ScheduleDefinition msd = mvs.Definition;
ScheduleField mnamefield = msd.AddField(new SchedulableField(ScheduleFieldType.Instance, new ElementId(BuiltInParameter.ALL_MODEL_MARK)));
}
else
{
TaskDialog.Show("Warning","The active schedule is not for mechanical equipment.");
}
t.Commit();
}
}
Solved! Go to Solution.