How to get the cam template libraries

How to get the cam template libraries

maurizio_manzi
Advocate Advocate
235 Views
6 Replies
Message 1 of 7

How to get the cam template libraries

maurizio_manzi
Advocate
Advocate

Hello,
How to get the cam template libraries: folder and templates in any folder ?
I can't found any example, that works..
Best regards
Maurizio

Screenshot 2025-07-07 154039.png

 

0 Likes
Accepted solutions (1)
236 Views
6 Replies
Replies (6)
Message 2 of 7

boopathi.sivakumar
Autodesk
Autodesk

Hi @maurizio_manzi 

You can refer this example 
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-{3C372103-F3EF-4C85-9849-934F112D0A50}https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-{3C372103-F3EF-4C85-9849-934F112D0A50}
here

def getTemplateFromLibrary(templateLibrary: adsk.cam.CAMTemplateLibrary, libLocation: adsk.cam.LibraryLocations, folderName: str, templateNameSubstring: str):
    libraryURL = templateLibrary.urlByLocation(libLocation)
    
    templates = None
    if folderName == "":
        templates = templateLibrary.childTemplates(libraryURL)
    else:
        childFolders = templateLibrary.childFolderURLs(libraryURL)
        pickedFolderURL = None
        for folderURL in childFolders:
            if folderURL.leafName.lower() == folderName.lower():
                pickedFolderURL = folderURL
                break
        templates = templateLibrary.childTemplates(pickedFolderURL)

    pickedTemplate = None
    for template in templates:
        lowerCaseName: str = template.name.lower()
        if lowerCaseName.find(templateNameSubstring.lower()) != -1:
            pickedTemplate = template
            break
    return pickedTemplate

Boopathi Sivakumar
Senior Technology Consultant

Message 3 of 7

maurizio_manzi
Advocate
Advocate

Hello,
Thank you very much.
It is also possible to get a list of the operations, if the template is a template-group (see pic) ?
Best regards
Maurizio

08-07-_2025_10-23-31.png

0 Likes
Message 4 of 7

boopathi.sivakumar
Autodesk
Autodesk

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-0586D2B2-0683-462B-B3B8-B1E387CEC0F4

I think should be possible when you have a template then you can get the operations by template.operations 

and its a list you should be able to itereate over to get the name or other things


Boopathi Sivakumar
Senior Technology Consultant

0 Likes
Message 5 of 7

maurizio_manzi
Advocate
Advocate

yes, I know the template.operations, but an iteration is not possible and it have no .item() parameter.
Only you can do with template.operations is to get the count of it..

0 Likes
Message 6 of 7

jeff.pek
Community Manager
Community Manager
Accepted solution

I'm not sure why it was done this way, but operations has a "get" method that takes a 0-based index, instead of the usual "item" or "itemAt" method. These return a CAMTemplateOperationInput object.

 

Jeff

Message 7 of 7

maurizio_manzi
Advocate
Advocate

Thnak you very much

0 Likes