Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

tool member function issue when calling tool.getShaftDiameter()

1 REPLY 1
SOLVED
Reply
Message 1 of 2
cameronrweigel
127 Views, 1 Reply

tool member function issue when calling tool.getShaftDiameter()

I swear I had this working last week... I'm calling tool.getShaftDiameter() as it's listed as a function of the tool class (reference : https://cam.autodesk.com/posts/reference/classTool.html#a5e2acd5a77b4b8808f0428f788542b3c), but I get the error:

 

Error: TypeError: tool.getShaftDiameter is not a function
Error at line: 551
 
Code below, I've marked line 551
 
var tools = getToolTable();
    if (tools.getNumberOfTools() > 0) {
      var diaFormat = createFormat({decimals:4trim:false});
      var twodecFormat = createFormat({decimals:2});
      for (var i = 0i < tools.getNumberOfTools(); ++i) {
        var tool = tools.getTool(i);
        var comment = "T" + toolFormat.format(tool.number) + " - ";
        comment+= "D" + tool.diameterOffset + " - ";
        comment+= "H" + tool.lengthOffset + " - ";

        comment+= "DIA=" + diaFormat.format(tool.diameter) + " - ";
        comment+= "FLENGTH=" + twodecFormat.format(tool.getFluteLength());
        if ( tool.getShaftDiameter() != tool.diameter) {  //line 551
          comment += " - " + "RL=" + twodecFormat.format(tool.getShoulderLength()); 
        }
 
I know newer implementations of java do weird things with getters and setters but unless something vastly changed from just a few days ago, I think this should work... Any help is appreciated. Thank you!
Labels (3)
1 REPLY 1
Message 2 of 2

tool.shaftDiameter works, solved my own problem!

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report