[Merged] Draft.ShapeString
- wandererfan
- Veteran
- Posts: 6317
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Draft.ShapeString
Ok, I'll look into QFont for the initial selection. You can set a default in Draft.Preferences so the font name won't be empty when the tool starts up.
I want to put a selector in the properties editor, but I haven't figured out how the editor works yet.
I want to put a selector in the properties editor, but I haven't figured out how the editor works yet.
Re: Draft.ShapeString
Basically it depends on the type of your property. If you use a PropertyString, it displays as an editable lineedit field. If you use a PropertyFile, it displays as a non-editable lineedit, with a "..." (browse) button.wandererfan wrote:I want to put a selector in the properties editor, but I haven't figured out how the editor works yet.
Re: Draft.ShapeString
I was wondering if the ShapeString tool had been tested with 0.14 unstable on Windows, and what is required to install to make it work? I'm guessing Freetype from either here (slightly older version) or here. Anything else?
My FreeCAD install in my WinXP virtual machine won't start so I cannot test. There's someone asking for text engraving in the Help forum but I won't suggest this course of action if ShapeString doesn't work on Windows.
Thanks.
My FreeCAD install in my WinXP virtual machine won't start so I cannot test. There's someone asking for text engraving in the Help forum but I won't suggest this course of action if ShapeString doesn't work on Windows.
Thanks.
Re: Draft.ShapeString
No, it doesn't work there. There is the command in the Draft menu (btw. the menu text is empty) which starts a dialog where you can enter position, text, height and a font file. But then you'll get an error:There's someone asking for text engraving in the Help forum but I won't suggest this course of action if ShapeString doesn't work on Windows.
Sorry, ShapeString is not yet fully implemented for your platform.
Re: Draft.ShapeString
Even with freetype installed? I think it would be necessary to implement it for Windows before official release...
Re: Draft.ShapeString
Somewhere in the Draft sources there is a line where it is checked whether the system is Linux or not. If not, then the above message is printed. I commented out this line to see what happens but I got a couple of more errors.
Re: Draft.ShapeString
Creating the FreeType library under Windows was fine but I keep getting linker errors when I try to link with FreeCAD.
Re: Draft.ShapeString
OK, I got it working now. In order to use FreeType, FreeCAD needs to be configured in CMake with the option "FREECAD_USE_FREETYPE" enabled. We also need a new LibPack with the FreeType header and library files.
Re: Draft.ShapeString
I just built a new version of FreeCAD 0.14 on the Mac, and get this error when trying Draft.ShapeString:
('[Draft.todo.tasks] Unexpected error:', <type 'exceptions.RuntimeError'>, 'in ', <bound method snapTracker._insertSwitch of <DraftTrackers.snapTracker instance at 0x11cc18cf8>>, '(', <pivy.coin.SoSwitch; proxy of <Swig Object of type 'SoSwitch *' at 0x11cc1f660> >, ')')('[Draft.todo.tasks] Unexpected error:', <type 'exceptions.RuntimeError'>, 'in ', <bound method lineTracker._insertSwitch of <DraftTrackers.lineTracker instance at 0x11cc18ef0>>, '(', <pivy.coin.SoSwitch; proxy of <Swig Object of type 'SoSwitch *' at 0x11cc1f8d0> >, ')')('[Draft.todo.tasks] Unexpected error:', <type 'exceptions.RuntimeError'>, 'in ', <bound method radiusTracker._insertSwitch of <DraftTrackers.radiusTracker instance at 0x11cc18ea8>>, '(', <pivy.coin.SoSwitch; proxy of <Swig Object of type 'SoSwitch *' at 0x11cc1fb70> >, ')')Running the Python command 'Draft_ShapeString' failed:
Traceback (most recent call last):
File "/Applications/FreeCAD.app/Contents/Mod/Draft/DraftTools.py", line 1803, in Activated
Creator.Activated(self,name)
File "/Applications/FreeCAD.app/Contents/Mod/Draft/DraftTools.py", line 427, in Activated
DraftTool.Activated(self)
File "/Applications/FreeCAD.app/Contents/Mod/Draft/DraftTools.py", line 245, in Activated
rot = self.view.getCameraNode().getField("orientation").getValue()
Any ideas? It would be nice to get this working.
('[Draft.todo.tasks] Unexpected error:', <type 'exceptions.RuntimeError'>, 'in ', <bound method snapTracker._insertSwitch of <DraftTrackers.snapTracker instance at 0x11cc18cf8>>, '(', <pivy.coin.SoSwitch; proxy of <Swig Object of type 'SoSwitch *' at 0x11cc1f660> >, ')')('[Draft.todo.tasks] Unexpected error:', <type 'exceptions.RuntimeError'>, 'in ', <bound method lineTracker._insertSwitch of <DraftTrackers.lineTracker instance at 0x11cc18ef0>>, '(', <pivy.coin.SoSwitch; proxy of <Swig Object of type 'SoSwitch *' at 0x11cc1f8d0> >, ')')('[Draft.todo.tasks] Unexpected error:', <type 'exceptions.RuntimeError'>, 'in ', <bound method radiusTracker._insertSwitch of <DraftTrackers.radiusTracker instance at 0x11cc18ea8>>, '(', <pivy.coin.SoSwitch; proxy of <Swig Object of type 'SoSwitch *' at 0x11cc1fb70> >, ')')Running the Python command 'Draft_ShapeString' failed:
Traceback (most recent call last):
File "/Applications/FreeCAD.app/Contents/Mod/Draft/DraftTools.py", line 1803, in Activated
Creator.Activated(self,name)
File "/Applications/FreeCAD.app/Contents/Mod/Draft/DraftTools.py", line 427, in Activated
DraftTool.Activated(self)
File "/Applications/FreeCAD.app/Contents/Mod/Draft/DraftTools.py", line 245, in Activated
rot = self.view.getCameraNode().getField("orientation").getValue()
Any ideas? It would be nice to get this working.
Re: Draft.ShapeString
As a workaround you can try:
Code: Select all
import Draft
Draft.makeShapeString("Hello World!","Your_Font.ttf")