愿与您一同,用代码提升效率!

日常报告截图前,一般都会调整曲线颜色,线形,粗细,曲线数量较多时候,每个曲线都点击调整一次浪费大量时间,使用二次开发脚本1秒搞定。
此篇是学会怎样在hyperview中使用二次开发功能自动调整曲线颜色,线形和粗细。
def modify_curve_attribute(curve_name,lineStyle,lineThickness):# 模块导入 import hw import hw.hg as hg#========================# 依据RGB值 创建color #======================== color = hw.Color(rgb=(250,0,0))#========================# ses = hw.Session() win = ses.get(hw.Window) curve = ses.get(hg.CurveXY,id=1)# 设置曲线名 curve.label = curve_name# 设置曲线颜色 curve.lineColor = color# 设置线型 和宽度(可软件中参看具体数字代表什么类型) curve.lineStyle = lineStyle curve.lineThickness = lineThickness win.draw() win.update()modify_curve_attribute("internal_energy",2,3)💡提示
如有问题,欢迎留言指正与交流。 本文已收录进合集,进入文末合集可查看更多笔记。