- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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'
.
If you have time, please... Vote For My IDEAS
or you can Explore My CONTRIBUTIONS
Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield
(Not an Autodesk Employee)