Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract data to Manufacturing Opération ( CATProcess)

Status
Not open for further replies.

ABenoit

New member
Jul 20, 2016
1
FR
Hi,
I'm trying to develop program in VB to extract data of manufacturing Operation (ToolChange) .
I'm working on VB2012, and I used late binding for the variable.
I want to recover 2 datas, name and comment.
For the name, it's work very well, but, for the comment (type CATBSTR) isn't doesn't work.
Do you have an idea of the problem ?
I think there is a conflict with the type of the variable.

Thanks in advance.
Benoit

Code:
    Sub recup_seq_CATIA()


        Dim oSel As Object   ' INFITF.Selection
        Dim oSelArray(0)
        Dim iNumberOfMO As Integer, i As Integer, iNRows As Integer, NbLignefinal As Integer
        Dim MoComment As String, MoCorrectTool As String, sMessage As String, sAnswer As String, _
            MoName As String, MoTool As String, StrFileReferencePath As String, StrDestination As String
        Dim ToolPalette
        Dim oCoords(2)
        Dim ProcDoc As Object = Nothing  ' ProcessDocument
        Dim GetProcessCat As Object = Nothing   ' PPRActivity
        Dim CurrentActivity As Object = Nothing  ' ManufacturingActivity
        Dim oMOArray() As Object = Nothing    ' ManufacturingOperation
        Dim CurrentTool As Object = Nothing   ' ManufacturingTool
        Dim User As String

        Call GetParameters()
        Call CallCatia()
        If Err.Number <> 0 Then
            MsgBox("Pas de Catia ouvert")
            GoTo CloseApp
        End If

        User = Environment.UserName
        ProcDoc = CATIA.ActiveDocument
        GetProcessCat = ProcDoc.GetItem("Process")
        NumProg = GetProcessCat.ChildrenActivities.Item(2)
        NumRP = NumProg.ChildrenActivities.Item(2)

        On Error Resume Next
        'Lancement de la Tools Palette
        oSel = CATIA.ActiveDocument.Selection
        Call oSel.Clear()
        oSelArray(0) = "ManufacturingActivity"
        sMessage = "Sélectionner les séquences à analyser dans la FI puis cliquez sur la balle verte.¨Presser <ECHAP> pour quitter..." 'Affichage en bas
        ToolPalette = oSel
        sAnswer = ToolPalette.SelectElement3(oSelArray, sMessage, False, 2, False)
        If sAnswer = "Normal" Then
            iNumberOfMO = oSel.Count2
            iNRows = iNumberOfMO - 1
            ReDim oMOArray(iNumberOfMO)
            For i = 1 To iNumberOfMO
                oMOArray(i) = oSel.Item2(i).Value
            Next i

            Call oSel.Clear()

            For i = 1 To iNumberOfMO
                CurrentActivity = oMOArray(i)
                Dim Commentaire As String = CurrentActivity.Comment
                MsgBox(Commentaire)
            Next i
        End If


Closeapp:




    End Sub


 
Status
Not open for further replies.
Back
Top