Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hi Folks,
I have created a windows application using vb.net.
I need a program to read the value of a text note, When i click on a button it should allow me to select annotate on drawing page and then it should capture the text and place it on textbox1.
Kindly help me, if anyone have the vb.net script pls share it.
Thanks,
Pavithra
Were you able to solve it? I want to get all notes in a drawing and print the text to a multiline textbox
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim asyncConnection As IpfcAsyncConnection = Nothing
Dim sessMain As IpfcBaseSession
Dim selOptions As IpfcSelectionOptions
Dim selsSelected As IpfcSelections
Dim selSelected As IpfcSelection
Dim noteSelected As IpfcDetailNoteItem
Dim linsText As CpfcDetailTextLines
Dim strText As String = ""
Try
asyncConnection = (New CCpfcAsyncConnection).Connect(Nothing, Nothing, ".", Nothing)
sessMain = asyncConnection.Session
selOptions = (New CCpfcSelectionOptions).Create("any_note")
selOptions.MaxNumSels = 1
selsSelected = sessMain.Select(selOptions, Nothing)
selSelected = selsSelected.Item(0)
noteSelected = CType(selSelected.SelItem, IpfcDetailNoteItem)
linsText = noteSelected.GetTextLines(EpfcDimDisplayMode.EpfcDIM_DISPLAY_NUMERIC)
For i = 0 To linsText.Count - 1
For j = 0 To linsText.Item(i).Texts.Count - 1
strText &= linsText.Item(i).Texts.Item(j).Text
Next
strText &= vbCrLf
Next
TextBox1.Text = strText.Trim
asyncConnection.Disconnect(1000)
Catch ex As Exception
End Try
End Sub