# What is the simplest way to create basic 3d/isometric style images programatically like autocad/blender

I need the simplest route to programatically, via command line, through python or node, to create something like this using basic input of distance and 90 degree turn etc: https://i.imgur.com/SdY02gQ.png

I normally use blender for such graphics, but manually. I have bee told its over kill to use for my basic need via python, not sure where to start.

I have been told three.js is the wrong choice to try and do something like that as its for browser use mainly and I just want to create rendered images to disk, from input, on the command line.

any advice would be appreciated. I am building a fencing quote system and would like to have basic graphics accompany it. I feel like autocad/freecad would be perfect if it had such options.

• Honestly if you can script Blender to do what you need to do via Python, that might be the easiest way especially if you're already familiar with Blender. There's a lot of 3D graphics libs for Python but they all seem to focus on realtime, using OpenGL etc. – Nathan Reed Sep 13 at 22:36
• All you really need for those images are a text editor to be honest. What is the output medium? Eg.a vector image is not really blenders forte. You probably wont want to pay for autocad just for this. Autocad is really a very overpriced legacy system for thise who can not move with the times. In fact its a extortion scheme. – joojaa Sep 15 at 12:29
• @joojaa please elaborate on what you mean by "you just need a text editor?" to create images. the output medium would be jpg/png whatever. – Mark Sep 16 at 14:10
• You can write eps, svg, dxf, iges, step in any text editor. Since these are vector formats all you need to do is supply a list of coordinates, both eps (better) and svg (with some copying) are even smart enough to turn your 2D coordinates into isometric without you or your starting application know anything about this. Once you know how to write the image by hand (which is easy by the way) all you need is a imaging application since eps and svg are quite commonly used image format quite many applications open them as a image. And as a side effect you now know how to program it. – joojaa Sep 16 at 14:54
• Anyway i was more interested in the input output medium not format, like webpage, print, app etc. As to where the image goes next. Also would be nice to know what your data comes from? – joojaa Sep 16 at 14:55

Since your actuallyu doing a PDF file you should do this as a vector drawing not a image format. This makes for way more clearer end results. I will generate a image in EPS, EPS is easy to build into your PDF file with say distiller, ghostscript, sent to printer or injected into TeX (though then you may want to use Tix or or PStricks) .

Ok first you have to undertsand that EPS is a full programing language (Postscript), in addition to being a vector format (the Encapsulation part). I will be uisng the features to remove repetition. The file begins with a encapsulation marker so that you can more easily insert it programmatically.

So frist draw the thing form a overhead view, then we will transform that into isometric with a affine transform:

Image 1: Preview of listing 1

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 538 300
%%Title: listing 1
%%Creator: joojaa
%%CreationDate:  2020-09-23

% postscript style shorthand relative
/m {moveto} def
/rm {rmoveto} def
/rl {rlineto} def

72 25.4 div 100 div  dup scale  % draw in  1:100
70 setlinewidth %0.7 mm technical pen

newpath  % coordinates and ops follow
0 4100 m
0 5500 rl
9000  0 rl
0 -4000 rl
4000 0 rl
0 -1300 rl
0 -800 rm
0 -1000 rl
stroke

%%EOF


Ok then we transform the entire thing to isometric

Image 2: Image after Listing 2. Only stroke changed

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 538 300
%%Title: listing
%%Creator: joojaa
%%CreationDate:  2020-09-23

% postscript style shorthand relative
/m {moveto} def
/rm {rmoveto} def
/rl {rlineto} def

72 25.4 div 100 div  dup scale  % draw in  1:100
70 setlinewidth %0.7 mm technical pen

newpath  % coordinates and ops follow
0 4100 m

0 5500 rl
9000  0 rl
0 -4000 rl
4000 0 rl
0 -1300 rl
0 -800 rm
0 -1000 rl

%changed stroke to this
gsave
false upath
9600 60 sin mul 0 translate
[60 sin 60 cos -60 sin -60 cos 0 0] concat
ustroke
grestore
%eof changed

%%EOF


Then we duplicate this and offset

Image 3: After offsetting

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 538 300
%%Title: listing 3
%%Creator: joojaa
%%CreationDate:  2020-09-23

% postscript style shorthand relative
/m {moveto} def
/rm {rmoveto} def
/rl {rlineto} def

72 25.4 div 100 div  dup scale  % draw in  1:100
70 setlinewidth %0.7 mm technical pen

newpath  % coordinates and ops follow
0 4100 m

0 5500 rl
9000  0 rl
0 -4000 rl
4000 0 rl
0 -1300 rl
0 -800 rm
0 -1000 rl

gsave
false upath
9600 60 sin mul -1100 translate
[60 sin 60 cos -60 sin -60 cos 0 0] concat
ustroke
grestore

gsave
false upath
9600 60 sin mul 10 translate
[60 sin 60 cos -60 sin -60 cos 0 0] concat
ustroke
grestore

%%EOF


Next draw connecting lines

Image 4: Listing 4 result

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 538 300
%%Title: listing 4
%%Creator: joojaa
%%CreationDate:  2020-09-23

% postscript style shorthand relative
/m {moveto} def
/rm {rmoveto} def
/rl {rlineto} def
%draw connecting line

/tf { 9600 60 sin mul 10 translate
[60 sin 60 cos -60 sin -60 cos 0 0] concat} def

/dc {gsave
newpath
9600 60 sin mul 10 translate
[60 sin 60 cos -60 sin -60 cos 0 0]
concat m -1100 -1100 rl
stroke
grestore
} def

72 25.4 div 100 div  dup scale  % draw in  1:100
70 setlinewidth %0.7 mm technical pen

newpath  % coordinates and ops follow

0 4100 m
0 5500 rl
9000  0 rl
0 -4000 rl
4000 0 rl
0 -1300 rl
0 -800 rm
0 -1000 rl

%drawing no need to change
gsave
false upath
tf
ustroke
grestore

gsave
false upath
0 -1100 translate
tf
ustroke
grestore

{dc} {dc} {} {} pathforall

%%EOF


Todoo:

• Change stroke to round
• Draw in paperspace
• Draw distances.
• Compute bound and center
• Etc.

I might return later

• holy SMOKES! my mind is blown. I must admit I thought I would not hear back! I have been grinding away at blender/freecad using the python interface, but this is IT! – Mark Sep 24 at 8:41
• could you put some contact details in your bio so I can contact you to help further this along, I would be happy to pay you. – Mark 2 days ago