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: 

Inserting physical properties into drawing notes programmatically

1 REPLY 1
Reply
Message 1 of 2
meGVGMF
105 Views, 1 Reply

Inserting physical properties into drawing notes programmatically

Hi,

 

I'm simply trying to insert the <MASS> physical property into a drawing note, through the `DrawingNote.FormattedText` property.

When the note is nothing but manually entered text, or when the physical property exists already, it's fine; but when the note contains a user parameter, it causes the whole string to become unformatted and show just the XML-ish string instead.

 

Here is the process I am using. The property-invoking string I got from inspecting a note with this already inserted manually.

 

 

Sub Main()
	Dim oApp As Application = ThisApplication
	Dim oDoc As DrawingDocument = ThisDoc.Document

	Dim sUndoTrnsName As String = "Insert Mass"
	Dim trnsUndo As Transaction = oApp.TransactionManager.StartTransaction(oDoc, sUndoTrnsName)

	For Each oSheet As Sheet In oDoc.Sheets
		For Each oNote As DrawingNote In oSheet.DrawingNotes
			oNote.FormattedText = oNote.FormattedText + "<PhysicalProperty PhysicalPropertyID='72449' Precision='3'>MASS</PhysicalProperty>"
		Next
	Next

	trnsUndo.End
End Sub

 

 

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

So looking into it further I can say it's clearly some kind of character encoding issue.

Simply assigning `DrawingNote.FormattedText`, or `DrawingDimension.Text.FormattedText`, to itself, when it contains a user parameter, produces the same result.

I've tried using `Regex.Escape` but it's no use.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report