How to edit IndependentTag.TagText's default?

Anonymous

How to edit IndependentTag.TagText's default?

Anonymous
Not applicable

Hello guys,

 

I am trying to bring the values from Parameters to tag on the View of Plans.

 

The sample code(Code Region 16-5: Creating an IndependentTag: https://help.autodesk.com/cloudhelp/2018/ENU/Revit-API/Revit_API_Developers_Guide/Revit_Geometric_El...) gives me the good example, however, I'm trying to implement on Pipe. In that case, the TagText's value is set up by Size as a default.

 

I am trying to edit the value for Parameter.Set("Hello"), and TagText isn't changed but the value of Parameter on Properties has changed. 

images_01.png

PipeType type = (e as Pipe).PipeType;
Parameter foundParameter_01 = type.LookupParameter("Type Size");
bool result = foundParameter_01.Set(value + "Hello");

IndependentTag newTag = IndependentTag.Create(doc, doc.ActiveView.Id, reference, true, tagMode, tagorn, xyzMid);

 

Do you guys have any idea to tag the value I'd like to insert? 

 

 

0 Likes
Reply
1,120 Views
3 Replies
Replies (3)

Revitalizer
Advisor
Advisor

Hi,

 

that's easy.

It depends on the label parameter used in the IndependentTag family.

Obviously, it reflects the diameter by default.

 

If you want another parameter to be reflected in that IndependentTag family, just modify the tag family.

It's a matter of content - and how to use a shared parameter in tag families.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes

Anonymous
Not applicable

Thanks for your reply.

 

And I have following questions.

 

1. TagText can't be modified cuz it's Read-Only. Then, I thought modifying the Parameter name could be the good way to show the TagText on the model. I thought that(as below) is the code to change Parameter for printing the TagText and to set the value.

Parameter foundParameter = type.LookupParameter("Type Size");

bool result = foundParameter.Set(value + "Hello");

 

2. It works for Wall, but no to Pipe, which I need. So, can you give me the short example to modify the Tag family?

 

 

 

0 Likes

Revitalizer
Advisor
Advisor

Hi,

 

you need to edit the tag family manually.

In fact, the family doesn't know your (string) parameter yet, so you need to add it and assign it to a label's content.

By hand.

It's an end user question. See also:

https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/CloudHelp/cloudhelp/2016/EN...

 

The point is:

A tag reflects one or more parameters of a given source element.

If you want it to display an extra parameter, this parameter must be added to both source and target (via shared parameter).

In the tag family, the label needs to be modified to display this extra parameter.

Note that you can define several types in the tag family which can display different information.

Doing so, you need to make sure that the IndependentTag instance has the correct type assigned.

 

Revitalizer

 

 




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes