Fix file, long, raw_input, and xrange for Python 3
This commit is contained in:
@@ -98,7 +98,7 @@ def read(filename):
|
||||
verts.append([d_point[0],d_point[1],d_point[2]])
|
||||
meshdata = []
|
||||
for d_face in d_nobj.obj.faces.array:
|
||||
meshdata.append([verts[int(d_face[i])] for i in xrange(3)])
|
||||
meshdata.append([verts[int(d_face[i])] for i in range(3)])
|
||||
m = [tuple(r) for r in d_nobj.obj.matrix.array]
|
||||
m = m[0] + m[1] + m[2] + m[3]
|
||||
placement = FreeCAD.Placement(FreeCAD.Matrix(*m))
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
from six.moves import xrange
|
||||
|
||||
import FreeCAD, Mesh, os, numpy, MeshPart, Arch, Draft
|
||||
if FreeCAD.GuiUp:
|
||||
from DraftTools import translate
|
||||
|
||||
@@ -40,6 +40,11 @@ import sys
|
||||
import math,FreeCAD
|
||||
from FreeCAD import Vector, Matrix
|
||||
|
||||
try:
|
||||
long
|
||||
except NameError:
|
||||
long = int
|
||||
|
||||
params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
||||
def precision():
|
||||
return params.GetInt("precision",6)
|
||||
|
||||
@@ -16,7 +16,14 @@ but random access is not allowed."""
|
||||
import struct, sys, time, os
|
||||
import zlib
|
||||
import io
|
||||
import __builtin__
|
||||
|
||||
from six.moves import xrange
|
||||
from six.moves.builtins import open as builtin_open
|
||||
|
||||
try:
|
||||
long
|
||||
except NameError:
|
||||
long = int
|
||||
|
||||
__all__ = ["GzipFile","open"]
|
||||
|
||||
@@ -99,7 +106,7 @@ class GzipFile(io.BufferedIOBase):
|
||||
if mode and 'b' not in mode:
|
||||
mode += 'b'
|
||||
if fileobj is None:
|
||||
fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
|
||||
fileobj = self.myfileobj = builtin_open(filename, mode or 'rb')
|
||||
if filename is None:
|
||||
# Issue #13781: os.fdopen() creates a fileobj with a bogus name
|
||||
# attribute. Avoid saving this in the gzip header's filename field.
|
||||
@@ -504,13 +511,13 @@ def _test():
|
||||
print("filename doesn't end in .gz:", repr(arg))
|
||||
continue
|
||||
f = open(arg, "rb")
|
||||
g = __builtin__.open(arg[:-3], "wb")
|
||||
g = builtin_open(arg[:-3], "wb")
|
||||
else:
|
||||
if arg == "-":
|
||||
f = sys.stdin
|
||||
g = GzipFile(filename="", mode="wb", fileobj=sys.stdout)
|
||||
else:
|
||||
f = __builtin__.open(arg, "rb")
|
||||
f = builtin_open(arg, "rb")
|
||||
g = open(arg + ".gz", "wb")
|
||||
while True:
|
||||
chunk = f.read(1024)
|
||||
|
||||
@@ -24,6 +24,11 @@ __title__="FreeCAD OpenSCAD Workbench - Parametric Features"
|
||||
__author__ = "Sebastian Hoogen"
|
||||
__url__ = ["http://www.freecadweb.org"]
|
||||
|
||||
try:
|
||||
long
|
||||
except NameError:
|
||||
long = int
|
||||
|
||||
'''
|
||||
This Script includes python Features to represent OpenSCAD Operations
|
||||
'''
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from six.moves import xrange
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from six.moves import xrange
|
||||
|
||||
import FreeCAD
|
||||
import MeshPart
|
||||
# import Part
|
||||
|
||||
Reference in New Issue
Block a user