Question

I have changed the code a little bit and add print d and print i to keep tracking the execution but it doesn't increment after the first iteration the length of path_strings is 29

from svg.path import parse_path, Line, Arc, CubicBezier, QuadraticBezier
import numpy as np
import pylab as pl
from xml.dom import minidom

doc = minidom.parse("C:\Users\DELL\Desktop\drawing(1).svg")
path_strings = [path.getAttribute('d') for path in doc.getElementsByTagName('path')]
doc.unlink()

b = len(path_strings)
X = []
Y = []
d = 0

while d <= b:
    path1 = parse_path(path_strings[d])   
    a = np.arange(0,1.01,0.01)   
    print d
    d = d+1
    for i in a: 
        print i
        X.append(path1.point(i).real)
        Y.append(path1.point(i).imag)

pl.scatter(X,Y)
pl.show()

it gives :

>>> ================================ RESTART ================================
>>>
0
0.0

Sorry for the bad format of my post I am just a newbie here and thanks for help Carlo

Was it helpful?

Solution

yep i found out that i am enough stupid to put the parameter <=b which equal to 29 in fact if the length is 29 so the d parameter must go from zero up to 28 and not 29 and this what make the index problem appears thank you everybody for not helping :) my robotic arm is finally working

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top