My first approach was using python-can (as it added support for parsing BLF files with 2.0.0 release) like this:
import can
filename = \"logfile.blf\"
loggi
You can use the following scripts to automate the file format conversion with the automation of your CANoe or CANalyzer. The solution consists of a Windows batch file and a VisualBasicScript file.
The batch file convert_this_folder.bat
has to be started by double-click. It contains the following line which calls the other script for all BLF log files in the folder where the batch file is located:
for /F %%x in ('cd') do for %%i in (*.blf) do c:\windows\system32\wscript.exe canoe_convert.vbs %%i %%x
The VBS script canoe_convert.vbs
contains the following lines:
'-----------------------------------------------------------------------------
' converts the filenames which are passed via startup parameter to ASC files with the help of CANoe
'-----------------------------------------------------------------------------
Dim src_file, dst_file, pos
Set App = CreateObject("CANoe.Application")
Set Measurement = App.Measurement
Set args = WScript.Arguments
' read first command line parameter
arg0=args.Item(0)
arg1=args.Item(1)
If Measurement.Running Then
Measurement.Stop
End If
Wscript.Sleep 500
'---------------------------------------------------------------------------
' you have to create an empty CANoe configuration and specify the path and file name below
'-----------------------------------------------------------------------------
App.Open("d:awayawayempty_config.cfg")
'-----------------------------------------------------------------------------
' create destination file name and append .asc -- you could change this to different file format that is supported by CANoe
src_file=arg1 & "" & arg0
dst_file=src_file & ".asc"
Set Logging = App.Configuration.OnlineSetup.LoggingCollection(1)
Set Exporter = Logging.Exporter
With Exporter.Sources
.Clear
.Add(src_file)
End With
' Load file
Exporter.Load
With Exporter.Destinations
.Clear
.Add(dst_file)
End With
Exporter.Save True
App.Quit
Set Exporter = Nothing
Set Logging = Nothing
Set App = Nothing
Set args = Nothing
Set Measurement = Nothing
What you have to do:
The script files are attached below. You can adjust the scripts to CANalyzer by replacing "CANoe.Application" with "CANalyzer.Application" in the VBS file. The empty CANalyzer configuration has to be created additionally.
The conversion types can be adjusted as follows: Source file type in the .BAT file: change .BLF to the supported requested source file format Destination file type in the .VBS file: change .ASC to the supported requested destination file format.