[Merged] Draft.ShapeString

Merged, abandoned or rejected pull requests are moved here to clear the main Pull Requests forum.
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Draft.ShapeString

Post by wandererfan »

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.
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft.ShapeString

Post by yorik »

wandererfan wrote:I want to put a selector in the properties editor, but I haven't figured out how the editor works yet.
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.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Draft.ShapeString

Post by NormandC »

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.
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Draft.ShapeString

Post by wmayer »

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.
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:
Sorry, ShapeString is not yet fully implemented for your platform.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Draft.ShapeString

Post by NormandC »

Even with freetype installed? I think it would be necessary to implement it for Windows before official release...
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Draft.ShapeString

Post by wmayer »

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.
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Draft.ShapeString

Post by wmayer »

Creating the FreeType library under Windows was fine but I keep getting linker errors when I try to link with FreeCAD.
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Draft.ShapeString

Post by wmayer »

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.
vnks
Posts: 11
Joined: Tue Jun 11, 2013 2:04 am

Re: Draft.ShapeString

Post by vnks »

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.
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Draft.ShapeString

Post by wmayer »

As a workaround you can try:

Code: Select all

import Draft
Draft.makeShapeString("Hello World!","Your_Font.ttf")
Post Reply