RSS/Atom feed Twitter
Site is read-only, email is disabled

gimp-vectors-stroke-get-length

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

gimp-vectors-stroke-get-length dorai iyer 28 Feb 01:43
  gimp-vectors-stroke-get-length David Gowers 28 Feb 04:17
  gimp-vectors-stroke-get-length saulgoode@flashingtwelve.brickfilms.com 28 Feb 04:42
   gimp-vectors-stroke-get-length dorai iyer 28 Feb 05:43
dorai iyer
2008-02-28 01:43:41 UTC (almost 17 years ago)

gimp-vectors-stroke-get-length

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.

David Gowers
2008-02-28 04:17:54 UTC (almost 17 years ago)

gimp-vectors-stroke-get-length

On Thu, Feb 28, 2008 at 11:13 AM, dorai iyer wrote:

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)

.. stroke1 is the unbound variable. Why would it exist? You never create it.

The following is more correct

nstrokes, strokes = pdb.gimp_vectors_get_strokes(vectors) len0 = pdb.gimp_vectors_stroke_get_length(vectors, strokes[0], 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.

saulgoode@flashingtwelve.brickfilms.com
2008-02-28 04:42:10 UTC (almost 17 years ago)

gimp-vectors-stroke-get-length

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))
)

Quoting dorai iyer :

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.

dorai iyer
2008-02-28 05:43:00 UTC (almost 17 years ago)

gimp-vectors-stroke-get-length

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.