To build an API to search keyword in notes of Revit file

To build an API to search keyword in notes of Revit file

Anonymous
Not applicable
667 Views
4 Replies
Message 1 of 5

To build an API to search keyword in notes of Revit file

Anonymous
Not applicable

I want to build an API to Revit to highlight some of keywords in Revit file, especially the words in general notes.  Is it possible to highlight (or change to red colour) the keywords instead of whole textbox?

0 Likes
668 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

Impossible to answer without knowing what textbox you are referring to.

 

If it is your add-ins own textbox, you can indeed control the text font and colour.

 

If it is part of the built-in Revit functionality, you probably cannot (easily).

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 5

Revitalizer
Advisor
Advisor

Hi Jeremy,

 

I think the user means the TextNote elements etc.

 

Rudi




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 4 of 5

jeremytammik
Autodesk
Autodesk

Hi Rudi,

 

I think the user should state precisely what is meant right away when asking the original question. 🙂

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 5

Revitalizer
Advisor
Advisor

Hi,

 

you could change the text formatting, but this isn't just highlghting but changing the text elements.

 

There is a code sample in RevitAPI.chm

 

public void ReformatText(TextNote textNote, string textToChange)
{
    String plainText = textNote.Text;
    FormattedText formattedText = new FormattedText(plainText);

    TextRange foundRange = formattedText.Find(textToChange, 0, false, true);
    while (foundRange.Length > 0)
    {
        formattedText.SetBoldStatus(foundRange, true);
        foundRange = formattedText.Find(textToChange, foundRange.End, false, true);
    }

    textNote.SetFormattedText(formattedText);
}

 

I think, in a similar manner you can change the color of the text range, haven't tried it.

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes