Delete Schedules and views placed on sheets from project then delete sheet

Delete Schedules and views placed on sheets from project then delete sheet

mike_frelich2
Explorer Explorer
165 Views
6 Replies
Message 1 of 7

Delete Schedules and views placed on sheets from project then delete sheet

mike_frelich2
Explorer
Explorer

I am trying to write a script that will delete all schedules and views placed on the sheet from the project then delete the sheets, I have been able to get the views and sheets to delete but i can get the schedules to. Can anyone tell me where im going wrong with the schedule delete code?

0 Likes
Accepted solutions (1)
166 Views
6 Replies
Replies (6)
Message 2 of 7

sensiblehira
Advocate
Advocate

use

ScheduleId

property instead of ViewId for ScheduleSheetInstances to get the schedule's Element Id and directly use it to delete the schedule.

Message 3 of 7

sensiblehira
Advocate
Advocate

and the output for both ViewId and ScheduleId is ElementId, so you do not need to get the element again to delete it. Directly use the ElementIds to delete elements

Message 4 of 7

ctm_mka
Collaborator
Collaborator

curious, why not delete just the sheet? technically no need to delete view and schedules first.

0 Likes
Message 5 of 7

mike_frelich2
Explorer
Explorer

I wasn't able to get that to work, I'm assuming i didn't swap out the correct callouts to ScheduleId

0 Likes
Message 6 of 7

mike_frelich2
Explorer
Explorer

We create fabrication drawings so each sheet has a unique schedule and detail views created for that sheet alone so if we need to update the sheet we essentially need to delete all of them before re-running the sheet creation script. Part of trying to get this script working properly is to add it to the sheet creation script so it will auto do it if a sheet with the name its trying create so it makes two steps into one. 

0 Likes
Message 7 of 7

mike_frelich2
Explorer
Explorer
Accepted solution

This script works without issue (for as much as i tested it in R21 thru R24)

0 Likes