简体   繁体   English

如何使用 Python 脚本控制 CANoe?

[英]How to control CANoe with Python script?

I am working with Vectoe CANoe version 8.5.我正在使用 Vectoe CANoe 8.5 版。 I have written the CAPL script to send messages.我已经编写了 CAPL 脚本来发送消息。 Now I want to write a python script which when executed, starts the execution in CANoe.现在我想写一个 python 脚本,当它执行时,开始在 CANoe 中执行。 How to achieve this.如何实现这一点。

This can be done by using the COM interface to CANoe.这可以通过使用 CANoe 的 COM 接口来完成。 You can use COM interfaces also from python.您也可以从 python 使用 COM 接口。

CANoe's COM interface is well documented. CANoe 的 COM 接口是有据可查的。 Just take a look into the user documentation.只需查看用户文档即可。

For calling COM from python, the most common way is using the pywin32 library.对于从 python 调用 COM,最常用的方法是使用pywin32库。

There is a Python Library Python-CANoe Available to do this.有一个 Python 库 Python-CANoe 可用于执行此操作。

path to the library https://pypi.org/project/Python-CANoe/库的路径https://pypi.org/project/Python-CANoe/

You can get sample COM automation vai Python.py file in (C:\Users\Public\Documents\Vector\CANoe\Sample Configurations 15.1.1\Programming\Python) this CANoe install directory.您可以在此 CANoe 安装目录(C:\Users\Public\Documents\Vector\CANoe\Sample Configurations 15.1.1\Programming\Python)中获取示例 COM 自动化 vai Python.py 文件。

See image for config location配置位置见图片

Note: Avoid using third party library to control CANoe.注意:避免使用第三方库来控制 CANoe。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM