2024-11-07 12:13:19 +08:00
|
|
|
|
using EPLAN.Harness.API;
|
|
|
|
|
using EPLAN.Harness.API.Plugins.Core;
|
2024-11-19 12:11:29 +08:00
|
|
|
|
using EPLAN.Harness.AppCore;
|
2025-03-28 16:47:05 +08:00
|
|
|
|
using Sinvo.EplanHpD.Plugin.DynaClient;
|
2024-12-23 11:55:20 +08:00
|
|
|
|
using Sinvo.EplanHpD.Plugin.Service;
|
2024-11-07 12:13:19 +08:00
|
|
|
|
using Sinvo.EplanHpD.Plugin.WPFUI;
|
2024-12-10 17:02:58 +08:00
|
|
|
|
using Sinvo.EplanHpD.Plugin.WPFUI.Extension;
|
2024-11-15 15:02:16 +08:00
|
|
|
|
using Sinvo.EplanHpD.Plugin.WPFUI.Utils;
|
2024-11-07 12:13:19 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
2024-12-23 11:55:20 +08:00
|
|
|
|
using System.Runtime.Remoting;
|
2024-11-14 19:22:25 +08:00
|
|
|
|
using System.Windows.Forms.Integration;
|
2024-11-07 12:13:19 +08:00
|
|
|
|
|
|
|
|
|
namespace Sinvo.EplanHpD.Plugin
|
|
|
|
|
{
|
2025-02-10 16:14:25 +08:00
|
|
|
|
#if Release_WireAndCable || DEBUG
|
2024-11-13 13:39:06 +08:00
|
|
|
|
public class DesignPluginEntry : EPLAN.Harness.API.Plugins.IHpDPlugin
|
2024-11-15 15:02:16 +08:00
|
|
|
|
#else
|
2025-02-10 11:38:43 +08:00
|
|
|
|
public class DesignPluginEntry
|
2024-11-15 15:02:16 +08:00
|
|
|
|
#endif
|
2024-11-07 12:13:19 +08:00
|
|
|
|
{
|
|
|
|
|
public string Name => "兴禾ProD插件-3D";
|
|
|
|
|
|
|
|
|
|
public string Author => "Sinvo";
|
|
|
|
|
|
2024-11-14 19:22:25 +08:00
|
|
|
|
public string Description => "兴禾EPLAN Harness proD 2.9 Studio插件,提供伺服电机线缆抓取功能";
|
2024-11-07 12:13:19 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取DLL版本
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Version Version => Assembly.GetAssembly(this.GetType()).GetName().Version;
|
|
|
|
|
|
|
|
|
|
public System.Drawing.Image ToolbarIcon
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
var imageBytes = Resource.Sinvo;
|
|
|
|
|
if (imageBytes != null)
|
|
|
|
|
{
|
|
|
|
|
using (var ms = new MemoryStream(imageBytes))
|
|
|
|
|
{
|
|
|
|
|
return Image.FromStream(ms);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-14 19:22:25 +08:00
|
|
|
|
public string ToolbarText => "伺服电机线缆抓取";
|
2024-11-07 12:13:19 +08:00
|
|
|
|
|
|
|
|
|
public HpDModule Module => HpDModule.WorkSpace;
|
|
|
|
|
|
2024-11-26 10:34:31 +08:00
|
|
|
|
public string ToolbarTooltip => "伺服电机线缆抓取";
|
|
|
|
|
|
2024-12-23 11:55:20 +08:00
|
|
|
|
LectotypeWindow window;
|
|
|
|
|
|
2024-11-07 12:13:19 +08:00
|
|
|
|
public void Execute(HpdApi api)
|
|
|
|
|
{
|
2024-12-23 11:55:20 +08:00
|
|
|
|
new DBHelper().CodeFirst();
|
|
|
|
|
|
2024-11-07 12:13:19 +08:00
|
|
|
|
var doc = api.CurrentProject.GetActiveDocument();
|
2024-12-23 11:55:20 +08:00
|
|
|
|
if(window == null)
|
|
|
|
|
{
|
|
|
|
|
window = new LectotypeWindow(doc.ID);
|
2025-02-21 09:53:36 +08:00
|
|
|
|
// 获取版本号并显示到窗口标题
|
|
|
|
|
window.Title += $" V{Version} - {doc.Name}";
|
2024-12-23 11:55:20 +08:00
|
|
|
|
ElementHost.EnableModelessKeyboardInterop(window);
|
|
|
|
|
var mainApp = BaseApp.ActiveApplication;
|
|
|
|
|
var helper = new System.Windows.Interop.WindowInteropHelper(window);
|
|
|
|
|
helper.Owner = mainApp.Handle;
|
|
|
|
|
window.Closed += delegate
|
|
|
|
|
{
|
|
|
|
|
window = null;
|
|
|
|
|
};
|
|
|
|
|
window.Show();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
window.WindowState = System.Windows.WindowState.Normal;
|
|
|
|
|
window.Activate();
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-07 12:13:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Initialize()
|
|
|
|
|
{
|
2025-03-28 16:47:05 +08:00
|
|
|
|
if (!AppDomainDllLoader.isLoaded)
|
|
|
|
|
{
|
|
|
|
|
AppDomainDllLoader.SetLaoder();
|
|
|
|
|
ApplicationExt.InitApplication();
|
|
|
|
|
Consts.InitConfigs();
|
|
|
|
|
#if DEBUG
|
|
|
|
|
var client = new DynaServerClient();
|
2025-04-07 09:36:44 +08:00
|
|
|
|
// PLM 没有EPLAN的许可,所以只能使用SOLW的类型登录
|
|
|
|
|
client.Login("105040", "blank", "ADMINISTRATOR", "ADMINISTRATOR", "SOLW");
|
2025-03-28 16:47:05 +08:00
|
|
|
|
#endif
|
|
|
|
|
}
|
2024-11-07 12:13:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Terminate()
|
|
|
|
|
{
|
2024-11-13 13:39:06 +08:00
|
|
|
|
|
2024-11-07 12:13:19 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|