How will I fetch the width of the text of the Independent Tag in the document?

How will I fetch the width of the text of the Independent Tag in the document?

ankit.mahto
Participant Participant
643 Views
6 Replies
Message 1 of 7

How will I fetch the width of the text of the Independent Tag in the document?

ankit.mahto
Participant
Participant

ankitmahto_0-1647508624619.png

Suppose I want to get the width of the above length tag highlighted in red, which is present in the Revit Project document. How will I get the width through Revit API C# coding?

0 Likes
644 Views
6 Replies
Replies (6)
Message 2 of 7

jeremy_tammik
Alumni
Alumni

Before asking such a question, I would suggest searching this forum for "text width". 

 

I tried it out. Afaict, that ought to answer your question.

  

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

ankit.mahto
Participant
Participant

Hello Jeremy

I have gone through your blog

https://thebuildingcoder.typepad.com/blog/2014/10/new-text-note-and-text-width-calculation.html

 

But , somehow I did not get the desired result.

It will be very helpful , if you provide some sort of logic to fetch the text width of the Independent Tag.

0 Likes
Message 4 of 7

jeremy_tammik
Alumni
Alumni

To do so, I would follow the advice I shared above myself. I would have to do exactly the same thing as you do.

   

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

NimeshJ
Advocate
Advocate

Hi @jeremy_tammik ,

I have being following your post since long time and I appreciate your contribution.
Also, I have learnt to explore API on my own.

Coming back to topic, we can get Text Font but I have not yet found any way to get Independent Tag Font or Size parameter.
So without above parameter we cannot implement same logic that of a Text.
Enlighten me if I am missing out on something.

0 Likes
Message 6 of 7

jeremy_tammik
Alumni
Alumni

Thank you for your appreciation and glad to hear that you are continuing your learning on your own. Doesn't the independent tag have some kind of style associated with it, presumably represented by a Revit ElementType object? If so, I would assume that style-specific characteristics such as font and size would be managed there. You should be able to navigate to and access that data by analysing the independent tag, its properties and relationships with RevitLookup and other similar database exploration tools.

  

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

ctm_mka
Collaborator
Collaborator

something for your consideration, TextNotes have a width property. So you could have a workflow like this:

  • Grab text value of Tag.
  • Create new TextNote object with value from Tag.
  • Get Width property.
  • Delete Text object.

 

0 Likes