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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

HOW TO DELETE THE SYMBOL'S USING VB-API

avijayan-2
14-Alexandrite

HOW TO DELETE THE SYMBOL'S USING VB-API

HI EVERYONE,

I AM FACING FEW ISSUES WHILE I AM TRYING TO DELETE THE SYMBOL INSTANCES FROM CREO DRAWING TEMPLATE.

I WILL EXPLAIN IT BRIEFLY:

I HAVE A CREO DRAWING TEMPLATE WHICH IS HAVING MANY SYMBOLS FOR Eg: REVISION BALLOON, SURFACE FINISH etc.WHAT I WANT TO DO IS I WANT TO DELETE SOME SPECIFIC SYMBOL INSTANCES FROM THE DRAWING LIKE.

1. I HAVE SURFACE FINISH SYMBOLS FROM Ra0.6 TO Ra1.8 IN MY DRAWING BUT I WANT TO DELETE ONLY Ra1.8 FROM MY DRAWING.

2.SIMILARLY I HAVE REVISION BALLOON FROM A TO Z HERE TOO I WANT TO DELETE ONLY A SPECIFIC INSTANCE WHICH USER IS GONNA SELECT.

WITH THE HELP OF Mr Parthiban Kannan‌ I HAVE ALMOST REACHED THE LAST STAGE, BUT NOW I AM FACING ISSUE IN SELECTING THE INSTANCE OF THE SYMBOL.


BELOW GIVEN IS THE CODE:

Public Sub findsymbol(ByRef session As IpfcSession, _

                                   ByVal symbolname As String, _

                                   ByRef TextBox1 As String)

        Try

            Dim model As IpfcModel

            Dim drawing As IpfcModel2D

            Dim symInstructions As IpfcDetailSymbolInstInstructions

            Dim symItem As IpfcDetailSymbolInstItem

            model = session.CurrentModel

            drawing = CType(model, IpfcModel2D)

          

            Dim i As Long

            Dim TotalSheets As Long

            TotalSheets = drawing.NumberOfSheets

            i = drawing.CurrentSheetNumber

            For i = 1 To TotalSheets

                Dim owner As IpfcDetailItemOwner = CType(drawing, IpfcDetailItemOwner)

                Dim symbol As IpfcDetailSymbolDefItem = owner.RetrieveSymbolDefinition(symbolname, Nothing, Nothing, False)

                MessageBox.Show(symbol.GetInstructions.FullPath)

                symInstructions = symbol.ListDetailItems(EpfcDetailType.EpfcDETAIL_SYM_INSTANCE)

                symInstructions.TextValues = TextBox1                 (GETTING ERROR IN THIS LINE)

                symItem = symInstructions.TextValues

                symItem.Remove()

            Next

        Catch ex As Exception

            MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)

        End Try

    End Sub

THIS IS HOW MY FORM LOOKS :

a) FIRST BOX IS FOR SYMBOL NAME

b) SECOND ONE IS FOR SYMBOL INSTANCE WHICH I WANT TO DELETE

ERROR WHAT I AM GETTING :

With Regards

Aghil.M

1 REPLY 1

Hi Aghil,

did you get your code to work?

I also want to go through all symbols on the drawing and get the coordinates of specific symbols.

Adding symbols work, but getting all symbol instances and their info not. Can you paste your code?

 

Thanks,

David

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags