so I was wondering if it is possible to delete a textnotetype using evit API. I have seen Jeremy's post outlining how to delete textnotetypes that are not being used in a project, but my question pertains to ones that somehow Revit thinks are being used even though there is 0 instances of that text type amongst all textnotes. I guess it could have been used in a schedule or family and loaded into a model. How would i handle that? Ideas?
Thank you!
Hello Konrad:
I do not think there is a way to do what you want. As you guessed, text types are shared across various text annotations, some of which are not exposed in the API yet. The types are not used for Text Notes only.
You inquiry begs a question: Why do you want to deleted [seemingly] unused text type? Is it some kind of a custom purge command?
yes, I am writing a command that allows you to replace text notes of one style with another and after that attempt to delete [the now seemingly unused] text type. However, more often than not it has failed to delete text types. I know why, question was how do i get a hold of them all (schedules/families etc)? You are saying that i cannot access and then change all of them because API doesnt allow it yet so theres my answer. 😞 Can you at least tell me what exacly uses TextTypes outside of Schedule and TextNote?
Yes, this sounds resonable. I am just struggling with the idea that there is nothing that i can do to get rid of some text type that was loaded into my project from a different project when someone was importing a Drafting View (now I have a mix of Metric and imperial TextTypes and flavors). What would have happened if i made sure that no Tags, TextNotes, Schedules and Dimension Styles are using that given TextType. Will I be able to delete it if nothing is using it or will Revit still want to keep it around?
Thanks!
Konrad.Sobon Did you ever find a solution to this or can point me in the right direction to begin an investigation? Thanks.
I am purging TextNoteTypes with code based on suggestions from Jeremy some time back:
https://thebuildingcoder.typepad.com/blog/2010/11/purge-unused-text-note-types.html
I am tracking total items found (GetUnusedTextNoteTypes) to delete vs the total items actually deleted:
ICollection<ElementId> idsDeleted = doc.Delete(ids); lintTotalDeleted = idsDeleted.Count; // actual, not attempted
In my case, 4 items found to delete results in 25 elements deleted. I can't do the transaction roll back, so is there any suggestion as to what these addition elements would be?
With a bit of experimentation, I found that 4 TextNoteTypes will delete 16 elements:
4 Types
4 Graphic Styles
4 Elements
4 ???? (as shown in Snoop) - what are these?
So that looks safe enough. But as was pointed out, Schedules (for one example) will lose their TextNoteType and just revert to another. I gather that there is no way to determine if a TextNoteType has been used anywhere?