Nipactivity Catia New < REAL | 2024 >

Function SafeOpenDocument(path)
    On Error Resume Next
    Set SafeOpenDocument = CATIA.Documents.Open(path)
    If Err.Number <> 0 Then
        LogError "Failed to open: " & path & " - " & Err.Description
        Set SafeOpenDocument = Nothing
    End If
    On Error GoTo 0
End Function

Sub LogError(msg) Dim fso, logFile Set fso = CreateObject("Scripting.FileSystemObject") Set logFile = fso.OpenTextFile("C:\Logs\NIPError.log", 8, True) logFile.WriteLine Now & " - " & msg logFile.Close End Sub

You must feed the NIPActivity a CATCommand GUID or a Knowledgeware Script Path. For example, to open a part and run a heal command: nipactivity catia new

CATCommandHeader header("HealGeometry");
pNIPAct -> AddCommand(header, "C:\MyScripts\HealRules.catvbs");
[Input Data] → [NIP Script / Batch Executable] → [CATIA Session (Background)] → [Output Files / Logs]

Instead of using CATStartBatch, you now instantiate CATNIPActivity. You must feed the NIPActivity a CATCommand GUID

CATNIPActivity *pNIPAct = new CATNIPActivity("MyBatchHealing");
pNIPAct -> SetMode(NIP_No_UI); // Crucial for "New" silent mode