[Gimp-user] gimp-vectors-stroke-get-length

dorai iyer dorai.iyer at gmail.com
Wed Feb 27 20:43:00 PST 2008


David, Saul,
Thank you very much for the help. The corrected python code works and so
does the scheme code.


Your Python code would seem to define 'strokes' but then access
> 'stroke1'. Unless 'stroke1' is defined somewhere else I should suspect
> this to be problematic. (I could be missing something as I never use
> Python.)
>
> Your Scheme code looks fine except for the fact that
> 'gimp-vectors-stroke-get-length' returns a list containing just a
> single item, the length. Use 'car' instead of 'caddr' and your code
> should work.
>
> (let* (
>     (count 0)
>     (vector (car(gimp-image-get-active-vectors img)))
>     (strokes (cadr(gimp-vectors-get-strokes vector)))
>      (len (car(gimp-vectors-stroke-get-length vector
>                                                 (aref strokes count)
>                                                100.0))))
>   (print (list len vector))
>    )
>
>
>
>
> > Hi,
> > I am trying to draw a vector ( as a single polygonal line) and then
> stroke
> > it and measure its length using
> > gimp-vectors-stroke-get-length.
> >
> > So I first used python to try to do it. Here is the script
> > def vector_length(image, drawable):
> >     vectors = pdb.gimp_image_get_active_vectors(image)
> >     strokes = pdb.gimp_vectors_get_strokes(vectors)
> >     len1 = pdb.gimp_vectors_stroke_get_length(vectors, stroke1, 100.0)
> > the vectors and strokes went fine but I could not get the length
> >
> > I then thought maybe I should try using tinyscheme and tried the
> following
> >   (let* (
> >         (count 0)
> >         (vector (car(gimp-image-get-active-vectors img)))
> >         (strokes (cadr(gimp-vectors-get-strokes vector)))
> >         (len (caddr(gimp-vectors-stroke-get-length vector (aref strokes
> > count) 100.0)))
> >      )
> >     (print (list len vector))
> > I still get an unbound variable error. a search fo previous
> implementations
> > did not show much. Has anyone used
> > gimp-vectors-stroke-get-length
> > in either scm or python successfully and can help resolve my problem. I
> am
> > more familaiar with python then tinyscheme but not adept at either which
> is
> > probably clearly reflected in my programming.
> > Thanks for the help.
> >
>
>
>
> _______________________________________________
> Gimp-user mailing list
> Gimp-user at lists.XCF.Berkeley.EDU
> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /lists/gimp-user/attachments/20080227/bb34bc32/attachment.html 


More information about the Gimp-user mailing list