View Full Version : Text value of a TextNote element
Revitator
2007-11-08, 12:43 PM
Hi
I'm trying to read the text value of a TextNote element (as in, if the TextNote says '50mm softwood firrings', that's the value I want), but can't see any reference to it in the API documentation.
Am I just not seeing it, or is it really not accessible?
sfaust
2007-11-08, 03:40 PM
I don't know how, but Danny P. made a "find and replace" utility so it's got to be possible. I'm not sure if Danny posted his code, but I would say look for that and maybe you can figure out how.
Hi
I'm trying to read the text value of a TextNote element (as in, if the TextNote says '50mm softwood firrings', that's the value I want), but can't see any reference to it in the API documentation.
Am I just not seeing it, or is it really not accessible?
This is only available from 2008 Series on. Autodesk.Revit.Elements.TextNote class. It's in the documentation.
HTH,
Guy
mmason.65315
2007-11-09, 05:31 AM
If I remember right - it's not even obvious in there...
I don't have my docs handy, but if you don't see an obvious "Text" field in the TextNote class - try getting the parameter BuiltInParameter.TEXT_TEXT from the TextNote element.
Best Regards,
Matt
Revitator
2007-11-13, 01:01 PM
Brilliant! Thanks everyone: I'd been trying the parameters of the TextNote class, but hadn't realised that it was a 'special' BuiltIn parameter.
Here's the link to Danny Polkinhorn's Find and Replace utility:
http://forums.augi.com/showthread.php?t=30343
And the crucial line of code:
Dim strText As String = elem.Parameter(Parameters.BuiltInParameter.TEXT_TEXT).AsString
where elem is a TextItem element.
In detail, (if I've understood correctly), Element.Parameters gives you a ParameterSet of the non-builtin parameters, but you can use Element.Parameter(key) to get:
1) BuiltIn parameters (using the key from the BuiltInParameter enumeration)
2) Ordinary and shared parameters (using a parameter Definition object as the key)
3) Shared parameters (using the shared parameter's GUID as the key)
Hope this helps someone else.
Thanks again.
mmason.65315
2007-11-14, 12:27 PM
You're right on, with one small exception, I think...
It's been my experience that many of the built-in parameters are also "available" through Element.Parameters ... but it's definitely not all of them. There's some kind of "visibility" that makes certain built-in parameters visible within the ParameterSet and many others not.
For example, with Room elements, the built in ROOM_NAME is visible in the ParameterSet, but ROOM_PEOPLE_LATENT_HEAT_GAIN_PER_PERSON_PARAM is only available by specifically asking for it (go figure!).
-Matt
-Matt
Revitator
2007-11-14, 04:34 PM
Thanks, Matt.
I'm sure you're right. I suspect that my 'idiots guide' only scratches the surface of the parameters issue. I'll have to do some more reseach when I get time...
mmason.65315
2007-11-15, 12:40 PM
If you're an ADN member, get yourself a copy of "RevitMgdDbg" - a browser which lets you navigate through the Revit object model, and look at the value of just about everything.
I can't imagine developing without it (or something like it) - it'd be like developing half-blind.
-Matt
Revitator
2007-11-15, 01:16 PM
Hmm. I'd always thought of ADN as being too expensive, but now I see that ADN Standard is just under 1300 (dollars/euros). Worth considering, at that price.
Thanks for the tip!
Powered by vBulletin® Version 4.1.11 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.