'''
Copyright (C) 2007 John Beard john.j.beard@gmail.com
##This extension allows you to draw a Cartesian grid in Inkscape.
##There is a wide range of options including subdivision, subsubdivions
## and logarithmic scales. Custom line widths are also possible.
##All elements are grouped with similar elements (eg all x-subdivs)
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
'''
import inkex
from math import *
help="Major X Divisions")
help="Major X divison Spacing")
help="Subdivisions per Major X division")
help="Logarithmic x subdivisions if true")
help="Subsubdivisions per Minor X division")
help="Halve Subsubdiv. Frequency after 'n' Subdivs. (log only)")
help="Major X Division Line thickness")
help="Minor X Division Line thickness")
help="Subminor X Division Line thickness")
help="Major Y Divisions")
help="Major Gridline Increment")
help="Minor Divisions per Major Y division")
help="Logarithmic y subdivisions if true")
help="Subsubdivisions per Minor Y division")
help="Halve Y Subsubdiv. Frequency after 'n' Subdivs. (log only)")
help="Major Y Division Line thickness")
help="Minor Y Division Line thickness")
help="Subminor Y Division Line thickness")
help="Border Line thickness")
#find the pixel dimensions of the overall grid
# Embed grid in group
#Put in in the centre of the current view
'transform':t }
#Group for major x gridlines
#Group for major y gridlines
#Group for minor x gridlines
#Group for subminor x gridlines
#Group for minor y gridlines
#Group for subminor y gridlines
#DO THE X DIVISONS======================================
if i>0: #dont draw first line (we made a proper border)
if j>1: #the first loop is only for subsubdivs
if (j <= self.options.x_half_freq) or (k%2 == 0):#only draw half the subsubdivs past the half-freq point
if (ssd%2 > 0) and (j > self.options.y_half_freq): #half frequency won't work with odd numbers of subsubdivs,
else:
else: #linear x subdivs
if j>0: #not for the first loop (this loop is for the subsubdivs before the first subdiv)
#DO THE Y DIVISONS========================================
if i>0:#dont draw first line (we will make a border)
if j>1: #the first loop is only for subsubdivs
if (j <= self.options.y_half_freq) or (k%2 == 0):#only draw half the subsubdivs past the half-freq point
if (ssd%2 > 0) and (j > self.options.y_half_freq): #half frequency won't work with odd numbers of subsubdivs,
else:
else: #linear y subdivs
if j>0:#not for the first loop (this loop is for the subsubdivs before the first subdiv)
if __name__ == '__main__':
e = Grid_Polar()
e.affect()
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99