-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demonstrate how to launch command using context menu for a specific entity type
- Loading branch information
Showing
7 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,3 +152,4 @@ $RECYCLE.BIN/ | |
|
||
# Mac desktop service store files | ||
.DS_Store | ||
/Lazcad.Opc.bundle/Contents/Resources/lazcadopc.mnr |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,19 @@ | |
<ApplicationPackage SchemaVersion="1.0" | ||
ProductType="Application" | ||
Name="Lazcad.Opc" | ||
AppVersion="0.3" | ||
AppVersion="0.4" | ||
Description="Lazcad Opc" | ||
Author="Lazcad" | ||
Icon="./Contents/Resources/lazcadopc.bmp" > | ||
<CompanyDetails Name="Lazcad" Url="http://www.lazcad.com" Email="[email protected]" /> | ||
<Components> | ||
<RuntimeRequirements OS="Win32|Win64" Platform="PNID|PLANT3D" SeriesMin="R19.1" SeriesMax="R19.1"/> | ||
<ComponentEntry AppName="Lazcad.Opc" ModuleName="./Contents/2014/lazcad.opc.dll" AppDescription="Lazcad Opc" LoadOnAutoCADStartup="false" LoadOnCommandInvocation="True"> | ||
<ComponentEntry AppName="Lazcad.Opc" ModuleName="./Contents/2014/lazcad.opc.dll" AppDescription="Lazcad Opc" LoadOnAutoCADStartup="true" LoadOnCommandInvocation="false"> | ||
<Commands GroupName="LAZ_OPC"> | ||
<Command Local="opcselect" Global="opcselect" /> | ||
<Command Local="opcclear" Global="opcclear" /> | ||
</Commands> | ||
</ComponentEntry> | ||
<ComponentEntry AppName="Lazcad.Opc" Version="0.3" ModuleName="./Contents/Resources/lazcadopc.cuix" AppDescription="Alternative OPC Connector" /> | ||
<ComponentEntry AppName="Lazcad.Opc" Version="0.4" ModuleName="./Contents/Resources/lazcadopc.cuix" AppDescription="Alternative OPC Connector" /> | ||
</Components> | ||
</ApplicationPackage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |