# File Input data types

I'm a newb and don't know much about 3D printers. In visual basic I can create vector data of 3d objects,that can be loaded into a binary or text file. Can files like this be used with a 3d printer?

### Example:

This is a very simplified example of how the code generates 3d vector data.

ju jv jw determine the size and dimensions of the object
ru, rv, rw are the vector lenghts


The incrementors used to increase the size of the object to the max ju jv jw vaules:

ru=ru+1
rv=rv+1
rw=rw+1


'the angles can also be incremented to for curves and spirials'

the angles of the vectors

angle u =0
angle v =45
angle w = 90


### Simplified code:

For k1 = 0 To Ju

ru=ru+1

xu = (ru * Sin(angle u))

yu = (ru * Cos(angle u))

For k2 = 0 To Jv

rv=rv+1

xv = (rv * Sin(angle v))

yv = (rv * Cos(angle v))

For k3 = 0 To Jw

rw=rw+1

xw = (rw * Sin(angle w))

yw = (rw * Cos(angle w))

Output xu, yu, xv, yv, xw, yw  ..to file in the order produced on this line

Next k3 : next k2: next k1


Can a 3d printer read this output as is and use it to make a 3d object?

• Hi, goo gle! You question is quite unspecific and therefore difficult to answer properly in its current state. Could you please give us a concrete example of what you are wondering about? For instance, what code do you have, what does the 3D models look like, what file format do they translate to, what do you want to achieve, and what have you tried so far? I have chosen to put your question on hold so that you can make your changes. Please let us know when you are ready to open it. Also, welcome to 3D Printing SE! – Tormod Haugene Jul 1 '16 at 20:14
• Someone else told me it would have to be in STL format and i don't think that will work with my data. Because its just striaght forward vector math that constructs squares in 2d and cubes in 3d, not triangles. But thank you for the reply. – goo gle Jul 3 '16 at 1:36
• i use the method of Graphical Addition of vectors. found on this web page electronics-tutorials.ws/accircuits/complex-numbers.html scoll down to Graphical Addition and Subtraction – goo gle Jul 3 '16 at 2:28
• Could you please add your information to your question by using the edit button in gray text below your question? You will then be allowed to add pictures, code snippets etc. just as you would when writing the question for the first time. Also, when you are done, you can vote for your question to be reopened for answers by pressing the reopen button just right of the edit button. :-) – Tormod Haugene Jul 3 '16 at 9:07
• @goo gle the answer is NO - it won't work. It's much better to read about 3d printing/slicers/firmwares than presenting your code. It's strongly recommended to get at least basic knowledge because then we would have common area to discuss. You did ask the question and John Sensebe answered but you say you know better. Tell me how to convince you that there are principles which you have to accept rather than convince us that your way (of representing 3d objects) is ok. Converting 3d obj to printer format is a bit more than 15 lines of code. Please read at least passed wikipedia article. – darth pixel Jul 4 '16 at 4:34

Not directly. The most common types of 3D printers build objects in layers. They "draw" a layer, then "draw" another layer slightly above it, repeating until they've "drawn" the entire model. Preparing your model for this is called "slicing", since you are "slicing" your model into these layers. Slicing is a complex process and it's a lot of work to "roll your own" software for it, and there are several good, free applications to do it for you out there already.

What you probably can do easily is output your data in STL format to be read by the slicing software. STL (either ASCII or binary) is a dead simple format that contains the triangles that comprise your model. So simple, in fact, that the Wikipedia article tells you just about all you need to know.

To get triangles from squares:

A--B    Here is a "square" with vertices ABCD.    A--B    A--B    A
|  |    Splitting it from A to C produces two     |\ | ->  \ |    |\
|  |    triangles, ABC and CDA.  This can be      | \| ->   \|    | \
D--C    done as part of the output by simply      D--C       C    D--C
writing two triangles for every
square in the input.

• Thanks for answering but i don't think it will work my math is not written for triangles. its just striaght forward vector math that constructs squares in 2d and cubes in 3d, not triangles. – goo gle Jul 3 '16 at 1:30
• @google - It's really easy to split squares into triangles, though. Just pick a diagonal arbitrarily and divide each square into two triangles, like cutting a sandwich. You can do it as part of the output routine so the original model isn't modified. If your square is defined by vertices A, B, C, and D, going clockwise, then output triangles ABC and CDA. – John Sensebe Jul 3 '16 at 15:05
• i'm not useing a program with a graphical interface that you can use with a mouse, like cad or blender. I'm useing a version of qbasic called qb64 it's only texted based. There is nothing for me to split. there are no models to work with its all purely text. The 3d vector data projects a 3d image on the 2d screen as a finished picture not a model – goo gle Jul 3 '16 at 23:49
• @google I think John gets that. You'll need to do the splitting in your code, to convert the vectors and cubes into triangles as required by STL format. You could also look into using OpenSCAD, which is a programming language designed specifically to programatically generate STL files. – Tom van der Zanden Jul 4 '16 at 12:37