Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Accessing text properties within a draft view

AMN3161
Advocate

Accessing text properties within a draft view

AMN3161
Advocate
Advocate

Hello

 

So i have a draft view that has 49 lines of text, each line is linked to a separate custom i property. Now i want to be able to access the text properties like font, bold etc of each separate line of text within the draft view. I cannot not find any way to find any way to reference those lines of text. There is no names that i can find of them. 

 

If i want a font override for example to be able to change 1 line of text within a draft view, how would i do that? 

0 Likes
Reply
Accepted solutions (1)
449 Views
3 Replies
Replies (3)

bradeneuropeArthur
Mentor
Mentor

With the formatted text:

 

Public Sub x()
Dim a As Application
Set a = ThisApplication

Dim b As DrawingDocument
Set b = a.ActiveDocument

Dim c As Sheet
Set c = b.ActiveSheet

Dim d As DrawingView
Set d = c.DrawingViews.Item(2)

Dim dr As DrawingSketch

Set dr = d.Sketches.Item(1)

MsgBox dr.TextBoxes.Count

Dim sb As TextBox
Set sb = dr.TextBoxes.Item(1)

sb.FormattedText = "<StyleOverride Bold='True'>AAA</StyleOverride><Br/>BBB<Br/>CCC"

End Sub

 

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

AMN3161
Advocate
Advocate

How do you know which item is which? I think "Item(1) if referencing the text but is it a when they were created that defines what item number they are?

0 Likes

WCrihfield
Mentor
Mentor
Accepted solution

Tip:  You can use an InputBox to show yourself what the current contents of the FormattedText is, and have that text be selectable, so you can copy/paste portions of it back into your rule, by simply supplying it as the 'default entry' Input variable.

 

Is each line of text its own TextBox, or are all the linens of text all part of one large TextBox?

If each line is its own TextBox, you can loop through each TextBox, checking FormattedText.Contains("what you're looking for") (as Boolean), to find the Property you're looking for.  Each standard Property has a DisplayName, a Name, a PropID (Long).

And the PropID can be cross referenced with these Enums:

PropertiesForSummaryInformationEnum Enumerator

PropertiesForDocSummaryInformationEnum Enumerator

PropertiesForDesignTrackingPropertiesEnum Enumerator

There is also one for the custom properties, but it doesn't contain any values by default:

PropertiesForUserDefinedPropertiesEnum Enumerator

 

Also, FYI:  Here is the link to Inventor's help page which attempts to show you how to use XML tags to manipulate FormattedText scenarios.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' :thumbs_up:.

If you have time, please... Vote For My IDEAS :light_bulb:or you can Explore My CONTRIBUTIONS

Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes