Search found 11 matches

by paulsomlo
Fri Mar 09, 2018 4:58 am
Forum: Programming
Topic: automate text input from .txt and place in inkscape?
Replies: 23
Views: 11111

Re: automate text input from .txt and place in inkscape?

I ended up using several bash scripts to modify inkscape's XML code. One to place the names (which reside in a text file), another to query the width of the name and resize if necessary, and another to import groups of 12 files (using svg_stack.py) into a template containing 12 circles. I then use i...
by paulsomlo
Fri Oct 27, 2017 6:19 am
Forum: Programming
Topic: automate text input from .txt and place in inkscape?
Replies: 23
Views: 11111

Re: automate text input from .txt and place in inkscape?

Here's how I chose to deal with duplicate files: #!/bin/bash # external variables: names.txt, test.svg file="names.txt" while read line do sed "s/name/$line/g" test.svg > tmp.svg if [ -e $line.svg ] then i=1 while [ -e $line$i.svg ] do let i++ done line=$line$i fi cp tmp.svg $lin...
by paulsomlo
Sat Oct 21, 2017 3:45 am
Forum: Programming
Topic: automate text input from .txt and place in inkscape?
Replies: 23
Views: 11111

Re: automate text input from .txt and place in inkscape?

I came up with a workable solution: #!/bin/sh for file in *.svg do width=$(inkscape $file --query-width --query-id text3585) width=${width%.*} if [ $width -gt 120 ] then scalefactor=$(awk "BEGIN {print 120/$width*45}") sed -i "s/font-size:45px/font-size:"$scalefactor"px/g&qu...
by paulsomlo
Fri Oct 20, 2017 11:25 am
Forum: Programming
Topic: automate text input from .txt and place in inkscape?
Replies: 23
Views: 11111

Re: automate text input from .txt and place in inkscape?

Will you share the modified code? My apologies for not getting back to you sooner - I didn't have "reply notifications" turned on. I didn't actually modify any code. I used the standard generator to place the names, which worked very well. The names that were too long, I changed manually ...
by paulsomlo
Fri Oct 06, 2017 4:18 pm
Forum: Programming
Topic: automate text input from .txt and place in inkscape?
Replies: 23
Views: 11111

Re: automate text input from .txt and place in inkscape?

Well, I finished up this evening. I never did figure out how to scale the text; I chose a font size that would make the shortest names large enough to read, then went through the files with long names and manually reduced their size. I put 12 graphics on each page and did so manually. I may find a w...
by paulsomlo
Wed Oct 04, 2017 11:25 am
Forum: Programming
Topic: automate text input from .txt and place in inkscape?
Replies: 23
Views: 11111

Re: automate text input from .txt and place in inkscape?

I got the centering to work, for the most part - longer names need a slight horizontal adjustment. I was able to figure out how to query the text width from the command line, but am not able to figure out how to change it from the command line. I can't find an inkscape verb that seems to do this dir...
by paulsomlo
Tue Oct 03, 2017 10:52 am
Forum: Programming
Topic: automate text input from .txt and place in inkscape?
Replies: 23
Views: 11111

Re: automate text input from .txt and place in inkscape?

It's not a totally unusual request, I've seen this asked a couple of times. It's probably not even too difficult to do... I'd make the script create the text in the standard font size first, then I'd ask Inkscape how wide the text is, and then, if too wide, I'd scale it down. Then center on object ...
by paulsomlo
Tue Oct 03, 2017 6:53 am
Forum: Programming
Topic: automate text input from .txt and place in inkscape?
Replies: 23
Views: 11111

Re: automate text input from .txt and place in inkscape?

I compared some output files. It appears that the first letter in each name begins in the same place, consistently. How does the .svg file know how to position the text? Usually by the justification buttons in the text controls... for left/center/right/jusified. Positions a "text anchor" ...
by paulsomlo
Mon Oct 02, 2017 4:22 am
Forum: Programming
Topic: automate text input from .txt and place in inkscape?
Replies: 23
Views: 11111

Re: automate text input from .txt and place in inkscape?

I compared some output files. It appears that the first letter in each name begins in the same place, consistently.
How does the .svg file know how to position the text?
by paulsomlo
Mon Oct 02, 2017 4:18 am
Forum: Programming
Topic: automate text input from .txt and place in inkscape?
Replies: 23
Views: 11111

Re: automate text input from .txt and place in inkscape?

Well, it sort of worked. While it inherited the font and size from %VAR_name%, which is very nice, the positioning was not consistent. I was able to get the positioning correct for one name, but not for other names. Vertically, all the names were in the correct place, but horizontally the names shif...
by paulsomlo
Sat Sep 30, 2017 4:17 am
Forum: Programming
Topic: automate text input from .txt and place in inkscape?
Replies: 23
Views: 11111

automate text input from .txt and place in inkscape?

I'm making buttons (name badges) for an event. In Inkscape, each button will consist of graphics inside of a circle. Each page will contain 12 buttons in three columns of four. I also have the names in a .txt file, one name per line. Is it possible to automate the process? I would like an extension/...

Go to advanced search