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:

Are C-hooks written in C or C++?


Jake L
 Share

Recommended Posts

I have what I hope will be quick question. I'm looking into starting to program chooks for a variety of reasons, and I can't seem to find a solid answer to this question. My fear is I'm going to dive into learning C or C++ then realize I need the opposite language. Any help or advice is much appreciated. If more information is needed please let me know.

Not sure if it matters but I'm running Mastercam 2022.

Link to comment
Share on other sites

Mastercam has several types of add-ins.

  • C-Hook style -> Done in C++ (or C++/CLI) 
  • NET-Hook style -> Done with C# or VB.NET
  • C# Scripts -> Obviously done in C# (New in Mastercam 2022)

The non C-Hook types do not provide as much functionality as a C-Hook type solution.
Which to use?
First determine what functionality you need to accomplish what you want your add-in to do.
Does this require a C-Hook? If so, there is your answer.
If it does not? If you know C++, doing C# for a .NET type add-in is not that difficult.

If I can do want I need with a NET-Hook style add-in, that is my first choice.
This from someone that spends the majority of their time programming C++.

Edited by Roger Martin from CNC Software
  • Like 2
Link to comment
Share on other sites

Roger, thank you for that explanation. I think my problem is that I don't understand the functions of a c-hook. And if I don't understand what they can do, then I don't understand where I may be able to implement them. I just want to start scratching the surface of chooks to see if / when I could implement them. Also, as far as I am aware, if I learn C then I at least have a decent base for C++ and C#, please correct me if that is wrong.

Anyway, thanks again!

Link to comment
Share on other sites

Step #1 -> 
First determine what functionality you need to accomplish. What exactly you want your add-in to do. List out all these “steps” it needs accomplish the desire end result.
This step is skipped or rushed past all too often!  

"I want my add-in to automate creating toolpaths."
Great! – You have the end goal. 
What individual steps are needed to get there? These are the important details.

With that detailed information, now we can then determine which style of add-in you can use to do that.
A C-Hook with C++ is always in the mix of “I can do it with this type of add-in”.
But, if you can do want you need with the NET-Hook (C#) style add-in, that may be an easier route to take.

Quote

 if I learn C then I at least have a decent base for C++ and C#, please correct me if that is wrong.

If starting out learning C++ (and maybe C#), I would just start with C++. 
If you know C or C++, going then to C# is fairly easy.


 

  • Like 1
Link to comment
Share on other sites

Is automatic toolpath creation possible? Again, I don't have a specific function in mind, I'm just trying to learn about everything Mastercam has to offer. C-hooks seem incredibly powerful but I didn't know if they were that powerful.

As far as which programming language to start with. I have only a basic understanding of computer programming (most of my knowledge came from AP Computer Science in Highschool). In your opinion, is it a better idea for me to start with C or C++? In the research I've done it seems like C++ is much more user friendly, but C is more of the bare bones than C++. Again, please correct me if I'm wrong.

Link to comment
Share on other sites
  • 1 year later...
On 3/28/2022 at 7:09 AM, Simon Kausch said:

Is there any documentation about C# Scripting? How do I get startet with this?

On the official Mastercam website under "Communities" there's a "3rd Party Developers" section. This is a good place to start looking around for information.

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...