Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iProperties failure in Formatted Text

1 REPLY 1
Reply
Message 1 of 2
brianA32ZM
142 Views, 1 Reply

iProperties failure in Formatted Text

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. 

brianA32ZM_0-1661960852852.png

 

 

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&apos;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&apos;d</StyleOverride>

 

 

Inventor 2023

1 REPLY 1
Message 2 of 2
brianA32ZM
in reply to: brianA32ZM

Update: I found by adding the following code at the end of my program the issue is resolved:

oFormText.FormattedText = oFormText.FormattedText 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report