<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.inkscape.org/wiki/index.php?action=history&amp;feed=atom&amp;title=SpecCommandLineDrawing%2FDraftSubmodule</id>
	<title>SpecCommandLineDrawing/DraftSubmodule - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.inkscape.org/wiki/index.php?action=history&amp;feed=atom&amp;title=SpecCommandLineDrawing%2FDraftSubmodule"/>
	<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=SpecCommandLineDrawing/DraftSubmodule&amp;action=history"/>
	<updated>2026-04-28T08:27:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=SpecCommandLineDrawing/DraftSubmodule&amp;diff=42234&amp;oldid=prev</id>
		<title>Inductiveload: New page: *Return to SpecCommandLineDrawing  This module specifies the method for drawing an SVG object from parameters entered by the &quot;command line&quot;. It contains: #A dictionary holding possible...</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=SpecCommandLineDrawing/DraftSubmodule&amp;diff=42234&amp;oldid=prev"/>
		<updated>2009-01-21T01:45:13Z</updated>

		<summary type="html">&lt;p&gt;New page: *Return to &lt;a href=&quot;/wiki/SpecCommandLineDrawing&quot; title=&quot;SpecCommandLineDrawing&quot;&gt;SpecCommandLineDrawing&lt;/a&gt;  This module specifies the method for drawing an SVG object from parameters entered by the &amp;quot;command line&amp;quot;. It contains: #A dictionary holding possible...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;*Return to [[SpecCommandLineDrawing]]&lt;br /&gt;
&lt;br /&gt;
This module specifies the method for drawing an SVG object from parameters entered by the &amp;quot;command line&amp;quot;. It contains:&lt;br /&gt;
#A dictionary holding possible parameters (except general style paramters - these are found in the [[SpecCommandLineDrawing/DraftAssDir|global association module]]), along with the type of the parameter and the default value, which will be used if the user doesn't specify. For example, if the user enters &amp;lt;tt&amp;gt;circle r:50&amp;lt;/tt&amp;gt;, the circle will be centred at &amp;lt;tt&amp;gt;(0,0)&amp;lt;/tt&amp;gt;.&lt;br /&gt;
#A function called &amp;lt;tt&amp;gt;draw_SVG()&amp;lt;/tt&amp;gt;, which puts the parameters into the correct position in the SVG, and draws it using, in this case, the inkex helper module.&lt;br /&gt;
#A function used to perform overrides for redundant parameters. For example, in the circle case, the radius only is used in drawing the circle. However, if the user enters a diameter and not radius, the default radius (100) would be used unless this function sets the radius to the diameter/2.&lt;br /&gt;
&lt;br /&gt;
==Draft Code==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python &lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
######DESCRIPTION######&lt;br /&gt;
&lt;br /&gt;
This script contains routines for drawing circles using command line parameters&lt;br /&gt;
formatted by command_line.py&lt;br /&gt;
&lt;br /&gt;
import inkex, simplestyle&lt;br /&gt;
import command_line&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
command_dictionary = { 'circle':{&lt;br /&gt;
                    'r':{'t':'scalar',  'd':100},   #radius     if r given, overrides diameter&lt;br /&gt;
                    'd':{'t':'scalar'},             #diameter   &lt;br /&gt;
                    'c':{'t':'point' ,  'd':(0,0)} #centre     uses the inkscape position, if given&lt;br /&gt;
              }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def draw_SVG(params, parent):&lt;br /&gt;
    style = command_line.create_SVG_style_dict(params)&lt;br /&gt;
 &lt;br /&gt;
    attribs = {'style':simplestyle.formatStyle(style),&lt;br /&gt;
                'cx':           str(params['c'][0]),&lt;br /&gt;
                'cy':           str(params['c'][1]),&lt;br /&gt;
                'r':            str(params['r'])&lt;br /&gt;
            }&lt;br /&gt;
    inkex.etree.SubElement(parent, inkex.addNS('circle','svg'), attribs )&lt;br /&gt;
&lt;br /&gt;
def set_defaults(params):&lt;br /&gt;
&lt;br /&gt;
	#r overrides d&lt;br /&gt;
	if 'd' in params and 'r' not in params: &lt;br /&gt;
		params['r'] = params['d']/2.0&lt;br /&gt;
&lt;br /&gt;
	return&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Inductiveload</name></author>
	</entry>
</feed>