iProperties failure in Formatted Text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I am having an issue with formatted text located on a sketch in a flat pattern. The code below is part of a process that adds a text box to a flat pattern. From there it adjust the size of the text according to the flat pattern extents and centers the text on the part. The issue I am experiencing is that in random cases the text that is driven by iProperties fails to show the property value (see below). This also happens when the text size is manually changed. The only way that I could restore the values was to add another iProperty.
Sub MarkText(oFormText, oTextSize) 'set text for lines 1, 2, 3, 4, & 5 'Part No Dim sTextL1 As String = "<StyleOverride FontSize='" + oTextSize + "'><Property Document='model' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride><Br/>" 'Tag Dim sTextL2 As String = "<StyleOverride FontSize ='" + oTextSize + "'>Tag: </StyleOverride><StyleOverride FontSize='" + oTextSize + "'><Property Document='model' PropertySet='User Defined Properties' Property='TAG' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}'>TAG</Property></StyleOverride><Br/>" 'description Dim sTextL3 As String = "<StyleOverride FontSize ='" + oTextSize + "'><Property Document='model' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='29'>DESCRIPTION</Property></StyleOverride><Br/>" 'material Dim sTextL4 As String = "<StyleOverride FontSize ='" + oTextSize + "'><Property Document='model' PropertySet='User Defined Properties' Property='PART MATERIAL' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}'>PART MATERIAL</Property></StyleOverride><Br/>" 'qty Dim sTextL5 As String = "<StyleOverride FontSize ='" + oTextSize + "'>(1) Req'd</StyleOverride>" 'ThisApplication.ActiveDocument.ComponentDefinition.FlatPattern.Sketches(oNewSketchName).TextBoxes.Item(1).FormattedText = (sTextL1 + sTextL2 + sTextL3 + sTextL4 + sTextL5) oFormText.FormattedText = (sTextL1 + sTextL2 + sTextL3 + sTextL4 + sTextL5) InventorVb.DocumentUpdate() End Sub
Failed formatted Text:
<StyleOverride FontSize='2.54'><Property Document='model' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride><Br/><StyleOverride FontSize='2.54'>Tag: </StyleOverride><StyleOverride FontSize='2.54'><Property Document='model' PropertySet='User Defined Properties' Property='TAG' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}'>TAG</Property></StyleOverride><Br/><StyleOverride FontSize='2.54'><Property Document='model' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='29'>DESCRIPTION</Property></StyleOverride><Br/><StyleOverride FontSize='2.54'><Property Document='model' PropertySet='User Defined Properties' Property='PART MATERIAL' FormatID='{D5CDD505-2E9C-101B-9397-08002B2CF9AE}'>PART MATERIAL</Property></StyleOverride><Br/><StyleOverride FontSize='2.54'>(1) Req'd</StyleOverride>
Inventor 2023