As we know we have method ViewSheet.DeleteViewPort() method to remove ViewPort from sheet, but i can not find method to remove ScheduleInstance from Sheet, I also try doc.Delete(elementId) method, but it’s not work . So how i can delete it from sheet ???
Asked
Active
Viewed 311 times
1 Answers
2
Document.Delete
works for me:
UIDocument uiDoc = commandData.Application.ActiveUIDocument;
Document doc = uiDoc.Document;
using (var tr = new Transaction(doc, "Delete"))
{
if (tr.Start() == TransactionStatus.Started)
{
ICollection<ElementId> ids = uiDoc.Selection.GetElementIds();
doc.Delete(ids);
tr.Commit();
}
else
{
throw new UserException("Transaction can not be started.");
}
}
Are you calling Commit
on your transaction?
Also it's ScheduleSheetInstance
, not ScheduleInstance
.

Maxence
- 12,868
- 5
- 57
- 69