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:

Requesting SDK and info on chooks, VB


Recommended Posts

Hi,

 

I am an X5 user and I'm looking to update my older VB scripts from V9 to work with my X5 installation. I have a few questions:

 

I'm not that experienced with the .NET languages like C# but I've written a few dozen C++ stand-alone utilities and quite a few VB scripts to operate on Mastercam  NCI files. I'm looking to migrate my former free-standing C++ programs to operate inside Mastercam. There would be fairly substantial database operations involved so which of the 2 languages (C++ or VB) would you recommend for me moving forward? 

Also I would be favoring whichever language is more likely to be supported in the future.

 

You used to offer the chooks years ago...is that still actively updated and anticipated to carry into the future?

 

Incidentally, my X5 installation doesn't seem to have the VB .dll nor any of the sample scripts in VB...is that unusual? What would I need to do to get that setup properly?

 

I believe I have .net 3.5 installed on this box but not sure.

Also I have Visual studio 2010 Express C++ that I've used for compiling my stand-alone utilities.

 

I will be looking to download samples in VB and C++ eventually to re-familiarize myself...so what else would I need to get going?

 

Thanks,

Jim

Link to comment
Share on other sites

Hi,

 

I am an X5 user and I'm looking to update my older VB scripts from V9 to work with my X5 installation. I have a few questions:

 

I'm not that experienced with the .NET languages like C# but I've written a few dozen C++ stand-alone utilities and quite a few VB scripts to operate on Mastercam  NCI files. I'm looking to migrate my former free-standing C++ programs to operate inside Mastercam. There would be fairly substantial database operations involved so which of the 2 languages (C++ or VB) would you recommend for me moving forward? 

Also I would be favoring whichever language is more likely to be supported in the future.

 

You used to offer the chooks years ago...is that still actively updated and anticipated to carry into the future?

 

Incidentally, my X5 installation doesn't seem to have the VB .dll nor any of the sample scripts in VB...is that unusual? What would I need to do to get that setup properly?

 

I believe I have .net 3.5 installed on this box but not sure.

Also I have Visual studio 2010 Express C++ that I've used for compiling my stand-alone utilities.

 

I will be looking to download samples in VB and C++ eventually to re-familiarize myself...so what else would I need to get going?

 

Thanks,

Jim

 

Jim,

 

You have a couple of options, you could migrate your VBScripts to NET-Hooks which uses our .NET API, you can write those in Visual Basic .NET or C#. 

 

We just added an Introduction to VB.NET and C# NET-Hook programming on our website under the 3rd Party Developers NET-Hook Downloads page. The document does mention using our current API via a Nethook3_0.dll but you wont have that in X5 you would make a project reference to the Nethook2_0.dll library pretty much everything else in the document should apply.

 

You can use the free Visual Studio 2013 Community Edition, which is essentially a professional level, to develop your NET-Hooks and it is far superior to the Express Edition you are currently using.

 

The C-Hook SDK is maintained and updated for each new release as is our .NET API, however, the requirements for C-Hook development are not as flexible as with NET-Hooks. You can not use the Express edition of Visual Studio to develop C-Hooks as it does not have the required MFC support. Note that you can only use the 

Visual Studio 2013 Community Edition if you are developing C-Hooks for Mastercam X9 or 2017 so you would need to get an older copy of Visual Studio but I don't know the exact version off the top of my head but I can find out. You would also need to install the Mastercam X5 SDK and you would need to contact your reseller to get access to that, at least for the time being.

 

I am not sure why there are no example VBScripts I am quite sure we were installing examples, in future releases of Mastercam we will no longer be installing VBScript examples.

Link to comment
Share on other sites

Hi Mick,

 

And thanks for the tips. I decided to go the C# route as it seems to be the right choice for managed database ops and it's pretty similar to C++. So I did download the Visual Studio Community 2013 and it's awesome. I have already ported my database stuff to SQL and it miraculously worked the first time through. I know you said I would need an older version to match up with the X5 version I'm running right now, but I see there's a compiler directive to port the code out to earlier versions of .NET (3.0, 3.5, etc.) if necessary. Has anyone out there had any success compiling DLLs for an older Mastercam version. Would the SDK I need also have to be older to match? Also I wanted to retrieve the info on the CHooks you offered in the more recent post but I'm getting an access denied on the page, even though I'm good for everywhere else. Or do I need to be on current maintenance to get that stuff?

 

Thanks, Jim

Link to comment
Share on other sites

Hi Mick,

 

And thanks for the tips. I decided to go the C# route as it seems to be the right choice for managed database ops and it's pretty similar to C++. So I did download the Visual Studio Community 2013 and it's awesome. I have already ported my database stuff to SQL and it miraculously worked the first time through. I know you said I would need an older version to match up with the X5 version I'm running right now, but I see there's a compiler directive to port the code out to earlier versions of .NET (3.0, 3.5, etc.) if necessary. Has anyone out there had any success compiling DLLs for an older Mastercam version. Would the SDK I need also have to be older to match? Also I wanted to retrieve the info on the CHooks you offered in the more recent post but I'm getting an access denied on the page, even though I'm good for everywhere else. Or do I need to be on current maintenance to get that stuff?

 

Thanks, Jim

 

Jim,

 

The compiler tool set conversioning restrictions only apply to developing C-Hooks not NET-Hooks so as you mentioned you can use a lower .NET framework version for the NETHook2_0 reference and you should be good to go.

 

For C-Hooks I have uploaded the document but the maintenance restriction on that link might still be in effect so I'll talk to the web guy tomorrow get that sorted as you only need to be a Mastercam user with a valid log-in the same as the NET-Hook link. The document will explain what you need in terms of a compiler and tool set for Mastercam X8 and X9 but I it slipped my mind to ask about X5, I'll check tomorrow and get back to you.

Link to comment
Share on other sites

Hi Mick,

Still getting "access denied" after successfully logging in to Mastercam dot com while using the link for the CHook documentation.

Hope to download any info/tools on the SDK's, etc. that are available, to get started.

 

I can email you my Hasp key# if that would be helpful. We've been with you guys since V3, many, many moons ago.

 

Also I'll give my local reseller a call today to see what I can shake loose at their end.

Thanks again for your help.

 

Jim

Link to comment
Share on other sites

Hi Mick,

 

Ok, I'm in. Some info for others seeking to move forward.

I found out that I needed to link my email account to my Hasp key by downloading and running the code generator found on Mastercam dot com. I usually run Mastercam on an XP box in the shop and on a laptop running Win 7 64 bit Pro at home. Since the code generator apparently doesn't run on XP, I needed to download the code generator onto the laptop with the Hasp plugged in and configured, and run it to link everything up. Then, poof, everything instantly appeared on the download page. A ton of material including the SDK's for the CHooks all the way back to X5. Awesome.

 

It looks like the Chooks are the most mature and inclusive of the API's but it looks like a bear trying to match up the right version of the Microsoft Visual compiler to the right SDK. For that reason I'm going with the C# and Visual Basic .NET solutions. My C++ application runs 25 pages of dense code so it won't be fun reporting but it will be easier in the long run to keep current.

 

I've already run into a small problem that you might be able to help with.

I have a VB script that uses the ShellAndWait command to run an external exe file with an NCI file as one of the arguments in the command line: 

I setup the strNciFilename in advance then append it to the path to my NCI directory in strCommandLine like this:

 

strCommandLine = ("c:\mcam9\mill\nci\Dosomething.exe  & " " & strNciFileName 

Call ShellAndWait(strCommandLine, 1)

 

 As you can see it's pointing to my old V9 path to the NCI directory and works perfectly. I would like to point to my X5 NCI directory which was set up automatically in the X5 install to be c:\users\public\documents\my mcamx5\mill\nci\ but the ShellAndWait command gets hung up on the space between "my" and "mcamx5" in the X5 path. It keeps trying to execute an exe named "my.exe" which of course doesn't exist.

Is there a trick to get the ShellAndWait command to be able to see my X5 NCI directory? I guess I could just create a new NCI directory with a path with no spaces. ???

 

Jim

Link to comment
Share on other sites

Jim,

 

You need to escape the spaces in the path, just wrap the path with quotations as shown below.

Dim strCommandLine, strNciFileName

strNciFileName = "E:\Program Files\mcamx9\common\Editors\CIMCOEdit7\History.txt"
strCommandLine = Chr(34) & "E:\Program Files\mcamx9\common\Editors\CIMCOEdit7\CIMCOEdit.exe" & Chr(34) & " " & strNciFileName 

Call ShellAndWait(strCommandLine, true)
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...