Using the code here as a base: Purge schemas
And it’s here: EraseSchemaAndAllEntities Method
I’ve got this: But it won’t let me delete
What am I doing wrong?
Using the code here as a base: Purge schemas
And it’s here: EraseSchemaAndAllEntities Method
I’ve got this: But it won’t let me delete
What am I doing wrong?
I’m no Python expert, but what is the difference between the original example:
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB.ExtensibleStorage import Schema
and what you have:
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.ExtensibleStorage import *
???
I’d think * means import everything, but maybe you need to be specific?
But if * means “import all methods”, why would you even need
from Autodesk.Revit.DB.ExtensibleStorage import *
After you have
from Autodesk.Revit.DB import *
It seems redundant to me, but I have always just built on other people’s scripts that have this sort of thing already. Maybe someone has a good reference on how this works for non-programmers (like me)?
Maybe I just haven’t looked in the Dynamo Primer…
Cos it doesn’t automatically import all the nested stuff.
Ah, thanks. So since “Schema” is directly under "Extensible storage, you get that when you use the star.
So, I looked more at Revit API docs. It seems that “EraseSchemaAndAllEntities” no longer is used in 2023?
If you go to the Schema Member page itself:
It says the method is now obsolete in 2023.
I have no idea what it was replaced with. I have no idea why the page for the method itself doesn’t state this.
Yes… but there are two links to it.
See the link in my original post.
As far as I can see it looks identical… Hence the confusion.
Looks like you may be out of luck in 2023. Not sure if it is an actual bug, or something that was done to prevent document corruption:
Meh, you could be right… Altho 2023 is only mentioned once in that thread…
/me goes to buy booze instead of doing Dynamo.
Hopefully it is Friday afternoon on your planet!
It is, AND I get three days where my computer is being upgraded by the alien IT people so I can’t do anything work related…
Whooo!!
Seems like there has been some background turmoil under the hood with extensible storage schemas…
https://mybimteam.com/kb/how-do-you-fix-revit-schema-errors/
You are in 2023, this is 2024, but who knows why they removed the method…
since Revit 2022 the right method is
doc.EraseSchemaAndAllEntities(schema)
the old method
the new one
however this won’t solve the problem with Revit 2024, so it’s better to re-create a new schema with a new GUID
I’m in Revit 2023.
I can’t try it till Tuesday now though! But thank you in advance
I have a question; you say you’ve got to write doc.Erase…
How do you know this? I can’t see it anywhere in the API.
The only difference I can see is the old one asks for a bool and the new one doesn’t. How would I work this out?
First is a method (has stuff in the parenthesis) on the Schema class.
Second is a method on the Document class.
Ahhhh!!! Thanks