Skip to content

Instantly share code, notes, and snippets.

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

src/Gui/CommandT.h shows doxygen examples of for both cplusplus and python:
https://github.com/luzpaz/FreeCAD/blob/f2d17774e8c9154f80b98f797e3561ee2ad36061/src/Gui/CommandT.h#L59-L78

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

#!/usr/bin/python

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