0

I am learning python language and i would like to learn something about writing a script for CAD programs. But i do not know one thing and didn`t finded any information how put my script/macro on catia toolbar. There is no problem with VBA macros however there is with other languages.

J.Cleese
  • 25
  • 1
  • 6

1 Answers1

1

You can always create a CATScript/catvbs/catvba to call what ever you want (macro, application...) inside CATIA and assign an icon on a toolbar to these "launchers".

Code samples bellow are in CATScript.

For example, run a hta file.

Language="VBSCRIPT"
Sub CATMain()
Set WshShell = CreateObject("WScript.Shell")
'Run the hta.
hta = "c:\Temp\E3source\CATVBS\your_file.hta" 
WshShell.Run hta , 1, true
Set WshShell = Nothing
End Sub

Run an exe file

Sub CATMain()
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run("C:\temp\your_file.exe")
Set WshShell = Nothing
End Sub

Or

Sub CATMain()
call CATIA.SystemService.ExecuteBackGroundProcessus ("c:\Temp\your_file.exe")
End Sub

Run a bat file

Sub CATMain()
CATIA.SystemService.ExecuteProcessus "C:\Temp\your_file.bat"
End Sub

Run a vbs file

Language="VBSCRIPT"
Sub CATMain()
call CATIA.SystemService.ExecuteBackGroundProcessus("WScript.exe c:\CAT\copy_folder.vbs")
End Sub 
ferdo
  • 178
  • 4