Mastering NIP-Activity in CATIA: A Comprehensive Guide to Non-Interactive Process Automation
NIP-Activity — Catia
Example: A Simple NIP-Compatible CATScript
This script opens a part, sets a user-defined parameter, and saves it as a STEP file.
Language="VBSCRIPT"Sub CATMain() Dim oDoc As Document Dim oPart As Part Dim strInputFile As String Dim strOutputFile As String Dim oFileSystem Dim oLogFile
' --- Initialize Logging --- Set oFileSystem = CreateObject("Scripting.FileSystemObject") Set oLogFile = oFileSystem.OpenTextFile("C:\NIP_Logs\process.log", 8, True) ' 8 = append oLogFile.WriteLine "[" & Now & "] Starting NIP Process." ' --- Input from command line or external file --- ' For simplicity, hardcoded here, but should be read from an argument strInputFile = "C:\CATIA_Data\Input\MyPart.CATPart" strOutputFile = "C:\CATIA_Data\Output\MyPart.STEP" ' --- Open the document --- Set oDoc = CATIA.Documents.Open(strInputFile) If oDoc Is Nothing Then oLogFile.WriteLine "ERROR: Could not open " & strInputFile oLogFile.Close Exit Sub End If oLogFile.WriteLine "Opened: " & strInputFile ' --- Perform a modification (Example: set a parameter) --- On Error Resume Next Set oPart = oDoc.Part Dim oParams As Parameters Set oParams = oPart.Parameters Dim oParam As Parameter Set oParam = oParams.Item("BatchProcessed") If Err.Number = 0 Then oParam.Value = "Yes" oLogFile.WriteLine "Updated parameter 'BatchProcessed' to Yes." Else oLogFile.WriteLine "Warning: Parameter 'BatchProcessed' not found." End If On Error GoTo 0 ' --- Export as STEP --- Dim oStepSetting As SettingController Set oStepSetting = CATIA.GetSetting("STEPSettingController") ' (Configure STEP settings as needed) oDoc.Export oOutputFile, "STEP" oLogFile.WriteLine "Exported to: " & strOutputFile ' --- Clean up --- oDoc.Close oLogFile.WriteLine "[" & Now & "] Process completed." oLogFile.Close Set oDoc = Nothing Set oPart = Nothing
End Sub
4. Integration into PLM Pipelines
NIP-Activity is the backbone of many automated Product Lifecycle Management (PLM) pipelines. For example, when a designer checks in a new part, a server-side NIP process can automatically run a clash detection or draft analysis without human intervention.