当前位置: 首页 > news >正文

【Python工具开发】k3q_arxml 简单但是非常好用的arxml编辑器,可以称为arxml杀手包

k3q_arxml

介绍

仓库地址1
仓库地址2

极简的arxml编辑库,纯python实现

用法

from pprint import pp # 可以美化打印对象,不然全打印在一行
import k3q_arxml
# 加载arxml文件
io_arxml = k3q_arxml.IOArxml(filepaths=['test/model_merge.arxml'])# 打印arxml字符串绑定的python arxml实例
io_arxml.print(print_filepath='model_merge.txt')# 刷新ref缓存数据,因为ref/ar/ref_to_ref/locate_filename访问的都是缓存数据,如果修改了数据后,影响到了ref,就需要主动刷新
io_arxml.scan_ref()# 增/改
io_arxml.ref(('Implementations', 'HWIO')).resource_consumption = k3q_arxml.autosar.ResourceConsumption(short_name=k3q_arxml.autosar.Identifier(value='resourceConsumption'))# 删
del io_arxml.ref(('Implementations', 'HWIO')).resource_consumption
io_arxml.ref(('Implementations', 'HWIO')).resource_consumption = None# 查
## 根据ref查arxml实例
io_arxml.ref(('Implementations', 'HWIO'))
## 根据ref查哪些arxml实例用到了该ref
io_arxml.ref_to_ref(('Implementations', 'HWIO'))
## 根据标签查arxml实例(该需要带有short_name属性)
io_arxml.ar(clazz=k3q_arxml.autosar.ResourceConsumption)
## 根据标签查arxml实例,但限定ref路径下查找(该需要带有short_name属性)
io_arxml.ar(clazz=k3q_arxml.autosar.ResourceConsumption, ref_prefix=('Implementations',))# 辅助函数
## 控制台打印uuid到ref的映射关系,能通过uuid快速定位ref路径,辅助编码
io_arxml.scan_ref(debug_uuid=True)
## 获取路径在那个arxml文件里
io_arxml.locate_filename(ref=('Implementations',))# 切换autosar_00052版本,默认为autosar_00048
from autosar import autosar_00052
k3q_arxml.autosar = autosar_00052# 回写到文件
io_arxml.flush_to_file()

技巧

  1. 手动添加完成后的arxml和原始arxml,都通过io_arxml.print函数打印在文件里
  2. 通过对比软件对比源arxml和打印的arxml,找出需要修改的arxml内容
  3. 该内容就是对象的定义代码,可以复制出来粘贴到代码里
http://www.lqws.cn/news/171487.html

相关文章:

  • Java + Spring Boot + Mybatis 实现批量插入
  • window安装docker
  • C#使用MindFusion.Diagramming框架绘制流程图(1):基础类型
  • Chrome安装代理插件ZeroOmega(保姆级别)
  • 如何理解机器人课程的技术壁垒~壁垒和赚钱是两件不同的事情
  • Chrome书签的导出与导入:步骤图
  • 浏览器工作原理01 [#]Chrome架构:仅仅打开了1个页面,为什么有4个进程
  • Chrome 浏览器前端与客户端双向通信实战
  • Flink在B站的大规模云原生实践
  • 学习STC51单片机29(芯片为STC89C52RCRC)
  • 【python深度学习】Day 46 通道注意力(SE注意力)
  • Verilog编程技巧01——如何编写三段式状态机
  • caliper中的测试文件写法及其注意事项
  • 【Java后端基础 005】ThreadLocal-线程数据共享和安全
  • 江科大读写内部flash到hal库实现
  • 【Go语言基础【5】】Go module概述:项目与依赖管理
  • Tesseract配置参数详解及适用场景(PyTesseract进行OCR)
  • Spring Boot消息系统开发指南
  • 语音合成之十九 为什么对数行列式的值可以作为Flow-based模型loss?
  • 三种读写传统xls格式文件开源库libxls、xlslib、BasicExcel的比较
  • leetcode 2434. 使用机器人打印字典序最小的字符串 中等
  • 自动化提示生成框架(AutoPrompt)
  • 零知开源——STM32F103RBT6驱动 ICM20948 九轴传感器及 vofa + 上位机可视化教程
  • Vue:Form正则校验
  • React - 组件通信
  • 【React】React 18 并发特性
  • 视频的分片上传,断点上传
  • Visual Studio问题记录
  • React---day10
  • 跨平台游戏引擎 Axmol-2.6.1 发布