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

David Mathog <[email protected]> Tue, 04 Jun 2019 18:49:56 -0700
Newsgroups gmane.comp.graphics.inkscape.devel
Message-ID <[email protected]>
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