Addin 插件入门
https://blog.csdn.net/zhshspark/article/details/116831152
我是看这篇文章做的.
脚本只能做一小部分操作 , 所以花了很多时间入门 , 学习编程 , 还是需要耐心和细心 …
做了插件入口 , 才能更好的去实现自己的功能 .
AddIn代码
最好是写完AddIn代码 , 就直接注册进去 , 防止做的功能多了 , 出现问题 ,
上面注释的代码是帮助给的示例代码 , 我用不同的电脑注册文件会有莫名其妙的问题 , 后来在别的电脑上用未注释的代码做的 , 如果有问题 , 可以研究一下 .
using Eplan.EplApi.ApplicationFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EplAPITest.Forms;
using Eplan.EplApi.Gui;
namespace EplAPITest
{
public class TestAddin : IEplAddIn
{
public bool OnExit()
{
return true;
}
public bool OnInit()
{
return true;
}
public bool OnInitGui()
{
return true;
}
public bool OnRegister(ref bool bLoadOnStart)
{
//var ribbonBar = new Eplan.EplApi.Gui.RibbonBar();
//ribbonBar.AddCommand("CSharpAction", "CSharpAction");
var newTab = new Eplan.EplApi.Gui.RibbonBar().AddTab("APITest");
var commandGroup = newTab.AddCommandGroup("APItest1");
var command = commandGroup.AddCommand("CSharpAction", "XPartsManagementStart");
return true;
}
public bool OnUnregister()
{
var ribbonBar = new Eplan.EplApi.Gui.RibbonBar();
return ribbonBar.RemoveCommand("CSharpAction");
}
}
}
AcitonTest.cs代码
操作实现代码 , 显示一个窗口 , 窗口做一些功能
using Eplan.EplApi.ApplicationFramework;
using Eplan.EplApi.Base;
using Eplan.EplApi.DataModel;
using Eplan.EplApi.Gui;
using EplAPITest.Base;
using EplAPITest.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.Control;
namespace EplAPITest
{
class ActionTest : IEplAction,IActionCallingContext
{
public bool Execute(ActionCallingContext oActionCallingContext)
{
FstForm fstForm = new FstForm();
fstForm.TopMost = true;
fstForm.Show();
return true;
}
public void GetActionProperties(ref ActionProperties actionProperties)
{
}
public bool OnRegister(ref string Name, ref int Ordinal)
{
Name = "CSharpAction";
Ordinal = 20;
return true;
}
}
}
不免费 ! 目前实现了 , 页面管理 , 部件管理 , 自动命名功能(可以给设备,中断点,命名定义点,单层端子,双层端子,命名。功能还在测试中)需要的可以私信我 .
淘宝链接只有页面管理功能,其他需求请私聊!
淘宝链接,需求功能和价格请私聊,上架产品仅有页面管理功能