diff --git a/.gitignore b/.gitignore
index 31a08b7..cc5a784 100644
--- a/.gitignore
+++ b/.gitignore
@@ -152,3 +152,4 @@ $RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
+/Lazcad.Opc.bundle/Contents/Resources/lazcadopc.mnr
diff --git a/Lazcad.Opc.bundle/Contents/2014/Lazcad.Opc.dll b/Lazcad.Opc.bundle/Contents/2014/Lazcad.Opc.dll
index 4cc3f22..38bbf95 100644
Binary files a/Lazcad.Opc.bundle/Contents/2014/Lazcad.Opc.dll and b/Lazcad.Opc.bundle/Contents/2014/Lazcad.Opc.dll differ
diff --git a/Lazcad.Opc.bundle/PackageContents.xml b/Lazcad.Opc.bundle/PackageContents.xml
index 3ec1a0d..31a52b1 100644
--- a/Lazcad.Opc.bundle/PackageContents.xml
+++ b/Lazcad.Opc.bundle/PackageContents.xml
@@ -2,19 +2,19 @@
-
+
-
+
\ No newline at end of file
diff --git a/Lazcad.Opc/Commands.cs b/Lazcad.Opc/Commands.cs
index 383fa6a..8a33fdf 100644
--- a/Lazcad.Opc/Commands.cs
+++ b/Lazcad.Opc/Commands.cs
@@ -2,6 +2,7 @@
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
+using Autodesk.ProcessPower.PlantInstance;
using Autodesk.ProcessPower.PnIDObjects;
namespace Lazcad.Opc
@@ -16,7 +17,7 @@ public static void OpcSelectCommand()
var doc = Application.DocumentManager.MdiActiveDocument;
var db = doc.Database;
var ed = doc.Editor;
-
+
ObjectId opcId;
var sel = ed.SelectImplied();
diff --git a/Lazcad.Opc/Extensions.cs b/Lazcad.Opc/Extensions.cs
new file mode 100644
index 0000000..21538fe
--- /dev/null
+++ b/Lazcad.Opc/Extensions.cs
@@ -0,0 +1,38 @@
+using Autodesk.AutoCAD.ApplicationServices;
+using Autodesk.AutoCAD.DatabaseServices;
+using Autodesk.AutoCAD.Runtime;
+using Autodesk.ProcessPower.PlantInstance;
+using Autodesk.ProcessPower.PnIDObjects;
+using System;
+
+namespace Lazcad.Opc
+{
+ public class Extensions : IExtensionApplication
+ {
+ private OpcContextMenu _menu = new OpcContextMenu();
+
+ public void Initialize()
+ {
+ PlantApplication.CurrentProjectOpenedEvent += PlantApplication_CurrentProjectOpenedEvent;
+ }
+
+ void PlantApplication_CurrentProjectOpenedEvent()
+ {
+ //Disable once loaded first time
+ PlantApplication.CurrentProjectOpenedEvent -= PlantApplication_CurrentProjectOpenedEvent;
+
+ AddContext(typeof(DynamicOffPage));
+ AddContext(typeof(OffPage));
+ }
+
+ public void AddContext(Type type)
+ {
+ RXClass rxc = Entity.GetClass(type);
+ Application.AddObjectContextMenuExtension(rxc, new OpcContextMenu());
+ }
+
+ public void Terminate()
+ {
+ }
+ }
+}
diff --git a/Lazcad.Opc/Lazcad.Opc.csproj b/Lazcad.Opc/Lazcad.Opc.csproj
index ed70bb7..42f1d0e 100644
--- a/Lazcad.Opc/Lazcad.Opc.csproj
+++ b/Lazcad.Opc/Lazcad.Opc.csproj
@@ -16,7 +16,7 @@
true
full
false
- bin\Debug\
+ ..\..\..\..\..\..\..\ProgramData\Autodesk\ApplicationPlugins\Lazcad.Opc.bundle\Contents\2014\
DEBUG;TRACE
prompt
4
@@ -66,7 +66,9 @@
+
+
diff --git a/Lazcad.Opc/OpcContextMenu.cs b/Lazcad.Opc/OpcContextMenu.cs
new file mode 100644
index 0000000..65ffbad
--- /dev/null
+++ b/Lazcad.Opc/OpcContextMenu.cs
@@ -0,0 +1,27 @@
+using Autodesk.AutoCAD.ApplicationServices.Core;
+using Autodesk.AutoCAD.Windows;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Lazcad.Opc
+{
+ public class OpcContextMenu : ContextMenuExtension
+ {
+ public OpcContextMenu()
+ {
+ Title = "Lazcad OPC";
+
+ var connectMenu = new MenuItem("Opc Connect (Lazcad)");
+ connectMenu.Click += connectMenu_Click;
+
+ MenuItems.Add(connectMenu);
+ }
+
+ void connectMenu_Click(object sender, EventArgs e)
+ {
+ Application.DocumentManager.MdiActiveDocument.SendStringToExecute("opcselect ", true, false, true);
+ }
+ }
+}