Giter Site home page Giter Site logo

stl-volume-model-calculator's Introduction

STL Volume Model Calculator

This script provides functionality to calculate the volume and surface area of 3D models stored in the STL file format, as well as estimate the weight of the model based on the selected material. It is implemented in Python and supports both binary and ASCII STL files.

Usage

To use the script, navigate to the directory containing volume_calculator.py and your STL file in a terminal, then execute one of the following commands based on your needs:

Volume and Mass Calculation

python volume_calculator.py <filename.stl> volume --material <material_id_or_name> [--unit cm|inch]

Surface Area Calculation

python volume_calculator.py <filename.stl> area

Arguments:

<filename.stl>: Replace with the path to your STL file. <material_id_or_name>: Replace with the ID or name of the material you want to use for mass estimation (see the list of materials above). Options:

--unit: (Optional) Specify the unit for volume calculation. Choices are cm (default) or inch. Examples:

Calculate the volume and mass of torus.stl using ABS material:

python volume_calculator.py torus.stl volume --material ABS

Calculate the surface area of torus.stl:

python volume_calculator.py torus.stl area

Materials Supported

The script comes with an extensive list of 3D printable materials each with its specified density which is used to calculate the mass of the model. The materials included are:

  • ABS
  • PLA
  • 3k CFRP
  • Plexiglass
  • Alumide
  • Aluminum
  • Brass
  • Bronze
  • Copper
  • Gold_14K
  • Gold_18K
  • Polyamide_MJF
  • Polyamide_SLS
  • Rubber
  • Silver
  • Steel
  • Titanium
  • Resin

Reporting Issues

Please report any error you may find to me ([email protected]).

Author

Mar Canet Sola(http://var-mar.info) - Twitter: mcanet

If you want to make a donation you can do in our PayPal account: [email protected]

Additional Resources

If someone is looking for some explanation about volume calculator i recommend read this blog post: http://n-e-r-v-o-u-s.com/blog/?p=4415

stl-volume-model-calculator's People

Contributors

alexderev avatar b4ld avatar gianluparri03 avatar mcanet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stl-volume-model-calculator's Issues

a little warning

first of all thank you for such great tool.
I was looking for a cross-platform tool to calculate the exact volume of stl when almost every piece of software provides only dimensions and weight.
I put 250mb file and my computer was dead for a while.
and the consequences were not so clear to me :)
so could you please add a little warning about the file size to the description?
the best thing would be if you could restrict memory/cpu usage, or add a message that "yout pc will be dead for 7 mins :D" but I suppose its not an easy task.
anyway thank you for this script!

Volume in cm

The volume is returned in CM, which is a measure of length...

Negative volume

For some objects, I get negative volumes. Is this expected?

Choose desired print material of STL file below:
1 = ABS or 2 = PLA or 3 = 3k CFRP or 4 = Plexiglass : 1
Desktop/gt2_20tooth.stl
total triangles: 1919252000
End calculate triangles volume
Total mass: -6.827174352201647e+92 g
Total volume: -6.564590723270814e+92 cm^3

Mass always is 0

Hi
I tried using this code with several STL files. I always end up with "Total mass could not be calculated" even though the volume is calculated correctly. What am i missing here? I checked with different unit systems also.

Error: 'utf-8' codec can't decode byte 0xa1 in position 8: invalid start byte Total mass could not be calculated

Hello, when I tried to use the program to calculate the STL file volume, this error occurred:

r@ubuntu:~/STL-Volume-Model-Calculator-master$ python volume_calculator.py ./123.STL volume 
Error: 'utf-8' codec can't decode byte 0xa1 in position 8: invalid start byte
Total mass could not be calculated

I drew and exported the STL file in soliwork, and the graphics are very simple. How can I solve this problem?
image

The spelling is "measure"

Your script should be called "measure_volume", not "mesure...", as that is the correct spelling (proof: Google it :P).

Anyway, thanks for the great tool, just what I needed!

.obj vs .STL for the same body results differ

Hi , thank you for the great tool!.
but the calculation of the volume is different between the same CAD model in obj and stl
please let me know if I am doing something wrong
thank you again for the support

Something happened on line 72

Sorry I don't understand about python language. But I've got error tried the code.
It said :

  File "mesure_volume.py", line 72
    elif material in {'2','PLA'}:
                                ^
TabError: inconsistent use of tabs and spaces in indentation

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.