Often you want your part counter to go up by more than 1 each cycle if you are batching parts, and this is especially needed for output tracking. Here’s an easy way to modify your Fusion post to support this.
Add the supplementary code to the end of your post:
/* Chatter Modifications */
function Chatter() {
this.init = function() {
properties["usePartCounter"] = false;
propertyDefinitions["usePartCounter"] = {title:"Use part counter", description:"Count parts in specified increment", group:"Chatter Settings", type:"boolean"};
properties["partCounterIncrement"] = 1;
propertyDefinitions["partCounterIncrement"] = {title:"Part counter increment", description:"Parts generated per cycle", group:"Chatter Settings", type:"integer"};
properties["partCounterVariable"] = 3901;
propertyDefinitions["partCounterVariable"] = {title:"Part counter variable", description:"Variable in which to store parts count", group:"Chatter Settings", type:"integer"};
}
this.init()
this.bumpPartCount = function() {
if (properties.usePartCounter) {
writeBlock("#" + properties.partCounterVariable + "=" + "#" + properties.partCounterVariable + "+" + properties.partCounterIncrement);
}
};
}
/* End Chatter Modifications */
Initialize Chatter immediately after your propertyDefinitions (near the beginning of the .cps file)
var chatter = new Chatter();
Increase the part count in your onClose() section, right before M30.
chatter.bumpPartCount();
That’s it! When you load up your post you should see the options for “Use Part Counter”, “Increment”, and “Variable” in the post properties dialog.
Final Notes:
- This works for Haas* and Fanuc controls
- Haas machines won’t allow you to write to macro #3901, so you’ll want to change that to some macro of your choosing. I prefer to use #100 for part count and #101 for part goal
- For Haas NGC machines, you need to use macros in the 10,000 range, for example 10100 and 10101. 100 and 101 are considered “Legacy Variables”, and vars in the 10,000 range are preferable to use for both read and write.
Comments
0 comments
Please sign in to leave a comment.