
Today I got feature extraction working from real STEP files and set up CAM toolpath logic! Below is the breakdown of the steps (pun intended).
First learned how STEP files are set up and the type of information that's in them: everything is written in EXPRESS, and each line starts with a # and a number, and refers to a piece of information about the object (a line, surface, hole, etc). Basically, information on each component and how they are meant to be assembled together.
It took me quite a while to be able to read STEP files properly. Ran into mainly compiler issues, trying to read source files as executables, for example. (Source code is the human-readable instructions written in a programming language like C++, while an executable is the machine-readable program created by compiling that source code so the computer can run it.)
The main issue turned out to be goofball MacOS sandboxing my terminal & VSCode, aka not giving it permission to access my Downloads. Just had to change my settings and... voila! 1 solid, 1 shell, 61 faces, 168 edges and 112 vertices :)
After that it was very easy to analyze full shape hierarchies, create a new struct
, find feature locations in 3D space, clean up the CLI (command line interface) output, and begin to generate CAM operations based on feature characteristics.
Some of the classes/enums I used were BrepAdaptor_Surface
, TopExp_Explorer
, TopAbs_FACE
, TopoDS_Shape
, GeomAbs_SurfaceType
, UVBounds()
and .Value(u, v)
.
THEN I decided I needed something a bit harder and got started on a visualizer - a 3D application layer so that I could render and see the toolpath, not just output lines on my terminal.
Initial setup was pretty easy, I installed Qt via Homebrew and linked it with OCCT in my CMake file. I also added logic for two different executables, and additional .cpp and .hpp files to support the new popup screen. But then again I had to wrestle with quite a few errors.
Specifically, WNT_Window
was Windows only and it broke the build on my MacOS. Cocoa_Window(disp, winID)
gave constructor mismatch, so I tried multiple things, like changing it to NSView
and using Aspect_Window
. I was able to solve this error, but was getting a stream of symbols instead of a proper build.