Announcements

Community notifications may experience intermittent interruptions between 10–12 November during scheduled maintenance. We appreciate your patience.

Inserting physical properties into drawing notes programmatically

Inserting physical properties into drawing notes programmatically

Anonymous
Not applicable
467 Views
1 Reply
Message 1 of 2

Inserting physical properties into drawing notes programmatically

Anonymous
Not applicable

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

 

 

0 Likes
Reply (1)
Message 2 of 2

Anonymous
Not applicable

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.

0 Likes