Quantcast
Channel: fritzing forum - Latest posts
Viewing all articles
Browse latest Browse all 28182

Resistor-array?

$
0
0

Glad to hear that it works out that well! :blush:

It is really easy to do those things in Python once you figured it out one time. It's only a bit tedious to convert the svg into this “dynamic“ format. I'm using a library to generate those svgs (called svgwrite). There are however a few things to watch out for:

  • The library is really strict about the syntax. So the extra fritzing-tags aren't possible. What I'm doing is placing the gorn-attributevalues as classes and later rereading the file and replacing class with gorn.
  • I'm not sure, why there are no linebreaks. I noticed it, too. I guess the library doesn't generate some. If it's a real issue I could add a quick fix and insert linebreaks after each tag upon rereading the file. Adding the correct indentation could be hard however (alternatively I could search for a XML-tidier, should exist already).

To run this script (assuming you have python installed), firstly you need to install svgwrite e.g. via pip install svgwrite. Then running python r-array-gen.py should do the trick. Currently the last five lines generate the actual output. I'm planning once whole parts are created to change it that you could pass parameters via the terminal into the script. E.g. r-array-gen.py -star -r 5.

Thanks again for your help! If this works out, maybe the script can be abstracted to generate all sorts of variable components.


Viewing all articles
Browse latest Browse all 28182

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>