fix runtime error creating a wire from string with python3
Tested against version 0.17
This commit is contained in:
committed by
Yorik van Havre
parent
adfa72051f
commit
9c17bc53c3
@@ -6133,8 +6133,10 @@ class _ShapeString(_DraftObject):
|
||||
ff8 = obj.FontFile.encode('utf8') # 1947 accents in filepath
|
||||
# TODO: change for Py3?? bytes?
|
||||
# Part.makeWireString uses FontFile as char* string
|
||||
# CharList = Part.makeWireString(obj.String,obj.FontFile,obj.Size,obj.Tracking)
|
||||
CharList = Part.makeWireString(obj.String,ff8,obj.Size,obj.Tracking)
|
||||
if sys.version_info.major < 3:
|
||||
CharList = Part.makeWireString(obj.String,ff8,obj.Size,obj.Tracking)
|
||||
else:
|
||||
CharList = Part.makeWireString(obj.String,obj.FontFile,obj.Size,obj.Tracking)
|
||||
if len(CharList) == 0:
|
||||
msg(translate("draft","ShapeString: string has no wires\n"), 'warning')
|
||||
return
|
||||
@@ -6142,8 +6144,7 @@ class _ShapeString(_DraftObject):
|
||||
|
||||
# test a simple letter to know if we have a sticky font or not
|
||||
sticky = False
|
||||
# testWire = Part.makeWireString("L",obj.FontFile,obj.Size,obj.Tracking)[0][0]
|
||||
testWire = Part.makeWireString("L",ff8,obj.Size,obj.Tracking)[0][0]
|
||||
testWire = Part.makeWireString("L",obj.FontFile,obj.Size,obj.Tracking)[0][0]
|
||||
if testWire.isClosed:
|
||||
try:
|
||||
testFace = Part.Face(testWire)
|
||||
|
||||
@@ -2204,7 +2204,7 @@ class ShapeString(Creator):
|
||||
#print("debug: D_T ShapeString.createObject type(self.SString): " str(type(self.SString)))
|
||||
|
||||
dquote = '"'
|
||||
if type(self.SString) == unicode: # Python3: no more unicode
|
||||
if sys.version_info.major < 3: # Python3: no more unicode
|
||||
String = 'u' + dquote + self.SString.encode('unicode_escape') + dquote
|
||||
else:
|
||||
String = dquote + self.SString + dquote
|
||||
|
||||
Reference in New Issue
Block a user