Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Adding Custom Operation to Operation Manager


Recommended Posts

is it possible to add a custom operation into the operation manager?

one that mimiks the looks of the mastercam operations but displays the stuff i want in the treeview.

Also, is there a way to modify the treeview contents for each operation. Could i add custom properties in there?

thanks!

Link to comment
Share on other sites
is it possible to add a custom operation into the operation manager?

Yes it is. It's called a CHook Operation that has it's own "ID"

operation->opcode = TP_CHOOK

When an operation has this opcode, you can now give Mastercam custom(exported) callback functions in your DLL to call

when the operation's tree branches are selected.

 

See the prm_chook structure in AssocTyp_ch.h ->

/// chook operation
typedef struct
{
char opmgr_txt[60];    ///< operation description to display in the operation mgr
char chook_name[40];   ///< source chook name (no prefix path).  If "" (null string), call as dll's
char opmgr_prm[20];    ///< chook's function or dll to call when op's parameters are selected in the Operation Manager
char opmgr_tool[20];   ///< chook's function or dll to call when op's tool is selected in the Operation Manager
char opmgr_geom[20];   ///< chook's function or dll to call when op's geometry is selected in the Operation Manager
char opmgr_nciL[20];   ///< chook's function or dll to call when op's nci is selected in the Operation Manager with the left mouse button
char regen_nci[20];    ///< chook's function or dll to call to regenerate op's nci section
MC_BYTE params[470];   ///< chook operations parameters
char opmgr_nciR[20];   ///< chook's function or dll to call when op's nci is selected in the Operation Manager with the right mouse button
MC_BOOL OkFilter;      ///< TRUE - operation ok to be filtered
MC_BOOL OkTpEditor;    ///< TRUE - operation ok to be toolpath edited
MC_BYTE more_params[147]; ///< even more parameters, in case 470 bytes is not enough
MC_BYTE pad[297];	///< Memory padding
} prm_chook;

Link to comment
Share on other sites
can you call .net code from a chook?

Calling from "unmanaged" code to "managed" code is possible.

 

Either via COM (yuck!) ->

http://msdn.microsoft.com/en-us/library/f07c8z1c.aspx

 

Or using C++/CLI were you can coexist C++/MFC with "managed" .NET in the same assembly.

*Note ->

.NET is this case is not "directly" C# (or VB),

but of course once you're on the .NET side of the fence, it is possible to call methods in other (C# or VB) .NET assemblies.

Though it may not be worth the hassle of doing the .NET side in C#, as you can do basically everything needed .NET in C++/CLI.

(e.g. WinForms UI)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...