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:

Recommended Posts

Hello,

I'm programming in C# and have some specific questions:

 

1. Is it possible to use GUI.AskForPoint function during showing a modal dialog box (Window.ShowDialog)?

1. How do I select a Machine definition?

2. How do I create a new Toolpath Group?

3. How do I delete all the operations?

4. How do I draw a Chamfer?

5. Where do I get images for the Mastercam standard OK and Cancel buttons ("m_okay_bmp" and "m_cancel_bmp")?

6. How do I define version function "m_version"?

 

Thank you!

Link to comment
Share on other sites

Nobody wants to help me frown.gif

 

OK, I upgraded to MR2 now and this way I have solved some of my problems. smile.gif

 

ad. 1 (the second one): I managed to select a lathe machine, but not if Mastercam is in Design mode (no machine selected).

 

ad 6: I defined the following method to my base class:

code:

public override int Version (int mc_version)

{

return (mc_version);

}

and it works. But if I add my C-hook to Settings -> Configuration -> Start/Exit -> Add-In programs -> StartUp, Mastercam complains that "Version function m_version is not found in my DLL".

 

Please, give some comments, if you can. And have a pleasant day.

Link to comment
Share on other sites

Jure,

 

I may be able to help on the easy questions.

 

1. Is it possible to use GUI.AskForPoint function during showing a modal dialog box (Window.ShowDialog)?

 

I’d guess the answer to that would be NO. Since you have a modal dialog active and a modal dialog does not allow anything ‘off’ that dialog to occur while it is active.

 

5. Where do I get images for the Mastercam standard OK and Cancel buttons ("m_okay_bmp" and "m_cancel_bmp")?

 

They are embedded in the Resource DLL(s) which are installed in the Resources folder. Since these bitmaps are used everywhere I made the assumption that they might be in the MCCoreRes.DLL. Using Resource Tuner I scanned thru the BMPs in that DLL and found 7146 to be the OK (green check) image and 741 the CANCEL (red ‘X’) image.

 

6. How do I define version function "m_version"?

 

C-Hooks have a "m_version" function (which is required).

NetHooks can use "Version" (which is optional) –>

 

public override int Version (int mc_version)

{

return (int) MC_DEFINES.C_H_VERSION;

}

Link to comment
Share on other sites

Thank you very very much for your help! However, there are my answers that are actually new questions wink.gif

 

ad. 1: How can I then make a dialog window that includes a button to AskForPoint and then return to the dialog?

 

ad. 5: I proceeded this way: I converted both images in the DLL to two separate BMP files and included them into my dialog window. But they don't look just as they should: MC_OkCancel.jpg.

 

Ad. 6: There's no problem with the version functions unless one includes them in the StartUp or Exit Add-In programs (see my previous post).

 

Only yesterday I discovered the new Developer's Guides.pdf and samples, which I found very nice and useful. The only thing I still miss is some examples on working with operations.

 

Have a nice day. cool.gif

Link to comment
Share on other sites

Jure,

 

ad.1: You might be able to roll your own, I dont have X here so I cant take a look at the object model, I'll take a look when I get back tomorrow.

 

ad.5: You will need to set the mask properties to the grey background of the images so that the background appears transparent.

 

ad.6: Personally I never included the version function in my NETHooks.

 

As time permits I will make some updated sample projects available for our end users.

Link to comment
Share on other sites

Jure,

 

I apologize for not reading your original statement ->

 

quote:

But if I add my C-hook to Settings -> Configuration -> Start/Exit -> Add-In programs -> StartUp, Mastercam complains that "Version function m_version is not found in my DLL".

If you set your NETHook as the startup add-in (in Configuration) you get that error ->

Version function m_version is not found in my DLL

Which is an error!

A NETHook does not have (or need) an "m_version" function, so you should not get that message from the system.

 

I've logged this issue.

Link to comment
Share on other sites

Jure,

 

quote:

"ad. 5: I'm not sure if I understand you right. I have done this: I modified the two BMPs, so that their background color now matches the color of my buttons. The buttons look nice, but I don't think that's the "correct" solution."


You will need to set the mask of the image list that contains your bitmap images to the background of those images, the background colour can be anything, once you set the mask to that colour it will become transparent when displayed.

Link to comment
Share on other sites

Thanks Jure. It looks like I don't have the SDK. I checked the version X MR2 disks and don't see it on there, so I'll probably need to ask my distributor. Up to now I haven't needed the SDK since I am just doing nethook stuff, but I'd sure like a look at the documentation you mentioned. I'll check with my distributor. Thanks again,

David

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