I have tried things like
>>> App.ActiveDocument.addObject("Draft::Text","Tekst")
or
>>> t=Draft.Text.createObject()
but I can't guess how it really works. I could not find any good documentation and examples about Draft module either.
I am using:
FreeCAD 0.10.3142 on OpenSUSE 11.1, 64-bit
I am just sneezing the python scripting possibilities in FreeCAD, looks absoluetly fascinating!!!
How to create text object in python console
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
-
- Posts: 1
- Joined: Mon Jul 15, 2019 4:37 pm
Re: How to create text object in python console
What? you can't be really, that is obsolete beyond all reason, it almost predates every piece of FreeCAD's functionality, I very much doubt it is right.
Please post your version data in the manner explained in the forum rules link above this forum.
You can create an annotation from Python or a Draft WB text object.
the following works
Code: Select all
FreeCAD.ActiveDocument.addObject("App::AnnotationLabel","MyNote").LabelText=["This is my note"]
OS: Ubuntu 18.04.2 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)
Re: How to create text object in python console
Also the Draft WB tools wiki pages show you (at the bottom) how to create them from Python
Draft_Label
Draft_Text
Draft_Label
Draft_Text
Re: How to create text object in python console
With their brother Draft ShapeString