Script to extract holder

Script to extract holder

nubrandao
Collaborator Collaborator
125 Views
1 Reply
Message 1 of 2

Script to extract holder

nubrandao
Collaborator
Collaborator

Hi, i have 1000 tools imported from powermill, but i need to copy those tool holder.

 

Is it possible to write a scripts to copy  those tool holder to a specific folder? That way i can i have all the holder in a specific folder

0 Likes
126 Views
1 Reply
Reply (1)
Message 2 of 2

rohit_maneYV8C9
Autodesk
Autodesk

Hello @nubrandao,

These are some ways to retrieve all tool holders from the tool library.

list_of_holders = []
for i in range(toolLibrary.count):
    tool = toolLibrary.item(i)
    if tool.parameters.itemByName('tool_type').expression == "'holder'":
        list_of_holders.append(tool)

 Refer this Example for more details :-

list_of_holders = []
toolQuery = toolLibrary.createQuery()
toolQuery.criteria.add(
    'tool_type', adsk.core.ValueInput.createByString('holder'))
results: list[adsk.cam.ToolQueryResult] = toolQuery.execute()
for result in results:
    list_of_holders.append(result.tool)

Alternatively, you can look through the JSON Tool Library data to get tool details.