📅  最后修改于: 2022-03-11 14:46:31.325000             🧑  作者: Mango
component = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)
def create_schema():
schema_guid = System.Guid("DF3BBCC1-4D4D-4A01-B444-F9722814F9CE")
schema_builder = SchemaBuilder(schema_guid)
schema_builder.SetReadAccessLevel(AccessLevel.Public)
schema_builder.SetWriteAccessLevel(AccessLevel.Public)
schema_builder.SetSchemaName("TestSchema")
schema_builder.SetDocumentation("Test schema to store ids")
field_builder = schema_builder.AddSimpleField("ParentComponentID", System.String)
schema = schema_builder.Finish()
return schema
def add_schema_instance(schema, rvt_element):
field = schema.GetField("ParentComponentID")
schema_instance = Entity(schema)
schema_instance.Set[System.String](field, "ID0004")
rvt_element.SetEntity(schema_instance)
TransactionManager.Instance.TransactionTaskDone()
schema = create_schema()