Try this script from LIMN. Don't remember where I got it, but it appears to do what you want. It's found under Shapes > Polygon... Couldn't find the "Insert Code" feature so make sure you copy and paste all of the information below.
;Draw a polygon with the desired radius and sides (lines)
;Has some filling and stroking options
;For the latest version, email me at <
[email protected]>
(define (script-fu-polygon img segs radius visible stroke brush gradient-length gradient fill type gradient2)
(let* (
(temp 0)
(points (cons-array (* segs 6) 'double))
(pure_points (cons-array (+ (* segs 2) 2) 'double))
(count 0)
(angle (/ 360 segs))
(pointx 0)
(pointy 0)
(vectors (car(gimp-vectors-new img (string-append (number->string segs) " Sided Polygon"))))
(centerx (/ (car(gimp-image-width img)) 2))
(centery (/ (car(gimp-image-height img)) 2))
(layer 0)
)
(gimp-context-push)
;undo group
(gimp-image-undo-group-start img)
(gimp-selection-none img)
(gimp-image-add-vectors img vectors -1)
;(print (pointx pointy))
(while (< count segs)
(begin
(set! pointx (* radius (sin (/ (* angle count *pi*) 180))))
(set! pointy (* radius (cos (/ (* angle count *pi*) 180))))
;(print (pointx pointy))
(aset points (* 6 count) pointx)
(aset points (+ (* 6 count) 1) pointy)
(aset points (+ (* 6 count) 2) pointx)
(aset points (+ (* 6 count) 3) pointy)
(aset points (+ (* 6 count) 4) pointx)
(aset points (+ (* 6 count) 5) pointy)
(aset pure_points (* 2 count) (+ centerx pointx))
(aset pure_points (+ 1 (* 2 count)) (- centery pointy))
(set! count (+ 1 count))
;(print (pointx pointy))
))
(aset pure_points (* 2 segs) (aref pure_points 0))
(aset pure_points (+ 1 (* 2 count)) (aref pure_points 1))
(set! temp (car(gimp-vectors-stroke-new-from-points vectors 0 (* 6 segs) points TRUE)))
(gimp-vectors-stroke-translate vectors temp centerx centery)
(gimp-vectors-stroke-flip vectors temp 1 centery) ;Flip vertically since it looks upside-down when using an ood number of segments
(gimp-vectors-set-visible vectors visible)
(if (or (= stroke 1) (= fill 1))
(begin
(set! temp (car(gimp-layer-new img (* centerx 2) (* centery 2) 1 (string-append (number->string segs) " Sided Polygon") 100 0)))
(gimp-image-add-layer img temp -1)
(gimp-edit-clear temp)
))
(if (= fill 1)
(begin
(gimp-vectors-to-selection vectors 2 TRUE FALSE 0 0)
(if (= 0 type)
(gimp-edit-bucket-fill temp 1 0 100 255 FALSE centerx centery) )
(if (not (= 0 type))
(begin
(gimp-context-set-gradient gradient2)
(gimp-edit-blend temp 3 0 (+ type 5) 100 0 FALSE FALSE FALSE 0 0 FALSE 0 0 1 1) ))
(gimp-selection-none img)
))
(if (= stroke 1)
(begin
(gimp-context-set-brush (car brush))
(gimp-brush-set-spacing (car brush) (caddr brush))
(gimp-context-set-gradient gradient)
(gimp-paintbrush temp FALSE (+ 2 (* segs 2)) pure_points 0 gradient-length)
;(gimp-edit-stroke-vectors (car(gimp-image-get-active-drawable img)) vectors)
))
;end of undo group
(gimp-image-undo-group-end img)
(gimp-context-pop)
;Refresh View
(gimp-displays-flush)
))
(script-fu-register
"script-fu-polygon"
"<Image>/Shapes/Polygon..."
"Draw a new polygon path"
"LightningIsMyName (LIMN)"
"LightningIsMyName (LIMN)"
"March 2008"
""
SF-IMAGE "Image" 0
SF-ADJUSTMENT "Sides" '(5 3 1000 1 10 0 1)
SF-ADJUSTMENT "Radius (Size)" '(200 0.1 10000 1 10 0 1)
SF-TOGGLE "Make the new path Visible" TRUE
SF-TOGGLE "Stroke the shape (path)" FALSE
SF-BRUSH "Brush for stroking" '("Circle (03)" 100 1 0)
SF-VALUE "Gradient length for stroking (0=Use ForeGround Color instead)" "0"
SF-GRADIENT "Gradient for stroking" "FG to BG (RGB)"
SF-TOGGLE "Fill the shape (path)" FALSE
SF-OPTION "Fill Method" '("BackGround Color" "Shaped (angular) Gradient" "Shaped (spherical) Gradient" "Shaped (dimpled) Gradient")
SF-GRADIENT "Gradient for Filling" "FG to BG (RGB)"
)