Hello.
I have the need to:
add an general note on all sheets, (ok)
save to PDF, (ok)
delete genera note added. (ERROR)
Dim DrawDoc As Inventor.DrawingDocument = inventorApp.ActiveDocument
Dim Evasione As Inventor.GeneralNote
For Each Sheet In DrawDoc.Sheets Sheet.Activate() Dim Geom As Inventor.TransientGeometry = inventorApp.TransientGeometry Evasione = Sheet.DrawingNotes.GeneralNotes.AddFitted(Geom.CreatePoint2d(Sheet.Width - 3.5, 4.5), TextBox6.Text & vbCrLf & TextBox7.Text) Evasione.Rotation = 0.785398 'radianti Evasione.LineSpacing = 0.6 Evasione.HorizontalJustification = Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter Evasione.VerticalJustification = Inventor.VerticalTextAlignmentEnum.kAlignTextMiddle DrawDoc.Update() Next
-------+PDF GENERATION CODE-------
For Each Sheet In DrawDoc.Sheets
Sheet.Activate()
Evasione.Delete()
Next
DrawDoc.Update()
HELP Please.
Solved! Go to Solution.
Hello.
I have the need to:
add an general note on all sheets, (ok)
save to PDF, (ok)
delete genera note added. (ERROR)
Dim DrawDoc As Inventor.DrawingDocument = inventorApp.ActiveDocument
Dim Evasione As Inventor.GeneralNote
For Each Sheet In DrawDoc.Sheets Sheet.Activate() Dim Geom As Inventor.TransientGeometry = inventorApp.TransientGeometry Evasione = Sheet.DrawingNotes.GeneralNotes.AddFitted(Geom.CreatePoint2d(Sheet.Width - 3.5, 4.5), TextBox6.Text & vbCrLf & TextBox7.Text) Evasione.Rotation = 0.785398 'radianti Evasione.LineSpacing = 0.6 Evasione.HorizontalJustification = Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter Evasione.VerticalJustification = Inventor.VerticalTextAlignmentEnum.kAlignTextMiddle DrawDoc.Update() Next
-------+PDF GENERATION CODE-------
For Each Sheet In DrawDoc.Sheets
Sheet.Activate()
Evasione.Delete()
Next
DrawDoc.Update()
HELP Please.
Solved! Go to Solution.
Solved by MechMachineMan. Go to Solution.
Something like this should work for you.
Sub Main() Call AddNote() Call PrintPDF() Call DeleteNote() End Sub Sub AddNote() Dim invApp As Inventor.Application invApp = ThisApplication Dim oDrawDoc As Document oDrawDoc = invApp.ActiveEditDocument Dim oTG As Inventor.TransientGeometry = invApp.TransientGeometry For Each oSheet In oDrawDoc.Sheets oNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oTG.CreatePoint2d(oSheet.Width - 3.5, 4.5), "Text" & vbCrLf & "Other Text") With oNote .Rotation = 0.785398 'radianti .LineSpacing = 0.6 .HorizontalJustification = Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter .VerticalJustification = Inventor.VerticalTextAlignmentEnum.kAlignTextMiddle End With oDrawDoc.Update() Next End Sub Sub PrintPdf() MsgBox("Code for printing goes here instead!") End Sub Sub DeleteNote() Dim invApp As Inventor.Application invApp = ThisApplication Dim oDrawDoc As Document oDrawDoc = invApp.ActiveEditDocument For Each oSheet In oDrawDoc.Sheets For Each oGeneralNote In oSheet.DrawingNotes.GeneralNotes If oGeneralNote.Rotation = 0.785398 oGeneralNote.Delete End If Next Next End Sub
Something like this should work for you.
Sub Main() Call AddNote() Call PrintPDF() Call DeleteNote() End Sub Sub AddNote() Dim invApp As Inventor.Application invApp = ThisApplication Dim oDrawDoc As Document oDrawDoc = invApp.ActiveEditDocument Dim oTG As Inventor.TransientGeometry = invApp.TransientGeometry For Each oSheet In oDrawDoc.Sheets oNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oTG.CreatePoint2d(oSheet.Width - 3.5, 4.5), "Text" & vbCrLf & "Other Text") With oNote .Rotation = 0.785398 'radianti .LineSpacing = 0.6 .HorizontalJustification = Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter .VerticalJustification = Inventor.VerticalTextAlignmentEnum.kAlignTextMiddle End With oDrawDoc.Update() Next End Sub Sub PrintPdf() MsgBox("Code for printing goes here instead!") End Sub Sub DeleteNote() Dim invApp As Inventor.Application invApp = ThisApplication Dim oDrawDoc As Document oDrawDoc = invApp.ActiveEditDocument For Each oSheet In oDrawDoc.Sheets For Each oGeneralNote In oSheet.DrawingNotes.GeneralNotes If oGeneralNote.Rotation = 0.785398 oGeneralNote.Delete End If Next Next End Sub
Can you provide ilogic rule for update existing general notes or delete and make a new one in active sheet only?
Thank you.
Can you provide ilogic rule for update existing general notes or delete and make a new one in active sheet only?
Thank you.
Can't find what you're looking for? Ask the community or share your knowledge.