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
180件の閲覧回数
6件の返信
メッセージ1/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 件のいいね
解決済み
181件の閲覧回数
6件の返信
返信 (6)
メッセージ2/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.

メッセージ3/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

メッセージ4/7

ctm_mka
Collaborator
Collaborator

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

0 件のいいね
メッセージ5/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 件のいいね
メッセージ6/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 件のいいね
メッセージ7/7

mike_frelich2
Explorer
Explorer
解決済み

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

0 件のいいね