Skip to content

Instantly share code, notes, and snippets.

Last active December 29, 2020 16:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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