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:

creating custom toolpaths


Recommended Posts

Hi,

 

I'm new to C-Hook development, although I've been programming in C++ in the CAD/CAM arena for over 15 years. Basically I'd like to make a custom operation that allows the user to chain-select some geometry, pick a tool, set some parameters, and generate a custom toolpath that shows up in the operations list. The user can then edit the parameters, regenerate, post, just like any other toolpath operation. I was able to do a poor-man's version of this before I had access to the C-Hooks SDK and mock it up quickly by exporting a DXF from mastercam, importing it into a standalone app that I wrote, and having my app create an NCI file. (There was some information on the NCI file in the Post documentation, but I couldn't find descriptions of the actual tool motion records corresponding to G0, G1, G2, G3, so I made some regular Mastercam toolpaths and reverse-engineered the format from those.) I can then Import NCI inside Mastercam, which allows for posting, toolpath editing, etc. but no regeneration or parameter editing, and so I am integrating it into Mastercam more directly now that I have access to the SDK. The examples that came with the C-Hooks SDK are useful in getting a "Hello World" app running, but are too simple to address more complicated needs like I described. The SDK Help file (the CHM) does seem to have some bare-bones documentation of functions, but more samples would be ideal.

 

Essentially, at this point, I have two questions for the community at large:

 

1) Are there good samples that I don't know about that relate to bringing up the chaining dialog and doing something with the chained geometry? Are there similar good samples that address creating a custom toolpath operation that behaves as much as possible like a Mastercam native operation? Or failing that, any sample code that's a bit more complex than the samples that come with the SDK that could steer me in the right direction?

2) The new samples for the Net-Hook API seem to be considerably more advanced, but my understanding (possibly wrong) is that the Net-Hook API may be too limited to do what I want to do. That is, it seems as though you can use the Net-Hook API to do chaining and access the database, but perhaps it does not support creating custom toolpath operations. Is this accurate? Should I be using the C-Hook SDK exclusively, or is the Net-Hook API now recommended for everything?

 

Thanks for any help you guys can provide. At this point, I'd just appreciate a shove or two in the right direction to reduce the amount of guesswork. In the meantime I'll continue searching the forum; there have already been some useful tidbits here and there.

 

Evan

Link to comment
Share on other sites

Evan,

 

From what I've been able to learn, you would need to develop your application in C++ wMFC to get all the toolpath functionality. The problem you are going to run into is in creating a "custom" toolpath. Mastercam is build to specifically hide some of the toolpath functionality on purpose. The thought behind it is that CNC Software wants to prevent a user from buying a seat of Mill level 1 and then writing Chooks to give them Level 2 or 3 functionality, thus bypassing the need to buy the more expensive version.

 

You do say that you want to Chain select some geometry, and apply a toolpath to it. Sounds like contouring to me.

 

What functionality are you looking to gain by doing your own toolpath. What do you want to do that Mastercam can't through the standard toolpaths? If you are only trying to toolpath wireframe geometry, the NetHook API may work for your application, and is much easier to implement than C++ (although I'm a total coding noob, so I might be wrong here).

 

HTH,

Link to comment
Share on other sites

Colin,

 

I'm unfortunately unable to divulge the exact details of the toolpath I'm making right now, but basically it's for a particular purpose that the standard toolpaths don't address quite as well. Sorry, I'm not trying to be cagey, it's just that we're keeping it under wraps at a corporate level at the moment. Suffice it to say that at least initially, there will be wireframe geometry as input (selected using standard Mastercam selection and chaining) and custom toolpath as output. Is it your understanding that the NetHook API supports the construction of custom operations? I didn't see anything jump out at me in the NetHook API, but I may certainly have missed it.

Link to comment
Share on other sites

From what little I know, the Nethook API should let you: Contour, Pocket, and Drill. I believe you should have the ability to pass all the different dialog box parameters to the toolpath you are creating. Your main limitation is going to be the NCI data you are creating. You will not be able to create new NCI types as they are defined internally in the MP.dll (engine that drives the posting process).

 

So, if you can manipulate the NCI data properly, you might be able to get what you are looking for. You should ask your reseller for a copy of the Version 9 Post Reference Guide. The V9 post guide will explain the format of the NCI data and how to use it in conjunction with the Post.

 

You asked earlier about how the G0, G1, G2, G3 data is passed in the NCI. The NCI code is parsed in a two line set. The first line is "G-code" line. The second line is parameter line that furnishes the additional parameters. This is an example of a G1 line:

code:

 

1 Gcode line: 1 specifies a linear move.

41 1.2856 -2.76 -0.125 1.2 Move line: Defines the compensation, coordinates of the move and feed rate

(cc, x, y, z, fr).


The V9 Post guide lists all the NCI G-code types and their respective parameters. As long as your program outputs an NCI in the Proper format, your code should post in Mastercam ok.

 

I'm not sure if you are going to be able to add a new operation type to the operation's manager though... headscratch.gif

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