File:Cylindrical magnet.svg
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this PNG preview of this SVG file: 616 × 216 pixels. Other resolutions: 320 × 112 pixels | 640 × 224 pixels | 1,024 × 359 pixels | 1,280 × 449 pixels | 2,560 × 898 pixels.
Original file (SVG file, nominally 616 × 216 pixels, file size: 2 KB)
File information
Structured data
Captions
Summary
[edit]DescriptionCylindrical magnet.svg | |
Date | |
Source | Own work |
Author | Geek3 |
Other versions | File:VFPt cylindrical magnet.svg (with field lines) |
SVG development InfoField | |
Source code InfoField | Python code#!/usr/bin/python
# -*- coding: utf8 -*-
try:
import svgwrite as svg
except ImportError:
print 'requires svgwrite library: http://pypi.python.org/pypi/svgwrite/'
exit(1)
name = 'Cylindrical_magnet'
w, h = 616, 216
lw = 16
l, r = (w - lw) / 2., (h - lw) / 2.
# document
doc = svg.Drawing(name + '.svg', size=(w, h))
doc.set_desc(title=name,
desc='about: http://commons.wikimedia.org/wiki/File:{0}.svg'.format(name))
doc['stroke'] = 'black'
doc['stroke-linejoin'] = 'miter'
magnet = doc.add(doc.g(id='magnet', transform='translate({0},{1})'.format(w/2., h/2.)))
# green and red areas
magnet.add(doc.rect(insert=(-l, -r), size=(2*l, 2*r),
fill='#00cc00', stroke='none'))
magnet.add(doc.rect(insert=(0, -r), size=(l, 2*r),
fill='#ff0000', stroke='none'))
# light reflection gradient overlay
grad = doc.defs.add(doc.linearGradient(id='gradient',
x1=0, x2=0, y1=-r, y2=r, gradientUnits='userSpaceOnUse'))
for col, of, opa in [['#000000', '0', '0.125'],
['#ffffff', '0.07', '0.125'], ['#ffffff', '0.25', '0.5'],
['#ffffff', '0.6', '0.2'], ['#000000', '1', '0.33']]:
grad.add_stop_color(offset=of, color=col, opacity=opa)
# frame
magnet.add(doc.rect(insert=(-l, -r), size=(2*l, 2*r),
style='fill:url(#gradient); stroke-width:{0}; stroke-linejoin:miter; stroke:#000000'.format(lw)))
# S and N labels
S = doc.text('S', insert=(0, 0),
transform='translate({0},{1}) scale({2},{2})'.format(
-0.65 * l, 0.44 * r, r / 100.))
N = doc.text('N', insert=(0, 0),
transform='translate({0},{1}) scale({2},{2})'.format(
0.65 * l, 0.44 * r, r / 100.))
text_attr = {'text-anchor':'middle',
'style':'fill:#000000; stroke:none; ' +
'font-size:120px; font-family:Bitstream Vera Sans'}
for k, v in text_attr.iteritems():
S[k] = v
N[k] = v
magnet.add(S)
magnet.add(N)
doc.save()
try:
import xml.dom.minidom
xml = xml.dom.minidom.parse(name + '.svg')
with open(name + '.svg', 'w') as svg_file:
svg_file.write(xml.toprettyxml(indent=' '))
except ImportError: pass
|
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following licenses:
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
This file is licensed under the Creative Commons Attribution 3.0 Unported license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
You may select the license of your choice.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 19:57, 23 May 2015 | 616 × 216 (2 KB) | Geek3 (talk | contribs) | Cylindrical_magnet image by Geek3 |
You cannot overwrite this file.
File usage on Commons
The following 6 pages use this file:
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Short title | cylindrical_magnet |
---|---|
Image title | about: http://commons.wikimedia.org/wiki/File:cylindrical_magnet.svg |
Width | 616 |
Height | 216 |