Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Show only
|
Search instead for
Did you mean:
This page has been translated for your convenience with an automatic translation service. This is not an official translation and may contain errors and inaccurate translations. Autodesk does not warrant, either expressly or implied, the accuracy, reliability or completeness of the information translated by the machine translation service and will not be liable for damages or losses caused by the trust placed in the translation service.Translate
Presently, it is not possible to create or pick a new host for Keynote Tags within Revit. Keynote tags exist as an internally modified sub-type of the "IndependentTag" Class.
Unfortunately, whenever attempting to create an instance of "IndependentTag" using the Keynote Tag TypeId, Revit will not allow the Key Value or Key Source to be set. In fact, if created through the IndependentTag.Create() method, the Key Value and Key Source parameters don't even exist. The parameters only seem to exist when a Keynote is created through the UI.
I thought we got lucky in 2019 and were given the ability to create a keynote tag with the new IndependentTag.Create override by passing in the keynote tag symbol ID, but nope ... it creates a tag without a key source, which seems useless.
I was however able to set the BuiltInParameter.KEY_VALUE parameter, the BuiltInParameter.KEY_SOURCE_PARAM parameter is set to read only.
This makes me very sad! 😞 I was trying to script a fix where a user reloaded from the wrong RVT link several days ago in a complex model, so all of the keynotes that were hosted to elements in that link (inadvisable I know) were broken. All of the elements still exist, and I can identify the relationships between keynotes and hosts in older versions of the model, but there is no way to reconcile the hosting en masse.
Unfortunately I don't know if there is much @jeremytammik can do for us here. Just comes down to the source code. This is probably an oversimplification of what is needed, but if we could just set the IndependentTag.TaggedElementId.LinkedElementId property that would do it. At least I think it would for my scenario.
See the property below, can only get the property value.
I added my code below for reference, note that it is python code and uses pyrevit functions as well. It's pretty simple what I'm trying to do actually. Make no mistake I am definitely an amateur coder, so feel free to correct me. Of course this code fails when trying to write to a read-only property. I don't see a way around it in the API either.
doc is of course the active document (where the unhosted keynotes are).
reference_doc is an old copy of the same model where the relationship between tag and host still exists.
I have double-checked the Element Ids and verified the linked element ids I'm trying to rehost the keynotes to exist and are the same in both models.
import pyrevit
from pyrevit import forms
import sys
doc = __revit__.ActiveUIDocument.Document
try:
reference_doc = forms.select_open_docs(multiple=False)
all_keynotes = pyrevit.revit.db.query.get_used_keynotes(doc)
for keynote in all_keynotes:
if keynote.IsOrphaned:
keynote_id = keynote.Id
reference_keynote = reference_doc.GetElement(keynote_id)
tagged_element_id = reference_keynote.TaggedElementId
linked_element_id = tagged_element_id.LinkedElementId
keynote.TaggedElementId.LinkedElementId = linked_element_id
else:
continue
except:
sys.exit()
The fact that we can't even create Keynote tags kinda feels like a bug since we can with other kinds of tags.
I really hope this will become part of the API in the future versions. There are many workflows, which could be facilitated by material keynotes (and keynotes in general).