Page 3 of 3 FirstFirst 123
Results 25 to 33 of 33

Thread: Stereolithography file to GCode

  1. #25
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    180
    Downloads
    0
    Uploads
    0
    I'll post the complete code, but here is what I did (speaking in VB).
    -Open the file for random access
    -Read in the first 80 characters as one string (the header)
    -Create a binary string for the next 4 characters starting at file position 84, then 83, 82, and 81. This creates a 32 character binary string. Convert that string to an integer that is the the number of facets.
    -Read in the next 50 bytes in 4 byte groups with 2 spacer bytes at the end. The first three groups are the three normals, the next 9 groups are the x,y,z for the three facet verticies. These are all floating point, of course. Like the facet number I create a binary number by reading the 4 bytes in reverse order.
    -repeat for facet 2, etc.

    The reason for the delay in posting the code (other than my programming is not that easy to read) is that I added a lot of code to do other things.


  2. #26
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    180
    Downloads
    0
    Uploads
    0
    Attached are two files:

    The .zip is the Excel file with the VB program.

    The .txt file is the VB program alone. It has calls to the Excel sheets in it, but you can modify it to work as a stand-alone.

    You can probably find something with an ASCII and a binary .stl file and test the above to double check that it is working correctly.

    It is not the best written or annotated program, but it works as far as I know.
    Attached Files Attached Files


  3. #27
    Registered
    Join Date
    Oct 2010
    Location
    US
    Posts
    2
    Downloads
    0
    Uploads
    0
    Howdy from North Texas I have a stl file that I would like to convert to gcode for a very small part. I was thinking about outsourcing the conversion so my friend with a haas lathe can mill it. haas has not been real helpful except to sell me something else. thanks thom


  4. #28
    Registered
    Join Date
    Feb 2006
    Location
    USA
    Posts
    3,543
    Downloads
    0
    Uploads
    0
    This thread seems to have died, but maybe we can get it going again, as I have a need to generate a 2D DXF from a 3D STL. It appears to me to be a pretty simple proposition, with some restrictions. My 3D parts are all extruded in the Z axis, so here's what I'm planning to do:

    1) Parse the STL file into an array of polygons, each defined by the four points from the file. Also compile a second list of the indices of all polygons which have all three vertices at the same Z position, which indicates they are parallel to the XY plane.
    2) Scan through the second list, one polygon at a time. For each one, scan through the list of all polygons, until finding one that both shares an edge with it, and is normal to it. Write the X,Y,Z coordinates of the both vertices of the shared edge to an output array, as this edge is a corner that represents a line segment parallel to the XY plane which must be output to the DXF file
    3) After finding all the line segments needing output to the DXF file in step #2, sort the output array, finding all segments which are connected to each other (i.e. - they share a vertex).
    4) Write each "string" of connected line segments to it's own layer of the DXF file.

    Seems to me this would work, and be pretty easy....

    Regards,
    Ray L.


  • #29
    Registered
    Join Date
    Apr 2010
    Location
    p.r.china
    Posts
    32
    Downloads
    0
    Uploads
    0

    stl file to gcode

    Hi
    I did a stl file to gcode by

    blender 2.5 import the stl file and blender can place a light source on top.
    Use the camera to talk a picture of the object. Adjust the light source intensity, render and see if it is a gray scale depth map.

    Once the depth map image is ready. The png or jpg picture can be handled by image to gcode function of emc2, that will generate gcode for engraving.

    See the attached png picture.
    Attached Images Attached Images


  • #30
    Registered
    Join Date
    Jul 2005
    Location
    USA
    Posts
    82
    Downloads
    0
    Uploads
    0
    That looks pretty cool to carve out, I may run it through mine just to try it. I like doing the 3d stuff, but don't do it often. I did some simple geometric stuff in gimp one, worked nicely. I've also done the blender depth map approach as well.


  • #31
    Registered
    Join Date
    Apr 2010
    Location
    p.r.china
    Posts
    32
    Downloads
    0
    Uploads
    0
    Hi
    I found Blender can do normal map, that is same as depth map.
    see "http://www.blender.org/development/release-logs/blender-236/normal-maps/"
    But I do not start to learn it yet.


  • #32
    Registered
    Join Date
    Feb 2009
    Location
    USA
    Posts
    1,570
    Downloads
    0
    Uploads
    0
    Do you by chance have a picture of the machined part to compare to the screenshot?


  • #33
    Registered
    Join Date
    Apr 2010
    Location
    p.r.china
    Posts
    32
    Downloads
    0
    Uploads
    0

    The butterfly engraved

    The file is being engraved at-last.
    The next time I will use wood instead of plastic.
    Attached Images Attached Images


  • Page 3 of 3 FirstFirst 123

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.