Giter Club home page Giter Club logo

python-stlsplitter's Introduction

python-stlsplitter

STL file splitter and binary/ascii read/write library for Python

STL Splitter

This is a small tool that recognizes when an stl file contains separate objects (plate) and writes them out as separate files

Usage:

./stlSplitter.py <file.stl>

The output format is file-1.stl file-2.stl etc.

stlRW

This is a library for input/output of ascii and binary STL files. it implements the following functions:

header, points, normals, v1, v2, v3, isAscii = stlRead(stl_filename)

reads an STL file, automatically recognizing if it is binary or ascii. Returns the header (unimplemented), an array containing all the points, an array containing all the normals, three arrays containing the vertices of the triangles and a boolean variable identifying if the read file was ASCII. The library has two specialized forms of this function, with the same syntax: stlReadAscii and stlReadBinary.

stlWrite(fname, normals, v1, v2, v3, isAscii=False)

writes an STL file, accepting the same parameters as the output of the above functions. There are two specialized versions that can be called directly: stlWriteAscii and stlWriteBinary.

The code of this library is partly based on https://github.com/cmpolis/convertSTL by Chris Polis and https://github.com/sukhbinder/python by Sukhbinder Singh

python-stlsplitter's People

Contributors

fsantini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-stlsplitter's Issues

Add "b" to specify bytes at line 82 of stlRW.py

Hey,

Thanks for writing this code, it is very useful! I ran into one bug using the code on line 82 of stlRW.py. The error I got was:

error: char format requires a bytes object of length 1

This can be fixed with the following change to that line of code (add 'b' to specify bytes):

for i in range(0, 80): fout.write(pack("<c", b" "))

Thanks again!

Best regards,
Kris

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.