kroma25
Automotive
- Sep 9, 2021
- 1
Hi,
I wrote a macro that reads a 3dxml file and exports CATProduct, but the exported file is garbled. I run the macro through powershell. Everything is done in batch mode. Interestingly, the same macro works fine with open CATI (no batch mode), and it is even more interesting that on another laptop my macro in batch mode works fine. I tested the macro on CATI R23, R28, R29. Has anyone had such a problem and knows how to solve it?
PowerShell Command:
Catia Marco:
LINK to file: Link
I wrote a macro that reads a 3dxml file and exports CATProduct, but the exported file is garbled. I run the macro through powershell. Everything is done in batch mode. Interestingly, the same macro works fine with open CATI (no batch mode), and it is even more interesting that on another laptop my macro in batch mode works fine. I tested the macro on CATI R23, R28, R29. Has anyone had such a problem and knows how to solve it?
PowerShell Command:
Code:
$macroPath = "C:\Users\QTSWISS\Visual_Studio_Code\Test.catvbs"
$CMD = "C:\Program Files\Dassault Systemes\B28\win_b64\code\bin\CATSTART.exe"
$arg1 = "-env"
$arg2 = "CATIA_PLM_Express.V5-6R2018.B28"
$arg3 = "-direnv"
$arg4 = "C:\ProgramData\DassaultSystemes\CATEnv"
$arg5 = "-run"
$arg6 = "CNEXT -batch -macro $macroPath"
& $CMD $arg1 $arg2 $arg3 $arg4 $arg5 $arg6
Catia Marco:
Code:
Language="VBSCRIPT"
Sub CATMain()
Set documents1 = CATIA.Documents
Set document1 = documents1.Open("C:\Konwerter\Pliki_testowe\Uszkodzony2.3dxml")
Set productDocument1 = CATIA.ActiveDocument
productDocument1.SaveAs "C:\Konwerter\Pliki_testowe\u\Uszkodzony2.CATProduct"
End Sub


LINK to file: Link