Reference priority
- Use
.pyistub reference pages as the first static callable reference when present. - Treat implementation details as operational evidence, not as guaranteed public API.
- Runtime truth belongs to the loaded Parashell process: imported modules,
doc.supportedTypes(), objectPropertiesList, property metadata, and actual objectTypeId. - Do not bulk import arbitrary implementation files for discovery. Use loaded modules or stubs, then confirm with runtime introspection.
Stub semantics
- Stubs frequently use
from __future__ import annotations,TYPE_CHECKING,Final,Literal,TypeAlias,TypedDict, and@overload. These are signature/reference constructs, not proof that every referenced name is importable at runtime from the stub file path. - Repeated
@overloaddefinitions describe accepted call shapes. Prefer the most specific overload for argument construction; use the broad implementation signature as the fallback. - Class and attribute docstrings in the stubs are static descriptors. Use them as descriptors, but still inspect runtime object properties for dynamic objects.
- Module names in stubs use compatibility import names such as
FreeCAD,Part,Sketcher,Mesh,Spreadsheet, andTechDraw.
Document and transaction quirks
FreeCAD.ActiveDocumentandFreeCAD.activeDocument()are both represented. ResolveNoneexplicitly before modeling.Document.openTransaction(name)is documented in the stub as routing throughFreeCAD.setActiveTransaction(name). A transaction may be application-scoped, and changes in more than one open document can share one internal transaction id.FreeCAD.getActiveTransaction()returns the current transaction name/id tuple orNone.FreeCAD.closeActiveTransaction(abort=False, id=0)closes or aborts the active transaction.Document.HasPendingTransaction,Document.Transacting,Document.Recomputing,Document.Restoring,Document.Importing,Document.Partial,Document.Temporary, andDocument.RecomputesFrozenare document state signals. Read them before assuming the document is mutable or stable.Document.getFileName()returns a file path for regular documents and a transient directory for temporary documents.Document.addObject(...)accepts optionalobjProxy,viewProxy,attach, andviewType. Whenattach=True, Python proxy binding can callattach(obj)before adding the object.
Object and link quirks
DocumentObject.ViewObjectisNonewhen GUI is not up. Never assume it exists in headless execution.DocumentObject.FullNamecombines document and internal object name. Use it for disambiguation across loaded documents.DocumentObject.NoTouchcan suppress touch behavior from property changes. Check it before diagnosing why recompute did not propagate.DocumentObject.getStatusString()returns invalid error text,"Touched", or"Valid"according to object state.DocumentObject.getSubObject(...)accepts string/list/tuple subnames andretTypevalues:
DocumentObject.getLinkedObject(...)can recursively resolve links and optionally return accumulated transforms through a matrix argument.Document.copyObject(...),Document.moveObject(...), andDocument.importLinks(...)exist for cross-document object movement and external link import. Userecursive,return_all, andwith_dependenciesintentionally.
Property quirks
PropertyContainer.getPropertyByName(name, checkOwner)can return linked-object properties. UsecheckOwner=1to require local ownership orcheckOwner=2to receive owner plus value.getTypeOfProperty(name)returns property status words such asHidden,NoRecompute,NoPersist,Output,ReadOnly,Transient, andInput.setPropertyStatus(name, val)accepts int, string, or list of ints/strings. Text values beginning with-and negative integer values clear status.setEditorMode(name, type)accepts numeric modes or strings. Numeric modes map to default, read-only, hidden, and hidden-read-only.dumpPropertyContent(Property, Compression=3)serializes a property into bytes.restorePropertyContent(name, obj)accepts any buffer-protocol object.- Dynamic property group and documentation are mutable through
setGroupOfProperty(...)andsetDocumentationOfProperty(...).
Expression quirks
DocumentObject.setExpression(path, expression)accepts a string expression. Binding code also acceptsNoneto clear the expression.DocumentObject.evalExpression(expression)can evaluate an expression without assigning it.hiddenref(...)is registered in the expression engine and is tested as a way to evaluate a reference without ordinary dependency edges.- Spreadsheet label references use angle-label syntax such as
<<Spreadsheet>>.Lengthand formulas use<<A>>-style object/name tokens in some contexts. - Spreadsheet formulas use semicolons as function argument separators and support conditional syntax with
? :.
Spreadsheet quirks
- Invalid cell addresses or properties raise
ValueErrorthrough the spreadsheet binding. - Alias creation rejects duplicates, cell-address aliases, and unit/reserved-word aliases.
- Clearing an alias uses
setAlias(cell, ""). - Structural row/column edits can move aliases and formulas. Validate with
getAlias,getContents, and recompute. - Mixed-unit aggregations return error strings in cells rather than numeric values.
- Tuple/vector/matrix/rotation/placement formula constructors are validated by the runtime behavior; validate result type and tolerance after recompute.
GUI quirks
- Source repeatedly guards GUI imports with
FreeCAD.GuiUp. Preserve that gate forFreeCADGui, viewproviders, selection, active views, viewport projection, and GUI command code. - A view-dependent workflow should create geometry, recompute, refresh/update the view, then inspect projected bounds or selection state.
- GUI stubs are included in the reference pages because they are Python-facing, but headless agents should treat them as unavailable unless
FreeCAD.GuiUpis true.
Parseability quirks
- Syntax validation should parse snippets with
ast.parseand allow only explicitly permitted node forms. - Prefer
.pyireference pages and runtime introspection over implementation-only modules for API discovery.