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: 

Copy a General Note to Another Sheet iLogic

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
626 Views, 3 Replies

Copy a General Note to Another Sheet iLogic

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

3 REPLIES 3
Message 2 of 4
Sergio.D.Suárez
in reply to: Anonymous

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


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 4
Anonymous
in reply to: Sergio.D.Suárez

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. 

Message 4 of 4
jaco011
in reply to: Anonymous

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.

Post to forums  

Autodesk Design & Make Report