SpatialElementTag class

SpatialElementTag class

echeverrimontes
Explorer Explorer
309 Views
2 Replies
Message 1 of 3

SpatialElementTag class

echeverrimontes
Explorer
Explorer

Hello, I've been trying to change an AreaTag (SpatialElementTag class) by the following method:

 

 import clr
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager


clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit import DB

doc = DocumentManager.Instance.CurrentDBDocument

#areaTags = UnwrapElement(IN[0])
type = IN[1]
areaType = IN[2]

out = []
ids = []
typeIds = []
parameters = []

areaTags = FilteredElementCollector(doc, doc.ActiveView.Id).OfClass(SpatialElementTag)
for areaTag in areaTags:
    id = areaTag.GetTypeId()
    out.append(id)
    validTypes = GetValidTypes(doc, areaTag)
out.append(validTypes)

a = Transaction(doc, 'Set Spatial Element Tag')
a.Start()
for tag in areaTags:
    for t in tag:
        t.ChangeTypeId(validTypes[2])        
a.Commit()
   
OUT = out 

 

It seems the methods GetValidTypes() and ChangeTypeId()  are not valid names and are unrecognizable although they appear within the API, I can't find where am I missing a reference or a library.

 

Thank you very much,

 

Paula Echeverri Montes

0 Likes
310 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

Your code looks ok to me rom a pure Revit API point of view. So, maybe your problem is Python related. If so, you might have more luck resolving it in the Dynamo forum:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

echeverrimontes
Explorer
Explorer
Thank you jeremy, I'll do so.
Paula EM
0 Likes