Community
Fusion Manufacture
Talk shop with the Fusion (formerly Fusion 360) Manufacture Community. Share tool strategies, tips, get advice and solve problems together with the best minds in the industry.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sorted tooltable / getToolList() - not working

5 REPLIES 5
Reply
Message 1 of 6
edautodesk69XS4
169 Views, 5 Replies

Sorted tooltable / getToolList() - not working

Hi, I wanted to iterate through my tooltable in a sorted order, so according to the API docs in the link below, getToolTable() is deprecated and I should be using getToolList()?

 

  https://cam.autodesk.com/posts/reference/classPostProcessor.html

 

However, I see several problems:

1) On a fresh download of Fusion360 on Windows, I see an error "Invalid Postprocessor" whenever I try and import a trivial postprocessor file which has been altered to include:

 

var tools = getToolList("number");

 

2) On Mac this works, but I get a fatal error if I run it against a setup with no tools, eg a setup which only contains manual NC sections. This means I need to guard it by eg calling the deprecated getToolTable() and test there are non zero number of tools.

 

3) Sorting doesn't seem to function except against a single item. For example I don't seem to be able to sort by diameter, then description with "diameter,description"

 

Are these known bugs? Is there a timeline to this working on all platforms?

5 REPLIES 5
Message 2 of 6

I changed my var tools = getToolTable(); to var tools = getToolList(); and am able to import the post, but get an error log of 

###############################################################################
Error: TypeError: tools.getNumberOfTools is not a function
Error at line: 597

Stack dump:
onOpen()@C:/Users/camuser/AppData/Roaming/Autodesk/Fusion 360 CAM/Posts/haas next generation - a rev, c yes 2023b.cps:596
Failed while processing onOpen().
###############################################################################

Error: Failed to invoke function 'onOpen'.
Error: Failed to invoke 'onOpen' in the post configuration.
Error: Failed to execute configuration.
Stop time: Thursday, August 31, 2023 4:49:08 PM
Post processing failed.
Please click "Accept Solution" if what I wrote solved your issue!
Message 3 of 6

The two functions are not identical, you need to look at the return result. The new function returns only a list (the old function has more fields).

 

So adapt the rest of the code as well

 

However, I am curious? This wasn't working for me *on PC* only a few weeks back. Are you testing this on a PC?

Message 4 of 6

yes, we are on W10. 

Here is my entire tooltable section. Not sure what else would have to be modded to output a list? 

I just currently make sure to do a library renumbering before posting so all my unique (#2-9) tools are sequential (#10-20 stay in the machine at all times).

 

My post does output all the tools in numerical order though, not in the order of use like Mcam. 

Please click "Accept Solution" if what I wrote solved your issue!
Message 5 of 6

I'm not sure what you mean when you say "here is my entire tooltable section"? Did you forget to write something?

 

If you dump the contents of the new function, you will see that it returns an array, ie totally different format to the old call. So you need to change more than just the function call.

Message 6 of 6

yes i did, sorry

var tools = getToolTable();
if (tools.getNumberOfTools() > 0) {
for (var i = 0; i < tools.getNumberOfTools(); ++i) {
var tool = tools.getTool(i);
var comment = "T" + toolFormat.format(tool.number) + " " +
"D=" + xyzFormat.format(tool.diameter) + " ";
if (zRanges[tool.number]) {
comment += "- " + localize("ZMIN") + "=" + xyzFormat.format(zRanges[tool.number].getMinimum());
}
comment += " - " + tool.description;
writeComment(comment);
}
}
}

Please click "Accept Solution" if what I wrote solved your issue!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums