Embed Custom Metadata and Author Info in FreeCAD
Embedding custom metadata and author information into a FreeCAD project is essential for tracking revisions, maintaining intellectual property records, and streamlining collaboration. FreeCAD provides multiple methods to achieve this, including global user settings for automated author attribution, the native Document Properties interface for file-specific data, and Python scripting for creating custom, arbitrary metadata fields.
Setting Default Author Information Globally
To ensure that your name and licensing details are automatically attached to every new file you create, configure FreeCAD's global preferences:
- Open FreeCAD and navigate to Edit > Preferences.
- Select the General tab from the left sidebar, then click on the Document sub-tab.
- Locate the Authoring and License section.
- Fill in the Author name, Company, and default License fields.
- Click Apply and then OK.
Any new document created after this will automatically include these credentials in its internal metadata.
Editing Document Properties for Existing Files
For existing files, or to set project-specific details such as project titles and notes, use the Project Information panel:
- Open the target FreeCAD file (
.FCStd). - Go to the top menu and select File > Project information....
- In the dialog window that appears, fill out or modify the available
fields:
- Title: The formal name of the project or part.
- Created by: The author's name.
- Creation date: The timestamp for the file.
- Last modified by: The user who last saved changes.
- Company: The associated organization.
- Comment: Notes, revision summaries, or descriptive metadata.
- Click OK and save your document (Ctrl+S or File > Save).
Alternatively, you can select the root document node at the very top
of the Model tree view. In the Property
view panel below the tree, scroll through the properties to
find and edit the Author, Comment,
Company, and License values directly.
Adding Custom Metadata via Python
If you need custom key-value pairs that are not provided by default (such as Part Number, Revision Code, or Client Name), you can inject custom dynamic properties using FreeCAD's Python console:
- Ensure the Python console is visible by going to View > Panels > Python console.
- Run the following commands to add a custom string property to the active document:
doc = FreeCAD.ActiveDocument
doc.addProperty("App::PropertyString", "PartNumber", "CustomMetadata", "The internal part numbering code")
doc.PartNumber = "PN-10492-REV-B"In this command:
"App::PropertyString"specifies the data type."PartNumber"is the internal property name."CustomMetadata"is the group name that will appear in the Property editor panel.- The final string is a tooltip description.
Once executed, select the document root in the Model tree. You will see your new CustomMetadata group in the Property view panel, where you can modify the custom property directly through the graphical user interface. Save the file to preserve the custom data.