Formatted Text Changing Source, Type and Property

Formatted Text Changing Source, Type and Property

Tiffany_Hayden_
Collaborator Collaborator
168 Views
4 Replies
Message 1 of 5

Formatted Text Changing Source, Type and Property

Tiffany_Hayden_
Collaborator
Collaborator

Has anyone had the opportunity of going down the formatted text rabbit hole? If so did you find a way to change these mystical properties? Please share. 🙂

 

 

Tiffany_Hayden__0-1787229193856.png

 

 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Accepted solutions (2)
169 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor
Accepted solution

Hi @Tiffany_Hayden_.  As you may know, there is only one topic about this in Inventor's API online help documentation, which is at the following Link:

https://help.autodesk.com/view/INVNTOR/2027/ENU/?guid=GUID-915B75BA-4696-4fc7-A2C6-54B2BACDE7E1 

Unfortunately, I still have not seen a 'silver bullet' code-based solution that makes editing these exactly the way we want them simple & fast.  The quickest & simplest way to get that FormattedText the way you want it is to 'reverse engineer' it.  To do that, first create the note manually, using the Format Text dialog.  Then get the source/owning object by code.  Then use an InputBox, where the FormattedText value is input as its 'Default' value (selectable/editable), then let the user edit it when the dialog shows, then apply the edited value back to the property.  Or just write its value to the iLogic Log window using a Logger line.  Then copy & paste the resulting code back into the larger code you are developing.

I have seen some others here on the forum go as far as creating special Classes or Modules that reference the System.Data & System.Xml DLL's, creating XML document, and parsing that type of data that way, with custom blocks of code meant to help recognize &/or fill in certain data in the more predictable scenarios.  I have done some stuff with XML that way, never really got into it that deep myself, because I never needed to.

In most cases, there are two (or more) similar Properties of the source object...Text, and FormattedText.  In the simplest cases, where only manually typed in text is involved, but no formatting, both may have the same values.  But whenever there is any 'Linked' data involved, then the Text property will usually contain what you see in the 'Format Text' dialog, because it will contain what I call 'tagged placeholders' for those Links.  Then the FormattedText property will usually contain the further elaborated, necessary XML instructions for those things like {Type, Source, Property, Precision, and any special Formatting}.  Then I believe there is a hidden, internal system that 'reads' those XML instructions to replace the placeholders with the resulting 'retrieved/derived' data, which is then only shown to the user after the code process has finished.  I have never seen a native tool or resource for getting the actual 'results' from those inputs though, which is why I created an Inventor Ideas post about it (at the following Link).

https://forums.autodesk.com/t5/inventor-ideas/add-getresulttext-method-in-inventor-api-for-drawingno... 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 5

Tiffany_Hayden_
Collaborator
Collaborator

@WCrihfield Thanks so much! I'm glad I wasn't missing something big. As always, you're a wealth of knowledge! I'll tinker with it and see if I can do anything close to what I need. Appreciate your quick response. Thanks! 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 4 of 5

Curtis_Waguespack
Consultant
Consultant
Accepted solution
0 Likes
Message 5 of 5

Tiffany_Hayden_
Collaborator
Collaborator

Thanks so much! 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes