Skip to content

Instantly share code, notes, and snippets.

Last active Dec 29, 2020
What would you like to do?
FreeCAD API notes

src/Gui/CommandT.h shows doxygen examples of for both cplusplus and python:

How to list parameters in the user.cfg (courtesy of openBrain)


def printValues(group, level):
    for value in FreeCAD.ParamGet(group).GetContents():
        print("  "*(level+1)+" - Key / Name = "+value[1]+" / Type = "+value[0]+" / Value = "+str(value[2])) 

def printGroup(group, level):
    print("  "*level+" - Group / "+group)
    if FreeCAD.ParamGet(group).GetContents() != None and len(FreeCAD.ParamGet(group).GetContents()) > 0:
        printValues(group, level)
    if len(FreeCAD.ParamGet(group).GetGroups()) > 0:
        for subgroup in FreeCAD.ParamGet(group).GetGroups():
            printGroup(group+"/"+subgroup, level+1)

printGroup("User parameter:BaseApp",1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment