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:

Modifying Toold Diameters in an Existing Tool Library


Recommended Posts

Good afternoon all.

 

I am learning to write NET-hooks, and I have something I would like to achieve, but I am not certain it can even be done, so....

 

 

 

What I have is an existing Tool Library in X6. (Windows 7, 64 bit) (I will be using VS 2012 Pro for the scripting)

 

It is my "Standard" Tool library for all the machines I program for...

 

I program for cutting electrodes, and I use a procedure where-in, to adjust for spark gap, I take the spark gap per side value, multiply it times 2, then subtract this away from my nominal diameter sized tool.

 

I take each tool, within my existing Standard tool library, and I apply the procedure above, to modify the Diameters of all the tools residing in my library.

 

I would like to automate the procedure, and was wondering if this is even feasible using NetHook, VB, C-Hook, or ???

 

 

 

The way I have "automated" it so far is that I have an X-Keys macro key recorder, and for each tool, it plays back the steps, and applies the spark gap to all the tools in the library, but it has its drawbacks...

 

The biggest drawback is that being a "timed" macro replay, if my computer is running "slow" then it does not always execute the replay correctly.

(There are 500 to 800ms delays, to ensure that all the steps "execute", without skipping a field, but when the box is lagging, it will skip fields and do all sorts of un-wanted things)

 

The next biggest drawback is the time it takes...

 

 

 

Also, I have Standardized naming for my tools (please see below), and I need that to be modified also, to reflect the spark gap that has been applied to the tool...

 

This is how a Tool Name appears in my Standard Tool Library, with-out Spark Gap applied to the tool:

 

3/8" Sqr. End Mill---.0000"/side--FINISHING

 

 

This is how a tool appears in my Standard Tool Library, WITH Spark Gap applied to the tool.

 

3/8" Sqr. End Mill---.0050"/side--FINISHING

 

 

 

 

So, would it be possible to write a script that would take an existing library, apply the Spark Gap to every tool in that library, and modify the Tool Name, to reflect the amount of spark gap that has been applied to the tools?

 

I will not refuse any code, but am not expecting handouts...I need to learn how to do this, but as I said, I am not even sure it CAN be done...

 

Thanks very much for your input...

Link to comment
Share on other sites

This is a bit Mickey Mouse as didn't spend much time on it but it will work. See the attached images.

 

Open X6

Machine Type Mill

Toolpaths -> Tool Manager and select a different tool library (button) (image)

Copy all tools to machine group

Run the NETHook

Toolpaths -> Tool Manager and save the tool library out with the changes. (image)

 

The NETHook code is shown below:

 

public override MCamReturn Run(int param)
 {        
		 var endMills = SearchManager.GetTools(ToolType.EndMill);			

            // iterate result
		 foreach (var endMill in endMills)
		 {
			 // Apply logic as required
			 endMill.Diameter += 0.005;
			 endMill.Name = endMill.Diameter.ToString(CultureInfo.InvariantCulture) + @" End Mill---.0050/side--FINISHING";

			 endMill.Commit();
		 }

            return MCamReturn.NoErrors;
 }

 

If you are updating to X7 there is a new method to load a tool library so that might allow for a cleaner way to update a tool library, in any event the above code should give you some to work on for the time being.

post-4901-0-42037700-1367978177_thumb.png

post-4901-0-12302500-1367978184_thumb.png

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