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:

Getting started with C-hook development


Recommended Posts

I'm looking to get started developing some custom C-hooks for MasterCAM X6. I have the SDK but I'm waiting on my sysadmin to install it. I noticed it includes some API documentation, doxygen based by the look of it, but no examples. Are there any c hook examples that I can reference?

 

I've also seen mentioned a C-hook developer's guide. Does anybody know where I might find it?

Link to comment
Share on other sites
  • 3 months later...

The CHook Developer Guide is very out dated.

We're trying to encourage everyone to try to the use NETHook API.

True, you cannot do everything with the current NET API that you can with a CHook,

but if you don't need a CHook to do want do do - Don't do it with a CHook.

 

Building CHooks takes -

A much more experienced programmer.

You must use Visual Studio 2010 (Professional of higher) version to build CHook for X6/X7.

You can use the free C# "express" version of Visual Studio 2010/2012 for building NETHooks.

(If you use VS 2012 for NETHooks, be sure to set the .NET Framework target to v4.0)

 

First thing I ask someone who says "I want to create a CHook" is...

Exactly what are you wanting to have it do?

Link to comment
Share on other sites
  • 4 months later...

We're trying to encourage everyone to try to the use NETHook API.

 

Roger, is it means that in the future better to use VB? I would not rewrite my old C-Hooks of course, but then

I'll start programming in VB again. After 6 years, again... :S Gonna be hard :)

 

Well, I just played with NetHook 3.0 API. My bottom line is always import an OP and then attach a GEO.

 

Windows says: "Object reference not set to an instance of an object" Grrrr...

 

My sample:

Dim Vonal_1 As Geometry = New LineGeometry(New Point3D(-100.0, 100.0, 0.0), New Point3D(100.0, 100.0, 0.0))
Dim Vonal_2 As Geometry = New LineGeometry(New Point3D(100.0, 100.0, 0.0), New Point3D(100.0, -100.0, 0.0))
Dim Vonal_3 As Geometry = New LineGeometry(New Point3D(100.0, -100.0, 0.0), New Point3D(-100.0, -100.0, 0.0))
Dim Vonal_4 As Geometry = New LineGeometry(New Point3D(-100.0, -100.0, 0.0), New Point3D(-100.0, 100.0, 0.0))

Vonal_1.Commit()
Vonal_2.Commit()
Vonal_3.Commit()
Vonal_4.Commit()

Dim MyOp As Mastercam.Database.Operation
MyOp = OperationsManager.ImportOperation("d:\MouldSolution X7\--- Files ---\Operations\NECKRING OPS FOR BILLET.MCX-7", "Bal Kilincs Lecsapas Fent")

Dim Lanc(12) As Geometry

Lanc(1) = Vonal_1
Lanc(2) = Vonal_2
Lanc(3) = Vonal_3
Lanc(4) = Vonal_4

Dim MyChain(10) As Chain

MyChain = ChainManager.ChainGeometry(Lanc)

ChainManager.ManageChains(MyOp, MyChain, Mastercam.Database.Types.ChainManagerMode.AddChains, ChainTypes.CurveChains)

MyOp.Commit()

Link to comment
Share on other sites
...is it means that in the future better to use VB

You can use VB, though I'd prefer C#. ;)

 

"Object reference not set to an instance of an object"

Like any type of programming, you need some error checking.

I do not know if this is your current issue ->

Is MyOp "anything" after the ImportOperation?

If nothing was imported and then you go on and try to used it...

Link to comment
Share on other sites

Like any type of programming, you need some error checking.

I do not know if this is your current issue ->

Is MyOp "anything" after the ImportOperation?

If nothing was imported and then you go on and try to used it...

 

Well, I just tried the functions on my own way (thta's should be the probelmo) :smoke:

 

Import operation worked well and smooth. After that I made 4 lines and tried to

"chain it" and pass into OP. :blink:

 

 

 

You can use VB, though I'd prefer C#. ;)

 

Well, there's always C# .....

 

OK Guys! :lol: I'm not a "time-mllionaire"!!! :D

I've learned VB, then C++, now I plan go back to VB.

So why C#? Basically I'm ready to learn it, but suddenly I don't know what's the difference.

But you guys, now you can give me some reasons and tell me about benefits?

Thanxx in advance!!! :unworthy:

Link to comment
Share on other sites
Wait till you look at NetHook 4 / Mcx7 .... the words "feature rich" come to mind....

Actually it is the new NETHook v3 that comes with X7.

 

*** Also please note that the NETHook v2 (NETHook2_0.DLL) has been deprecated and will not be included with Mastercam after X7 ***

It'll will be NETHook v3 going forward...

 

Got the bottom of this page and you will find more detailed info in the NETHook v3 API

 

As for what language to use for creating NETHooks?

You can use VB.NET, C# or even C++/CLI (though this would be unusual).

If you know VB and are comfortable with it - use it.

If someone is just starting out, I always suggest C#

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