Create 3D text on curved surface

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
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!
andre
Posts: 96
Joined: Wed Nov 13, 2013 5:34 am

Create 3D text on curved surface

Postby andre » Sat Feb 15, 2014 2:19 am

Any quick tips on how to get this done? I'm Ok with creating planar text and extruding via Draft , then Part tool bench. Would like to create something like a wrist band with a name on it.
andre
Posts: 96
Joined: Wed Nov 13, 2013 5:34 am

Re: Create 3D text on curved surface

Postby andre » Sat Feb 15, 2014 5:43 pm

To add, is there a similar function to wrap a sketch onto a curved surface? Similar to how Solidworks handles this

Image
ulrich1a
Posts: 1920
Joined: Sun Jul 07, 2013 12:08 pm

Re: Create 3D text on curved surface

Postby ulrich1a » Sat Feb 15, 2014 7:53 pm

Is this post a possible solution?
viewtopic.php?f=3&t=5360#p42769

Ulrich
andre
Posts: 96
Joined: Wed Nov 13, 2013 5:34 am

Re: Create 3D text on curved surface

Postby andre » Sat Feb 15, 2014 9:38 pm

I'll give it a try, thanks for the link.

My current version does not have make...Projection. Seems this may be a newer build/commit. I'm on 2778 unfortunately.

"AttributeError: 'Part.TopoShape' object has no attribute 'makeCylindricalProjection'"

OS: Windows 7
Platform: 64-bit
Version: 0.14.2778 (Git)
Branch: master
Hash: 0506a918b24e015ac6277a7cf613ce151e1dee44
Python version: 2.6.4
Qt version: 4.5.3
Coin version: 2.4.5a
SoQt version: 1.4.1
OCC version: 6.3.0
User avatar
wandererfan
Posts: 3333
Joined: Tue Nov 06, 2012 5:42 pm

Re: Create 3D text on curved surface

Postby wandererfan » Sun Feb 16, 2014 2:48 pm

andre wrote:"AttributeError: 'Part.TopoShape' object has no attribute 'makeCylindricalProjection'"
try "makeParallelProjection" ?
andre
Posts: 96
Joined: Wed Nov 13, 2013 5:34 am

Re: Create 3D text on curved surface

Postby andre » Mon Feb 17, 2014 1:13 am

I don't have any make***Projection listed for the function...
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Create 3D text on curved surface

Postby NormandC » Mon Feb 17, 2014 2:28 am

wandererfan, check Andre's version in his third reply. Revision 2778 is pretty old and predates wmayer's commit which was added in January.
andre
Posts: 96
Joined: Wed Nov 13, 2013 5:34 am

Re: Create 3D text on curved surface

Postby andre » Mon Feb 17, 2014 4:30 am

The January commit hasn't been compiled/released for win64 yet correct? I don't have access to compile the latest master branch, rather would be easier to just pick the latest available release. Seems like 2778 is the latest version downloadable at the moment.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Create 3D text on curved surface

Postby NormandC » Mon Feb 17, 2014 4:54 am

normandc wrote:Revision 2778 is pretty old and predates wmayer's commit
There is no other Windows version more recent.
User avatar
mangtronix
Posts: 44
Joined: Fri Apr 18, 2014 3:58 am
Location: Berlin, Germany
Contact:

Re: Create 3D text on curved surface

Postby mangtronix » Fri Jul 25, 2014 2:09 pm

I'm also trying to put extruded text around a 3D surface (a cylinder, to start).

Here's as far as I got:
https://gist.github.com/mangtronix/0b5010766d105874a3d5

Code: Select all

import Part, Draft
from FreeCAD import Base
v=Base.Vector
doc=App.ActiveDocument

font="/Users/mangtronix/src/blender/release/datafiles/bfont.ttf"

# ShapeString text
ss=Draft.makeShapeString(String=u"Hi",FontFile=font,Size=2.0,Tracking=0)

# Circle at text center
c=Part.makeCircle(2,ss.Shape.BoundBox.Center,v(0,0,1))

s=Part.makeCylinder(4,10, v(1,-3,-10), v(0,1,0))
f=s.Face1
p=f.makeParallelProjection(c,v(0,0,1))

sf = doc.addObject("Part::Feature","Cylinder")
sf.Shape = s
pf = doc.addObject("Part::Feature","Circle projection")
pf.Shape = p
cf = doc.addObject("Part::Feature","Circle")
cf.Shape = c

sp=None
try:
    sp=f.makeParallelProjection(ss.Shape,v(0,0,1))
    # XXX this generates this traceback
    # Traceback (most recent call last):
    #   File "<input>", line 1, in <module>
    # Exception: /Users/family/FreeCAD-deps/oce-src/src/BRepProj/BRepProj_Projection.cxx: projected shape is neither wire nor edge
    spf = App.ActiveDocument.addObject("Part::Feature", "Text projection")
    spf.Shape = sp
    
except Exception,e:
    FreeCAD.Console.PrintWarning(e)

    
def projectAndFuseWires(face, shape, dir):
    projected_wires = []
    for wire in shape.Wires:
        projected_wires.append(face.makeParallelProjection(wire, dir))
        
    fused = projected_wires[0]
    for wire in projected_wires[1:]:
        fused = fused.fuse(wire)
        
    return fused

fused = projectAndFuseWires(s, ss.Shape, v(0,0,1))
fused_feature = doc.addObject("Part::Feature", "Fused projections")
fused_feature.Shape = fused

h_wire = ss.Shape.Wires[0]
projected_wires = f.makeParallelProjection(h_wire,v(0,0,1))
front_projected_wire = projected_wires.Wires[1]
front_feature = doc.addObject("Part::Feature", "Front projected H")
front_feature.Shape = front_projected_wire

extrusion = doc.addObject("Part::Extrusion", "Extruded H")
extrusion.Base = front_feature
extrusion.Dir = v(0,0,1) # XXX doesn't actually make a solid
extrusion.Solid = True

 
I wasn't able to directly project the ShapeString Shape so I tried projecting each wire individually. I wasn't able to extrude a solid from the "Front projected H" shape. If anyone has some clues maybe I can get further :)

OS: Mac OS X
Word size: 64-bit
Version: 0.14.3703 (Git)
Branch: releases/FreeCAD-0-14
Hash: c6edd47334a3e6f209e493773093db2b9b4f0e40
Python version: 2.7.5
Qt version: 4.8.6
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.7.0
Attachments
Screen Shot 2014-07-25 at 4.04.33 PM.png
Screen Shot 2014-07-25 at 4.04.33 PM.png (23.16 KiB) Viewed 8295 times
http://michaelang.com - Art / Engineering