Re: Extension request: Auto-generate rectangles based on input values

wiesi--- via Inkscape-devel <[email protected]> Wed, 5 Jun 2019 08:21:02 +0200 (CEST)
Newsgroups gmane.comp.graphics.inkscape.devel
Message-ID <[email protected]>
The question is also, if we would want this for interactive entry, batch processing or processing the output of other tools: It is usually rather easy (but nevertheless some work) to create an external tool to convert such a list to SVG. For my own tools that generate graphics files I usually end up outputting SVG files (or parts of them) directly, because outputting, for example, 

<line x1="45.6" y1="23" x2="-15" y2="8" />

is not much more complicated than

moveto 45.6, 23
lineto -15, 8

Regards
wiesi


> David Mathog <[email protected]> hat am 5. Juni 2019 um 03:49 geschrieben:
> 
> 
> On 04-Jun-2019 18:11, brynn wrote:
> > If "Inkscape is not a CAD program" is not an appropriate answer, I
> > would welcome suggestions how to answer messages like this:
> > 
> > "Inkscape is a terrible CAD program.  Where do I enter the length and
> > angle of the line?  How can I draw a line if I can't enter the length
> > and angle?"
> > 
> > (substitute radius/diameter/circumference, etc, for a circle; or
> > dimensions for rectangle)
> 
> Well, this probably isn't what the target audience would want to hear, 
> but since it sounds like the questioner might have a set of simple 
> elements with known sizes, locations, and orientations derived from who 
> knows what (actual measurements, some abstract calculation?), it isn't 
> unreasonable to ask if there might be a way to provide a quick and easy 
> conversion of that data to a drawing through Inkscape.
> 
> For instance, if the user could write their data as a text file made of 
> simple declarative 1 line statements like:
> 
> moveto,x,y
> lineto,x,y
> ray,x,y,length,angle
> ray2,x1,y1,x2,y2
> square,x,y,side,angle  #x,y is center
> square2,x,y,side,angle #x,y is lower left corner
> rectangle,x,y,width,height,angle #x,y is center
> rectangle2,x,y,width,height,angle #x,y is lower left corner
> circle,x,y,radius
> ellipse,x,y,radiusA,radiusB,angle
> ellipse2,x,y,radius,eval,angle
> text,x,y,points,font,angle,text_string
> draw_color,color_name
> draw_color_rgb,R,G,B
> fill_color,color_name
> fill_color_rgb,R,G,B
> draw_width,width
> (etc.)
> quit
> 
> it would not be hard to write a converter to read that and write it out 
> again as SVG, either to a file or imported directly into Inkscape.
> 
> Yes, this duplicates features of many other graphics languages, from cgm 
> to hpgl to postscript. So it might be best to pick the text form of one 
> of those standards and write an importer for it.  (Not postscript 
> though, that is Reverse Polish, too bizarre for the average user.)  For 
> all I know there may already be an import option which works like this.  
> If so, point said user to it and say "have at it".
> 
> Regards,
> 
> David Mathog
> [email protected]
> Manager, Sequence Analysis Facility, Biology Division, Caltech
> 
> 
> _______________________________________________
> Inkscape-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/inkscape-devel