<p>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) .</p>
<p>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.</p>
<p>So frist draw the thing form a overhead view, then we will transform that into isometric with a affine transform:</p>
<p><a href="https://i.sstatic.net/rkY4O.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rkY4O.png" alt="enter image description here" /></a></p>
<p><strong>Image 1</strong>: Preview of listing 1</p>
<pre><code>%!PS-Adobe-3.0 EPSF-3.0 
%%BoundingBox: 0 0 538 300
%%Title: listing 1
%%Creator: joojaa
%%CreationDate:  2020-09-23
%%EndComments

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

10 10 translate % add some padding
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
</code></pre>
<p>Ok then we transform the entire thing to isometric</p>
<p><a href="https://i.sstatic.net/EGRc0.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EGRc0.png" alt="enter image description here" /></a></p>
<p>Image 2: Image after Listing 2. Only stroke changed</p>
<pre><code>%!PS-Adobe-3.0 EPSF-3.0 
%%BoundingBox: 0 0 538 300
%%Title: listing 
%%Creator: joojaa
%%CreationDate:  2020-09-23
%%EndComments

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

10 10 translate % add some padding
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
</code></pre>
<p>Then we duplicate this and offset</p>
<p><a href="https://i.sstatic.net/XdkkJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XdkkJ.png" alt="enter image description here" /></a></p>
<p><em>Image 3</em>: After offsetting</p>
<pre><code>%!PS-Adobe-3.0 EPSF-3.0 
%%BoundingBox: 0 0 538 300
%%Title: listing 3
%%Creator: joojaa 
%%CreationDate:  2020-09-23 
%%EndComments

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

10 10 translate % add some padding
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
</code></pre>
<p>Next draw connecting lines</p>
<p><a href="https://i.sstatic.net/XD1x1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XD1x1.png" alt="enter image description here" /></a></p>
<p><em>Image 4</em>: Listing 4 result</p>
<pre><code>%!PS-Adobe-3.0 EPSF-3.0 
%%BoundingBox: 0 0 538 300
%%Title: listing 4
%%Creator: joojaa 
%%CreationDate:  2020-09-23 
%%EndComments

% 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

10 10 translate % add some padding
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
</code></pre>
<p>Todoo:</p>
<ul>
<li>Change stroke to round</li>
<li>Draw in paperspace</li>
<li>Draw distances.</li>
<li>Compute bound and center</li>
<li>Etc.</li>
</ul>
<p>I might return later</p>

CC BY-SA 4.0
2020-09-24T08:41:15.463Z
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
CC BY-SA 4.0
2020-09-27T09:16:05.717Z
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
CC BY-SA 4.0
2020-09-23T08:58:07.413Z
2020-09-23T08:58:07.413Z
joojaa
<p>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: <a href="https://i.sstatic.net/Ema7I.png" rel="nofollow noreferrer">https://i.sstatic.net/Ema7I.png</a></p>
<p>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.</p>
<p>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.</p>
<p>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.</p>

CC BY-SA 4.0
2020-09-13T22:36:11.317Z
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
CC BY-SA 4.0
2020-09-15T12:29:38.763Z
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
CC BY-SA 4.0
2020-09-16T14:10:35.320Z
@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
CC BY-SA 4.0
2020-09-16T14:54:50.033Z
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
CC BY-SA 4.0
2020-09-16T14:55:28.707Z
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
CC BY-SA 4.0
2020-09-16T18:13:32.537Z
its an input of sizes through a form on a website/app to the server which then calculates the cost and generates a mock image, writing to disk and including in the pdf generated, attached to email and sent back, its a little icing on the cake for a quote. Do you have any examples of any of those formats that would be smart enough to transfer my 2d coordinates into 3d. I have used SVG in text format in the browser before and have no way of knows how they could "make it 3d" apart from dxf, which would need something to create a scene
Mark
CC BY-SA 4.0
2020-09-16T19:06:20.003Z
All 3D is, is a trick. I will quickly make a demo as soon as i have a keybard and arent busy. If you want a pdf then vector drawings are definitely better than raster graphics. Isometric is easy.
joojaa
CC BY-SA 4.0
2020-09-23T06:19:52.303Z
@Mark ok sorry its taken a while my motherboard blew a capacitor.
joojaa
<opengl><rendering>
What is the simplest way to create basic 3d/isometric style images programatically like autocad/blender
Mark
# What is the simplest way to create basic 3d/isometric style images programatically like autocad/blender

(Asked by: username_0 on 2020-09-13)

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.sstatic.net/Ema7I.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.

**Tags:** opengl, rendering

> **Comments:**
> **username_1**: 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.  
> **username_2**: 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.  
> **username_0**: @username_2 please elaborate on what you mean by "you just need a text editor?" to create images. the output medium would be jpg/png whatever.  
> **username_2**: 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.  
> **username_2**: 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?  
> **username_0**: its an input of sizes through a form on a website/app to the server which then calculates the cost and generates a mock image, writing to disk and including in the pdf generated, attached to email and sent back, its a little icing on the cake for a quote. Do you have any examples of any of those formats that would be smart enough to transfer my 2d coordinates into 3d. I have used SVG in text format in the browser before and have no way of knows how they could "make it 3d" apart from dxf, which would need something to create a scene  
> **username_2**: All 3D is, is a trick. I will quickly make a demo as soon as i have a keybard and arent busy. If you want a pdf then vector drawings are definitely better than raster graphics. Isometric is easy.  
> **username_2**: @username_0 ok sorry its taken a while my motherboard blew a capacitor.  

---

## 1 answers

### Answer by username_2 on 2020-09-23. Score: 1 | Accepted answer

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:

[![enter image description here](https://i.sstatic.net/rkY4O.png)](https://i.sstatic.net/rkY4O.png)

**Image 1**: Preview of listing 1

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

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

10 10 translate % add some padding
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

[![enter image description here](https://i.sstatic.net/EGRc0.png)](https://i.sstatic.net/EGRc0.png)

Image 2: Image after Listing 2. Only stroke changed

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

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

10 10 translate % add some padding
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

[![enter image description here](https://i.sstatic.net/XdkkJ.png)](https://i.sstatic.net/XdkkJ.png)

*Image 3*: After offsetting

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

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

10 10 translate % add some padding
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

[![enter image description here](https://i.sstatic.net/XD1x1.png)](https://i.sstatic.net/XD1x1.png)

*Image 4*: Listing 4 result

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

% 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

10 10 translate % add some padding
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

> **Comments:**
> **username_0**: 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!  
> **username_0**: 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.  

---

