I'm trying to set the Label Parameter of TextElements via API in the same way like users do via GUI. Is there a way to set the parameter relationship to an elements parameter that receive the value and the TextElement that show the value in plans?
I would expect it to be possible to achieve the same result programmatically as you do through the user interface.
Have you explored the database elements and their properties before and after setting up the label, e.g. using RevitLookup or the Ruby or Python shell?
That should give you a hint how to adress the issue throug the API as well.
Hoi Jeremy
I used RevitLookup to get the structure/ information I need. I found out that there is a BuiltInParameter called TAG_TAG with the StorageType None. This parameter is the parameter that a user fills with parameter references via GUI. An other BuiltInParameter called TAG_SAMPLE_TEXT contains sample values, dependent on the refered parameter, but how can I get or set the parameters that should be refered?!
I think one way is to set the value of the TextElements property Text using an own function. But I think its much better to use an on board API functionality!
Hoi hoi.
What exact objects are we talking about here? TextElement, TextNote, or what?
From you description, it sounds more like a tag element. IndependentTag?
Cheers,
Jeremy
Hi Jeremy,
the topic is about TextElements, in Family context.
If you create a label family, you want the placed FamilyInstances to display certain parameters.
How to set the label parameter, by code ?
How to make a parameter to be connected to the label, in the Family document ?
Revitalizer
Hi Revitalizer,
that you for summerizing of my problem. Using a TextElement via GUI expact the selection of a parameter. This parameter sets the text value in the label. But how can I get or set this referenced parameter?
An other question is: Is there a way to have access to get the TextElements of a Tag without opening the family?
@jeremytammik You can use a independent tag revit, too. The question is: How can I set a value depending on a parameters value to the TextElement.Text attribute? I tried to use a TextNote but this is not a option because the value would be static and not dynamic.
Regards Christian
Dear Christian,
It sounds to me as if, if all else fails, you should be able to achieve this using the dynamic model updating framework DMU:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.31
Cheers,
Jeremy
Hallo Jeremy,
I hoped you would have a better answer ! So the answer is that I build my own tags using TextNotes and Updater. But is there a way the get the subelements of a tag without opening the family editor (cause I think it is time expensive)?
Regards
Christian
Dear Christian,
I also still hope someone else has a better answer.
This suggestion just came to mind as a last resort.
Cheers,
Jeremy
Hello,
I have analysed the API for my problem but I don't found a solution. I can not believe that there is no way to get the referred parameters. I summarized the issue in a document. Maybe an other one can tell me whether the problem can be solved or not?!
Well for what it's worth, I smashed my face against this problem, trying to set the label parameter of a TextElement in a family, and came up empty handed. I think our only hope is for a wishlist item =\.
Here is the code I'm using:
namespace test { [TransactionAttribute(TransactionMode.Manual), RegenerationAttribute(RegenerationOption.Manual)] public class textelemtest : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication App = commandData.Application; Document famdoc = App.ActiveUIDocument.Document; FilteredElementCollector textcoll = new FilteredElementCollector(famdoc); ICollection<ElementId> textelementids = textcoll.OfClass(typeof(TextElement)).ToElementIds(); Parameter label = null; foreach (ElementId id in textelementids) { Element elem = famdoc.GetElement(id); //there doesnt appear to be a builtinparameter for Label, selecting the parameter via the name =\ foreach (Parameter p in elem.Parameters) { if (p.Definition.Name == "Label") { label = p; } } if (label != null) { using (Transaction trans = new Transaction(famdoc)) { trans.Start("Update Parameter"); //not sure how to set this parameter label.Set(?????); trans.Commit(); } } } return Result.Succeeded; } } }
t
Hi,
I would recommend to bring it to the Idea Station.
https://forums.autodesk.com/t5/revit-ideas/idb-p/302/tab/most-recent
If there is already an existing idea for the issue, vote it up.
If not, create a new one.
The more votes, the higher the priority to be implemented.
Revitalizer
Dear Dale,
Are you aware of any wish list database entry number?
Is this submitted to the Revit Idea Station yet?
If not, I would suggest doing so right away.
Meanwhile, I am checking with the development team for you...
Thank you!
Cheers,
Jeremy
We have an internal wish list item for this, CF-3799 [API access to read and write labels].
I added a link to this thread to that.
I cannot find a Revit Ideas link about setting labels, but there is one about getting them:
https://forums.autodesk.com/t5/revit-ideas/api-get-shared-parameter-linked-to-a-label/idi-p/7077420
Cheers,
Jeremy
Has there been an update on this? Would be a really useful feature?
I've seen @jeremytammik's handle show up across multiple posts, seems to be the Revit API wizard around?