Hello,
I'm looking for a Function (Sorry I Haven't find the option or function to do that) or A macro to Change the Font for every existing Label or Dimension existing in a TechDraw DrawPage.
Thanks a lot
[SOLVED] Macro or Function to change the Font for every Dimension
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
[SOLVED] Macro or Function to change the Font for every Dimension
Last edited by Cuq on Wed Apr 26, 2023 1:26 pm, edited 1 time in total.
Re: macro or Function to change the Font for every Dimension
It's not an answer but rather a workaround: You can select all these entities and change all their common properties in a single step.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: macro or Function to change the Font for every Dimension
It's a WorkAround but you cannot select everything with a Ctrl+A , You need to select Each Dimension/Ballon One By one or use a MAcro.
ChatGPT is my new friends :
I'm closed to the result but I cannot modify the value of the Font in this Macro : obj.Font
ChatGPT is my new friends :
Code: Select all
import FreeCADGui
# browse all objects in the view
for obj in FreeCADGui.ActiveDocument.Document.Objects:
if obj.isDerivedFrom("TechDraw::DrawViewDimension"):
FreeCADGui.Selection.addSelection(obj)
elif obj.isDerivedFrom("TechDraw::DrawViewLabel"):
FreeCADGui.Selection.addSelection(obj)
elif obj.isDerivedFrom("TechDraw::DrawViewBalloon"):
FreeCADGui.Selection.addSelection(obj)
Last edited by Cuq on Wed Apr 26, 2023 2:06 pm, edited 1 time in total.
Re: macro or Function to change the Font for every Dimension
Ctrl+A sure is too much, single selection too tedious. An intermediate possibility is to select ranges with Shift+click, possibly augmented by deselecting single items.
Nevertheless, a macro is the way to go.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: macro or Function to change the Font for every Dimension
Ok Got It !
Code: Select all
import FreeCADGui
# browse all objects in the view
for obj in FreeCADGui.ActiveDocument.Document.Objects:
if obj.isDerivedFrom("TechDraw::DrawViewDimension") or obj.isDerivedFrom("TechDraw::DrawViewBalloon"):
_name=obj.Name
FreeCADGui.ActiveDocument.getObject(_name).Font = "osifont"
elif obj.isDerivedFrom("TechDraw::DrawViewAnnotation") :
_name=obj.Name
FreeCAD.ActiveDocument.getObject(_name).Font = "osifont"
Re: [SOLVED] Macro or Function to change the Font for every Dimension
Final Release
Copy the two files ChangeFontTechDraw.FCMacro and TaskChangeFont.ui into your macro directory.
Copy the two files ChangeFontTechDraw.FCMacro and TaskChangeFont.ui into your macro directory.
- Attachments
-
- ChangeFontTechDraw.FCMacro
- (4.13 KiB) Downloaded 34 times
-
- TaskChangeFont.ui
- (816 Bytes) Downloaded 34 times
Re: [SOLVED] Macro or Function to change the Font for every Dimension
@wandererfan
What do you think about a buttons for:
- Select all dimensions on page
- Select all dimensions on view
- Select all views
And similar like that?
What do you think about a buttons for:
- Select all dimensions on page
- Select all dimensions on view
- Select all views
And similar like that?
- wandererfan
- Veteran
- Posts: 6268
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact: