cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Creo VB API -- Helped needed on annotation

pj-2
1-Newbie

Creo VB API -- Helped needed on annotation

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

2 REPLIES 2
Johndoeanon
4-Participant
(To:pj-2)

Were you able to solve it? I want to get all notes in a drawing and print the text to a multiline textbox

Shaffer
5-Regular Member
(To:pj-2)

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

Announcements