At our high school, freshmen are required to take an introduction to engineering course where students learn the basics of the design process and fundamentals of CAD modeling. While learning CAD modeling, many students struggled with understanding orthographic, oblique, perspective, and isometric views. It was often difficult to completely model an object without running into some sort of error. This is where Generat3D comes into play.
What it does
Our program, Generat3D, takes 2D orthographic images as inputs. With the vertices highlighted in bright red, the program is able to detect the vertices of the object and its general shape and dimensions. With the vertices' coordinates determined and stored, the program writes the necessary code within an stl file in order to create the 3D rendering of the object.
How we built it
BlueJ and Eclipse combined with Java were used primarily to code the program. By using predefined pixel, color, and picture classes, a vertex approximation algorithm was developed. With the data parsed, coordinates were analyzed and written directly to a .stl file. Sample code representing .stl files as ASCII characters were researched online. Once the .stl file was complete, it could be open on Windows 3D Builder.
Challenges we ran into
The first problem we ran into was how to code an actual CAD file. The file we were familiar with was an .ipt from Autodesk Inventor. However, there was no way for us to accurately code this. However, after some quick research, we learned of a simpler file typically used when developing CAD systems. This file was called an .stl which could be coded in ASCII. Finding this file type and learning how to manipulate it significantly helped our project.
Another problem we encountered was edge detection of an image. Initially, we planned to take a picture of an actual object and detect the border of object. However, our software was not sophisticated enough to properly determine the object's boundary. Furthermore, when writing to the .stl file, specific vertices are needed, not entire edges. We found it difficult to locate vertices given edges. As a result, a simplified vertex detection algorithm was defined that searches for points highlighted in the 2D drawing by the engineer.
The final major problem we encountered was actually drawing the 3D image. stl files are unique in that one can only code triangular faces. We found it difficult to organize coordinates in such a way so that the correct faces are drawn rather than faces that folded in on themselves. In order to combat this problem, we limited the maximum number of vertices and simply drew a face between any three vertices.
Accomplishments that we're proud of
Despite not quite reaching our goal when we first came to the hackathon, we are proud that we were able to develop a working program by the end of the hackathon. By the end of day one, we were doubtful whether we would actually have something to submit because of all the problems we ran into. However, after much persistence, a final project that can be seen was finally developed.
What we learned
By performing this hack, we learned a lot about the .stl file format. We were previously completely oblivious regarding its usage, but now we have a reasonable grasp over the ASCII style of coding.
What's next for Generat3D
Currently, is limited to right prisms with a convex face. Lack of time did not allow for a sophisticated edge and vertex detection algorithm. In the future, we hope to improve on this problem, making the program workable for all shapes and sizes. In addition, we hope to make it usable for images of actual, real life objects rather than solely 2D orthographic drawings.