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:

How to create an operation with VB


Recommended Posts

Hi all,

 

as far as I can see, Mastercam scripting provides two groups of functions to create toolpath operations:

 

The first group consists of MakeOperationFromName() and MakeOperationFromID(), all very nice, but there is no way to pass a tool diameter.

So I will have to create operation templates for each and every tool diameter I can think of.

 

The functions in the second group, MakeContour(), MakePocket()... accept the tool diameter or tool number as an argument, which is what I wanted.

But you can't force them to use 'control' cutter compensation, they always generate the already compensated toolpath.

 

Does anyone know how to persuade MakeContour() or MakeContourWithKnownTool() to use cutter compensation in control?

I checked my operations-5 and .defaults-5 in advance and they all use cutter compensation in control.

Is there a hidden switch to change this behaviour?

 

Cheers,

 

Thomas

Link to comment
Share on other sites

Thank you Roger,

 

well, I thought as much.

No real problem, but I quite like VB Script, because it doesn't need recompiling after you guys change your Visual Studio with every Mastercam release;-)

I use VB Script as often as possible, quick and dirty for your everyday tasks.

 

Thomas

Link to comment
Share on other sites

Thomas,

For you current project, are you importing the operation from an OPERATIONS-5 file and then wanting to alter it?

 

VB Script may seem simpler, and it's OK for quick & dirty, but if I'm building something that I want to use again and again,

or something that other people can use - I’d much rather work in Visual Studio with the .NET platform.

A much richer environment and with intellisense. :)

You can use the free "Express" versions of Visual Studio for developing NETHooks.

 

VB Express

...or...

C# Express (my preference) ->

 

*Using Visual Studio 2010 you can build NETHooks for Mastercam X5 and X6,

it’s just that for X5 you must be sure that the project’s “.NET Target framework” setting is no higher than “v3.5”.

You do NOT need to change this for X6, but you certainly can to gain access to the newer stuff in the Microsoft .NET 4.0 Framework.

*Even if you find example code that this not in the "correct" language (VB / C#) that you use,

there are very good (and free) code converts available on the web, like this one -> Convert VB to C# or C# to VB

Link to comment
Share on other sites

Thomas,

 

Email me -> SDK <at> mastercam <dot> com

and I can send you an example (C#) NETHook that ->

1> Imports a Contour operation from an OPERATIONS file.

2> Prompts the user for the Chain.

3> Alters the tool that was pulled in with the operation.

4> Set the Chain and Tool updates to the operation.

5> Imports a Drill type operation.

6> Prompts the user to select the drill points. (Points and/or Arcs)

7> Set those drill points to the operation.

8> Regenerates the operations.

Link to comment
Share on other sites

Thomas,

 

Email me -> SDK <at> mastercam <dot> com

and I can send you an example (C#) NETHook that ->

1> Imports a Contour operation from an OPERATIONS file.

2> Prompts the user for the Chain.

3> Alters the tool that was pulled in with the operation.

4> Set the Chain and Tool updates to the operation.

5> Imports a Drill type operation.

6> Prompts the user to select the drill points. (Points and/or Arcs)

7> Set those drill points to the operation.

8> Regenerates the operations.

 

Has the drill points selection for imported Ops been fixed? I'm doing much the same as you describe above, with imported Contours, pockets, etc, but found when selecting arcs for drill points, I was always given an extra, random point, that was not on any arc ...

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

Roger, I am another user, and am wondering if the 2010 Express versions / .NET 4 versions of both VB and or C# will allow me to make NEThooks for Mastercam X3...

 

I have X5, but the other guy here who runs Mastercam with me, his computer will not run X5 very well...That is my limiting factor...

 

Anyhow, I did a search back through the forum here, and was unable to determine if I can use 2010 Express / .NET 4 versions for X3.

 

Please be kind...Newbee to this

 

Thanks very much for your help...

Link to comment
Share on other sites

YES -> 2010 Express version (C# or VB) should be OK.

NO -> .NET 4 Framework

 

You'll probably not be able to use .NET v4 as that didn't exist back then (X3).

In the Project Properties and the Application tab, set the Target Framework to -> ".NET Framework 2.0"

 

I do not have X3 handy, but you can try it out in without too much effort.

Link to comment
Share on other sites

YES -> 2010 Express version (C# or VB) should be OK.

NO -> .NET 4 Framework

 

You'll probably not be able to use .NET v4 as that didn't exist back then (X3).

In the Project Properties and the Application tab, set the Target Framework to -> ".NET Framework 2.0"

 

I do not have X3 handy, but you can try it out in without too much effort.

 

 

Thanks very much...

Link to comment
Share on other sites

Has the drill points selection for imported Ops been fixed? I'm doing much the same as you describe above, with imported Contours, pockets, etc, but found when selecting arcs for drill points, I was always given an extra, random point, that was not on any arc ...

 

same here. I had to skip past it and select points manually afterwards

Link to comment
Share on other sites

rocheey1,

 

From your posting on Aug 2 - >

ok, lemme simplify (isolate) the code, will email you the code when ready. ThaNX

Did you ever send anything to me?

 

Without seeing exactly what you're doing, and with only this info ->

"when selecting arcs for drill points, I was always given an extra, random point, that was not on any arc ..."

there is not much I can do to guess what is happening.

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