Kenja824
Automotive
- Nov 5, 2014
- 949
I have a journal that automatically looks for any notes on the drafting sheet that says "PRELIMINARY" and deletes them.
I am trying to adapt it to look for the "AUTH" note and instead of deleting it, to change it to...
AFFECTED
TEMPLATES
It also needs to change the settings to be centered and have a 2.0 height instead of Left and 2.88 hgt.
I recorded making such a change manually and have been trying to make the changes accordingly.
Currently, I keep getting this error....
Line 39 : Value of type '1-dimensional array of String' cannot be converted to 'NXOpen.Annotations.SimpleDraftingAid'.
My understanding is that the original journal used simple one line of text and it is not able to handle two lines?
Could someone help me with what else I need to change?
Ken
My brain is like a sponge. A sopping wet sponge. When I use it, I seem to lose more than I soak in.
I am trying to adapt it to look for the "AUTH" note and instead of deleting it, to change it to...
AFFECTED
TEMPLATES
It also needs to change the settings to be centered and have a 2.0 height instead of Left and 2.88 hgt.
I recorded making such a change manually and have been trying to make the changes accordingly.
Currently, I keep getting this error....
Line 39 : Value of type '1-dimensional array of String' cannot be converted to 'NXOpen.Annotations.SimpleDraftingAid'.
My understanding is that the original journal used simple one line of text and it is not able to handle two lines?
Could someone help me with what else I need to change?
Code:
Option Strict Off
Imports System
Imports NXOpen
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Const noteText As String = "AUTH"
For Each tempNote As Annotations.Note In workPart.Notes
'Dim tempText() As String = tempNote.GetText
'If tempText(0) = noteText Then
Dim text1() As String = tempNote.GetText
If text1(0) = noteText Then
Dim draftingNoteBuilder1 As NXOpen.Annotations.DraftingNoteBuilder = Nothing
' Dim text1(1) As String
text1(0) = "AFFECTED"
text1(1) = "TEMPLATES"
draftingNoteBuilder1.Text.TextBlock.SetText(text1)
draftingNoteBuilder1 = workPart.Annotations.CreateDraftingNoteBuilder(text1)
draftingNoteBuilder1.Text.TextBlock.CustomSymbolScale = 1.0
draftingNoteBuilder1.Origin.SetInferRelativeToGeometry(True)
'***************************************************************
'Dim notifyOnDelete1 As Boolean
'notifyOnDelete1 = theSession.Preferences.Modeling.NotifyOnDelete
'theSession.UpdateManager.ClearErrorList()
'Dim markId1 As Session.UndoMarkId
'markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Delete")
'Dim nErrs1 As Integer
'nErrs1 = theSession.UpdateManager.AddToDeleteList(tempNote)
'Dim notifyOnDelete2 As Boolean
'notifyOnDelete2 = theSession.Preferences.Modeling.NotifyOnDelete
'Dim nErrs2 As Integer
'nErrs2 = theSession.UpdateManager.DoUpdate(markId1)
'**************************************************************
End If
Next
lw.Close()
End Sub
End Module
Ken
My brain is like a sponge. A sopping wet sponge. When I use it, I seem to lose more than I soak in.