Skip to content

Instantly share code, notes, and snippets.

@juanpaexpedite
Created August 13, 2023 08:10
Show Gist options
  • Save juanpaexpedite/5bce56aebfba9326a3b77112eebf7fc0 to your computer and use it in GitHub Desktop.
Save juanpaexpedite/5bce56aebfba9326a3b77112eebf7fc0 to your computer and use it in GitHub Desktop.
Change Font Size in FreeCAD TechDraw Workbench Dimensions
# List all objects
# -*- coding: utf-8 -*-
import FreeCAD,Draft
# List all objects of the document
doc = FreeCAD.ActiveDocument
objs = FreeCAD.ActiveDocument.Objects
def clearConsole():
from PySide import QtGui
mw=Gui.getMainWindow()
c=mw.findChild(QtGui.QPlainTextEdit, "Python console")
c.clear()
r=mw.findChild(QtGui.QTextEdit, "Report view")
r.clear()
clearConsole()
page_name = "Page"
new_font_size = 4.0
techdraw_page = doc.getObject(page_name)
if techdraw_page:
for obj in techdraw_page.OutList:
if obj.TypeId == "TechDraw::DrawViewDimension":
oldSize = obj.ViewObject.Fontsize
obj.ViewObject.Fontsize = new_font_size
else:
print("TechDraw page not found.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment