Good Morning,
I am looking for a way to copy a general note to another sheet via iLogic. In the API help manual, the only two methods attached to a GeneralNote is Delete and GetReferenceKey. It is yelling at me telling me that a CopyTo or CopyContentsTo does not exist under GeneraNote as I have used these for drawing views. Any ideas on how I can get this note on my other sheet?
Snippet of Code:
' Define Document Dim oDoc as Document oDoc = ThisApplication.ActiveDocument 'Define BLANK Sheet Dim oBlank As Sheet oBlank = oDoc.Sheets.item("BLANK:1") 'Define FORMED Sheet Dim oFormed As Sheet oFormed = oDoc.Sheets.item("FORMED:2") Dim oNotes As GeneralNotes oNotes = oBlank.DrawingNotes.GeneralNotes Dim oNote As GeneralNote oNote = oNotes.item(1) oNote.Copyto(oFormed)
Thanks for the help,
Nick
Solved! Go to Solution.
Solved by Sergio.D.Suárez. Go to Solution.
Hi, try this rule,
' Define Document Dim oDoc As Document oDoc = ThisApplication.ActiveDocument 'Define BLANK Sheet Dim oBlank As Sheet oBlank = oDoc.Sheets.item("BLANK:1") 'Define FORMED Sheet Dim oFormed As Sheet oFormed = oDoc.Sheets.item("FORMED:2") Dim oNoteA As GeneralNote oNoteA = oBlank.DrawingNotes.GeneralNotes.Item(1) Dim opoint As Point2d = oNoteA.Position Dim sText As String = oNoteA.Text Dim oNoteB As GeneralNote oNoteB = oFormed.DrawingNotes.GeneralNotes.AddFitted(opoint, sText) oNoteB.FormattedText = oNoteA.FormattedText oNoteB.TextStyle= oNoteA.TextStyle oNoteB.Color= oNoteA.Color oNoteB.Height= oNoteA.Height oNoteB.Layer = oNoteA.Layer oNoteB.Width= oNoteA.Width
I hope it helps you with the solution you are looking for. regards
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn
Thanks a lot,
That got me pretty much there.
Final portion of the code:
Dim oNotes As GeneralNotes oNotes = oBlank.DrawingNotes.GeneralNotes Dim oNote As GeneralNote oNote = oNotes.Item(1) Dim opoint As Point2d = oNote.Position Dim sText As String = oNote.Text Dim oNoteB As GeneralNote oNoteB = oFormed.DrawingNotes.GeneralNotes.AddFitted(opoint, sText) oNoteB.FormattedText = oNote.FormattedText oNoteB.TextStyle= oNote.TextStyle oNoteB.Color= oNote.Color oNoteB.Height= oNote.Height oNoteB.Layer = oNote.Layer oNoteB.Width= oNote.Width
For some reason though, the New Note is placed slightly lower on the Formed Sheet, even though the position was taken from the original. Not sure how that makes sense, but no problem either way.
Thanks for this code.
For others also wanting to use this code
If you place this code at the end, the position will be right
oNoteB.Position = oNote.Position
Also place the 'formatted text' line belown the 'text style' line, to preserve your formatted text styles like Bold text
Can't find what you're looking for? Ask the community or share your knowledge.