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:

C-Hook tutorials or sample code?


Recommended Posts

After spending several days trying to work some things out, I've concluded that I'm probably doing something wrong (Mastercam crashing on shutdown was a BIIIG clue) and it might be a good idea to ask for help. :)

 

To that end... are there any C-Hook tutorials or sample code available anywhere? I'm working in X4, and the SDK for X4 only appears to have interface documentation--and while that's both necessary and useful, it's unfortunately not enough.

  • Like 1
Link to comment
Share on other sites

What are you trying to have your CHook do?

 

Sorry about the delay in responding; I got caught up in some other things I've been working on.

 

Anyway, two things, primarily:

  1. My supervisor is working on a post processor... and has unfortunately run out of Misc. Ints. Since it appears the Misc. Values are implemented as a pair of static arrays in X4, it's not possible to easily add more. However, because the Misc. Values can be replaced by a C-Hook (according to the Mastercam documentation), I've been asked to investigate what it would take to do this.
  2. We sometimes get PDFs with part information from our customers. I've been asked to come up with a C-Hook to automatically call up the file. Writing the code to call up the file is easy. What's been stopping me on this persisting the filename. I'd prefer to persist it in the part's .mcx file, but my attempts have all failed miserably.

 

I'm also trying generally to figure out how to do nontrivial things with C-Hooks, but there simply aren't all that many examples out there, and the C-Hook API documentation, while useful and necessary in its own way, isn't useful for that.

Link to comment
Share on other sites

1> It is easy to replace the Misc. Ints.Reals page with your own CHook, by a setting in the Control Definition (Files branch – File usage – CHook from Misc. values button)

But... I do not see how that is going to help in “adding” more Misc. Integers.

Have you also run out of Misc. Reals values? If not - just use 'em as Integers,

 

2>“What's been stopping me on this persisting the filename. I'd prefer to persist it in the part's .mcx file, but my attempts have all failed miserably.”

*More information please. “Call up the file?”

Link to comment
Share on other sites

1> It is easy to replace the Misc. Ints.Reals page with your own CHook, by a setting in the Control Definition (Files branch – File usage – CHook from Misc. values button)

But... I do not see how that is going to help in “adding” more Misc. Integers.

Have you also run out of Misc. Reals values? If not - just use 'em as Integers,

#1 from my last post was a bit ambiguous, so I'll clarify: I've been asked to investigate what it would take to write a CHook that can be used to replace the Misc. Values.

 

2>“What's been stopping me on this persisting the filename. I'd prefer to persist it in the part's .mcx file, but my attempts have all failed miserably.”

*More information please. “Call up the file?”

(1) Is it possible to store external information--e.g. the path to an external file, like a PDF--in the Mastercam file?

(2) If so, how is this done?

Link to comment
Share on other sites

#1>

Simple to create a CHook that is launched instead of the Misc. Values dialog when you select the Misc Values in the Operation’s parameters.

But… this is not going to get you more Misc Integer values, even if you went thru that pain of figuring out how to “inject” the values from your CHooks’ dialog into the Mastercam Operation.

There are room for 10 Integers and 10 (floating point) Reals in an Operation and that’s it.

 

#2> There really isn’t. What some 3rd party Add-Ons do to save their information in an MCX file is to store that info in Drafting Note/Text, that is stored away on a level# that it knows.

Link to comment
Share on other sites

#1>

Simple to create a CHook that is launched instead of the Misc. Values dialog when you select the Misc Values in the Operation’s parameters.

But… this is not going to get you more Misc Integer values, even if you went thru that pain of figuring out how to “inject” the values from your CHooks’ dialog into the Mastercam Operation.

There are room for 10 Integers and 10 (floating point) Reals in an Operation and that’s it.

 

All right, fair enough.

 

#2> There really isn’t. What some 3rd party Add-Ons do to save their information in an MCX file is to store that info in Drafting Note/Text, that is stored away on a level# that it knows.

 

That was actually surprisingly easy to figure out--thanks for the suggestion. :)

 

--M.

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