Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SpatialElementTag class

2 REPLIES 2
Reply
Message 1 of 3
echeverrimontes
151 Views, 2 Replies

SpatialElementTag class

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

2 REPLIES 2
Message 2 of 3

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
Message 3 of 3

Thank you jeremy, I'll do so.
Paula EM

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community