JMG1 / ExplodedAssembly

FreeCAD workbench to create exploded views and animations of assemblies
GNU Lesser General Public License v2.1
115 stars 27 forks source link

name 'xrange' is not definedRunning the Python command 'CreateSimpleGroup' failed #10

Closed morganrallen closed 5 years ago

morganrallen commented 5 years ago

Hello, trying to get started with Exploded Assembly but it doesn't look like it's working with FreeCAD 0.18.1

name 'xrange' is not definedRunning the Python command 'CreateSimpleGroup' failed:
Traceback (most recent call last):
  File "/home/morgan/.FreeCAD/Mod/ExplodedAssembly/EAInit.py", line 71, in Activated
    ea.createSimpleDisassemble()
  File "/home/morgan/.FreeCAD/Mod/ExplodedAssembly/ExplodedAssembly.py", line 249, in createSimpleDisassemble
    updateTrajectoryLines()
  File "/home/morgan/.FreeCAD/Mod/ExplodedAssembly/ExplodedAssembly.py", line 627, in updateTrajectoryLines
    for s in xrange(len(objects)):

name 'xrange' is not defined
OS: Ubuntu 18.10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.1.
Build type: Release
Python version: 3.6.7
Qt version: 5.11.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

Let me know if there is any additional info I can provide.

morganrallen commented 5 years ago

Oh! It turns out this is simply python 3 not having xrange

I found this reference on Python Central website.

One more thing to add. In Python 3.x, the xrange function does not exist anymore. The range function now does what xrange does in Python 2.x, so to keep your code portable, you might want to stick to using range instead.

Changing all calls to xrange to range was enough to make it work.

JMG1 commented 5 years ago

Solved with 562c05f