Inventor 2023 : Copy Drawing Note from another drawing document. Resize RangeBox.

Inventor 2023 : Copy Drawing Note from another drawing document. Resize RangeBox.

vpeuvion
Advocate Advocate
304 Views
2 Replies
Message 1 of 3

Inventor 2023 : Copy Drawing Note from another drawing document. Resize RangeBox.

vpeuvion
Advocate
Advocate

Hi,

I want to copy a drawing note from one document to another. The problem is that the new drawing note has a different RangeBox size than the drawing note that was copied from.
I can't seem to resize it, this note contains parameters and when they are filled, the length of the line of text exceeds the maximum length and jumps to the line.
I tried with AddByRectangle and AddFitted but the RangeBox of the new drawing note is always minimized. I also tried with GetBoxData and PutBoxData but this gives me an error message and the RangeBox is always reduced to the minimum.
Does someone have an idea?

	Dim oTemplateFileName As String = "--\Inventor\---\Templates\Standard.dwg"
	Dim oTemplateDoc As DrawingDocument = ThisApplication.Documents.Open(oTemplateFileName, False)
	Dim oDrawDoc As DrawingDocument = ThisDoc.Document
	Dim oSheet As Sheet = oDrawDoc.ActiveSheet

	For Each oNote As DrawingNote In oTemplateDoc.ActiveSheet.DrawingNotes
		If oNote.Type.ToString = "kGeneralNoteObject" Then 
			' Test GetBoxData
			Dim MinPoint(2) As Double
       		Dim MaxPoint(2) As Double
			Call oNote.RangeBox.GetBoxData(MinPoint, MaxPoint)
			' Test with AddByRectangle
			Dim oCorner1 As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oNote.RangeBox.MinPoint.X, oNote.RangeBox.MaxPoint.Y)
			Dim oCorner2 As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oNote.RangeBox.MaxPoint.X,oNote.RangeBox.MinPoint.Y)
			Dim oNewNote As DrawingNote = oSheet.DrawingNotes.GeneralNotes.AddByRectangle(oCorner1, oCorner2, oNote.FormattedText)
			' Test with AddFitted
			'Dim oNewNote As DrawingNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oNote.Position, oNote.FormattedText)
			' Test PutBoxData
			Call oNewNote.RangeBox.PutBoxData(MinPoint, MaxPoint)
		End If
	Next

 Drawing note for reference : 

vpeuvion_0-1712566409981.png

Drawing note after copy : 

vpeuvion_1-1712566457253.png

Is it possible to change the size of the RangeBox?

Thanks. Vincent.

0 Likes
Accepted solutions (2)
305 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @vpeuvion.  That size difference thing is definitely a tough one to fix by code.  Manually, I often see similar notes where the apparent boundaries are way larger than the contents of the note, and one thing that often works to fix it (manually) is to edit it, add a space at the end of one of its lines, then delete that character again, then click OK.  That often causes the 'bounds' to auto-fit the contents, without having to drag corner nodes.  That reaction may just be a built-in supportive 'helper' that only happens when this is done manually.  But to test, you could try editing the contents of the note a second time, after its 'linked' values have been obtained/updated, just to see if that will fix its bounds, like the manual process does sometimes.

 

The alternative may be to use a SketchedSymbol, instead of a GeneralNote, where you would have access to the actual TextBox object, and its 'border geometry', so that you could control its size with sketch based constraints.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

vpeuvion
Advocate
Advocate
Accepted solution

Hi @WCrihfield,

Thank you for your reply.

I did your test and if I edit the content a second time when the linked values are filled, the size updates fine. Unfortunately I don't know when these values are filled and I can't re-edit the content with each change.

But your answer gave me another idea, when I insert the text into the note, I add an extra line which contains a space string and the drawing note is sized according to the size of this string. It's not a very clean way of doing things but it solves my problem.

oDrawingNote.RangeBox is read-only, which is probably why we cannot resize it after creation.

Dim oNewNote As DrawingNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oNote.Position, oNote.FormattedText & Chr(13) & "                                                    ")

Thanks. Vincent.