$MaxConcurrent = 4 $JobList = Get-Content "C:\FileLists\jobs.txt" foreach ($Job in $JobList) while ((Get-Process "CATIA_NIR" -ErrorAction SilentlyContinue).Count -ge $MaxConcurrent) Start-Sleep -Seconds 10
1. Nightly Drawing Updates Aerospace and automotive suppliers often run NIP workflows to update 2D drawings from 3D part changes. Every night, a script scans a PDM workspace, opens any modified part, updates its associated drawing, and republishes it as a PDF. 2. Geometry Healing for CAE Before running finite element analysis (FEA), engineers need clean geometry. NIP-Activity can open CATIA models, run a "Heal Geometry" macro, remove small edges, and export a neutral format (STP, IGES) for the simulation team. 3. Bill of Materials (BOM) Extraction A macro can traverse an assembly, extract all part numbers, materials, and quantities, and write them to an Excel sheet via OLE automation—all without a user touching the mouse. 4. Compliance Checking Run a non-interactive script that checks every part in a design against a company standard (e.g., "No part shall have a thickness less than 1.5mm"). The script outputs a non-compliance report. Troubleshooting Common NIP-Activity Errors Because you can't "see" what went wrong, NIP troubleshooting relies entirely on logs. NIP-Activity - Catia
oDoc.Export oOutputFile, "STEP" oLogFile.WriteLine "Exported to: " & strOutputFile $MaxConcurrent = 4 $JobList = Get-Content "C:\FileLists\jobs
' --- Initialize Logging --- Set oFileSystem = CreateObject("Scripting.FileSystemObject") Set oLogFile = oFileSystem.OpenTextFile("C:\NIP_Logs\process.log", 8, True) ' 8 = append NIP troubleshooting relies entirely on logs.
' --- Export as STEP --- Dim oStepSetting As SettingController Set oStepSetting = CATIA.GetSetting("STEPSettingController") ' (Configure STEP settings as needed)
Set oDoc = Nothing Set oPart = Nothing End Sub One of the most powerful applications of NIP-Activity is parallel processing. Because NIP sessions have a low overhead, you can launch multiple instances simultaneously. Using a Batch Script for Parallel Execution @echo off set MACRO_PATH=C:\NIP_Macros\ProcessPart.CATScript set INPUT_LIST=C:\FileLists\parts.txt for /f "tokens=*" %%i in (%INPUT_LIST%) do ( start /min CATIA_NIR.exe -batch -macro "%MACRO_PATH%" -arg "%%i" -log "C:\Logs%%~ni.log" timeout /t 2 /nobreak >nul ) echo All NIP processes launched.
' --- 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