Search code examples
step

Extracting 2D surface from 3D STEP model


I'm trying to figure out a good way to programmatically generate contours describing a 2D surface, from a 3D STEP model. Application is generating NC code for a laser-cutting program from a 3D model.

Note: it's easy enough to do this in a wide variety of CAD systems. I am writing software that needs to do it automatically.

For example, this (a STEP model):

Stator 3D model

Needs to become this (a vector file, like an SVG or a DXF):

DXF drawing of a motor stator

Perhaps the most obvious way of tackling the problem is to parse the STEP model and run some kind of algorithm to detect planes and select the largest as the cut surface, then generate the contour. Not a simple task!

I've also considered using a pre-existing SDK to render the model using an orthographic camera, capture a high-res image, and then operating on it to generate the appropriate contours. This method would work, but it will be CPU-heavy, and its accuracy will be limited to the pixel resolution of the rendered image - not ideal.

This is perhaps a long shot, but does anyone have thoughts about this? Cheers!


Solution

  • I would use a CAD library to load the STEP file (not a CAD API), look for the planar face with the higher number of edge curves in the face loop and transpose them on the XY plane. Afterward, finding 2D geometry min/max for centering etc. would be pretty easy.

    Depending on the programming language you are using I would search for "CAD control" or "CAD component" on Google combining it with "STEP import".