Community
HSM Post Processor Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need help using getToolList function.

1 REPLY 1
Reply
Message 1 of 2
jackG933P
153 Views, 1 Reply

Need help using getToolList function.

I am trying to edit my post so that I can put more tool data in the tool list at the start of the program. Every post uses getToolTable, but the documentation says that this is deprecated and I should use getToolList. Get tool list seems to output an array of objects in the format { tool:{}, operations:{}, range: {}}. Is there a way for me to export this data as a JSON so that I can look at how to access and manipulate it? I am having issues getting the tool type. I want to display different info based on the tool type, but it's not working. getToolTypeName is the function used to get a readable tool type name, but this is coming up as undefined for every tool and the tool types are not being recognized. I just need to know how this data is stored but I don't have a way of looking at it. Any help is appreciated. 

 

Below is my code for reference:

 

 

 

 

 

 

      var tools = getToolList();

      for(var i=0;i < tools.length; i++){
        var comment = "T" + toolFormat.format(tools[i].tool.getNumber()) + " ";

        if((tools[i].tool.type == 'TOOL_TAP_RIGHT_HAND') || (tools[i].tool.type == 'TOOL_TAP_LEFT_HAND'))
        comment += tools[i].tool.getDescription() + " ";
        else{
          comment += "D=" + tools[i].tool.getDiameter() + " ";

          if((tools[i].tool.type == 'TOOL_DRILL') || (tools[i].tool.type == 'TOOL_MILLING_FACE') || (tools[i].tool.type == 'TOOL_MILLING_RADIUS') || (tools[i].tool.type == 'TOOL_MILLING_SLOT') || (tools[i].tool.type == 'TOOL_MILLING_DOVETAIL') || (tools[i].tool.type == 'TOOL_MILLING_TAPERED') || (tools[i].tool.type == 'TOOL_MILLING_LOLLIPOP') || (tools[i].tool.type == 'TOOL_MILLING_THREAD'))
          comment += tools[i].tool.getDescription() + " ";

          if(tools[i].tool.type == 'TOOL_MILLING_END_BULLNOSE')
          comment += "CR=" + tools[i].tool.cornerRadius + " ";

          if(tools[i].tool.taperAngle > 0)
          comment += "TAPER=" + tools[i].tool.taperAngle + "DEG ";

          comment += tools[i].tool.numberOfFlutes + " FLUTE " + getToolTypeName(tools[i].tool) + " FL=" + tools[i].tool.fluteLength + " SO=" + getBodyLength(tools[i].tool);
        }
        writeComment(comment);
        writeln(JSON.stringify(tools[i].tool.length));
      };
Labels (3)
1 REPLY 1
Message 2 of 2

You have to pass the type to get the name but you are passing the tool

          comment += tools[i].tool.numberOfFlutes + " FLUTE " + getToolTypeName(tools[i].tool) + " FL=" + tools[i].tool.fluteLength + " SO=" + getBodyLength(tools[i].tool);
        }


The above line should look like this

 comment += tools[i].tool.numberOfFlutes + " FLUTE " + getToolTypeName(tools[i].tool.type) + " FL=" + tools[i].tool.fluteLength + " SO=" + getBodyLength(tools[i].tool);
        }

Boopathi Sivakumar
Senior Technology Consultant

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

Post to forums  

Autodesk Design & Make Report