Skip to content

How can i find linear parameters of stl model? #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PeterBan11 opened this issue Feb 12, 2024 · 2 comments
Closed

How can i find linear parameters of stl model? #220

PeterBan11 opened this issue Feb 12, 2024 · 2 comments
Labels

Comments

@PeterBan11
Copy link

PeterBan11 commented Feb 12, 2024

#I tried this code:

your_mesh = mesh.Mesh.from_file('dog.stl')
xyz = (your_mesh.max_ - your_mesh.min_)

len = xyz[0]
wid = xyz[1]
heig = xyz[2]

#Is it correct?
#What is the length measured in your libraries? Is it measured in millimeters?

@wolph
Copy link
Owner

wolph commented Feb 13, 2024

It's slightly more complicated than that unfortunately. STL files are composed of triangles so you need to make sure you compare each point to each other point.

You are currently comparing the first point of each triangle while ignoring the other 2 points. This will be close to the actual number, but it will usually differ slightly.
To get the correct calculation you need to use your_mesh.points.max() - your_mesh.points.min()

The STL format does not specify a unit so the sizes can be measured in millimeters, meters, inches or something completely different depending on your source. Having that said, most of the 3D print STL files you can find online are in millimeters but there is no guarantee for that.

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Mar 15, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants