Stereolithography file to GCode - Page 2

Page 2 of 2 FirstFirst 12
Results 21 to 34 of 34

Thread: Stereolithography file to GCode

  1. #21
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    180
    Downloads
    0
    Uploads
    0

    Default

    Here is the description for the binary file:

    "Binary STL files consist of a 80 byte header line that can be interpreted as a comment string. The following 4 bytes interpreted as a long integer give the total number of facets. What follows is a normal and 3 vertices for each facet, each coordinate represented as a 4 byte floating point number (12 bytes in all). There is a 2 byte spacer between each facet. The result is that each facet is represented by 50 bytes, 12 for the normal, 36 for the 3 vertices, and 2 for the spacer."

    I wrote a binary to decimal converter in VB if you want to program it.



  2. #22
    Registered
    Join Date
    Sep 2010
    Location
    india
    Posts
    6
    Downloads
    0
    Uploads
    0

    Default

    Hello sweatherly,

    thanks for ut reply.
    I am very thankful to you if you can post your VB code for binary file read.

    ~Dhr1



  3. #23
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    180
    Downloads
    0
    Uploads
    0

    Default

    It may take a few hours to find the code, but I will post it ASAP.



  4. #24
    Registered
    Join Date
    Sep 2010
    Location
    india
    Posts
    6
    Downloads
    0
    Uploads
    0

    Default

    ok.
    take your time.
    I am trying with myself also.



  5. #25
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    180
    Downloads
    0
    Uploads
    0

    Default

    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.



  6. #26
    Registered
    Join Date
    Jun 2005
    Location
    USA
    Posts
    180
    Downloads
    0
    Uploads
    0

    Default

    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


  7. #27
    Registered
    Join Date
    Oct 2010
    Location
    US
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default

    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



  8. #28
    Member
    Join Date
    Feb 2006
    Location
    USA
    Posts
    7087
    Downloads
    0
    Uploads
    0

    Default

    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.



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

    Default 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


  10. #30
    Registered
    Join Date
    Jul 2005
    Location
    USA
    Posts
    82
    Downloads
    0
    Uploads
    0

    Default

    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.



  11. #31
    Registered
    Join Date
    Apr 2010
    Location
    p.r.china
    Posts
    42
    Downloads
    0
    Uploads
    0

    Default

    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.



  12. #32
    Member
    Join Date
    Feb 2009
    Location
    USA
    Posts
    2086
    Downloads
    0
    Uploads
    0

    Default

    Do you by chance have a picture of the machined part to compare to the screenshot?



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

    Default The butterfly engraved

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

    Attached Images Attached Images


  14. #34
    Member
    Join Date
    Mar 2018
    Location
    Brazil
    Posts
    14
    Downloads
    5
    Uploads
    0

    Default Re: Stereolithography file to GCode

    Hi rweatherly
    you and other users have more updates of your VB and Excel apps? i want convert image to vector and import .stl files inv VB .
    i need open-source code to i learn about this.
    thank you.



Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Stereolithography file to GCode

Stereolithography file to GCode

Stereolithography file to GCode