wolph / numpy-stl

Simple library to make working with STL files (and 3D objects in general) fast and easy.
http://numpy-stl.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
624 stars 105 forks source link

Do save change original mesh points? #102

Closed thiagomarinho1984 closed 5 years ago

thiagomarinho1984 commented 5 years ago

Hello gents. First of all thank you so much for this package, its very useful.

I am running a script that loads a mesh, rotate it and save it. For some reason the new file size is much smaller than the original (~70% of original) and the triangles are being reconstructed. Is that the expected behavior?

I am wondering if its possible to do this process maintaining the original triangles by just transforming the points coordinates.

The following is a snip of the code with the function optional inputs:

`for i in range(0,meshes.len()):

stlMesh=mesh.Mesh.from_file(meshes[i])

print(meshes[i])

# Rotate about Z

stlMesh.rotate([0.0, 0.0, 1.0], math.radians(180-yaw))

# Rotate about Y

stlMesh.rotate([1.0 * math.sin(math.radians(-yaw)), 1.0 * math.cos(math.radians(-yaw)), 0],math.radians(pitch-90))

# Save

name = meshes[i].rsplit(r'/',1)[-1]

print(name)

stlMesh.save(basedir+case+r'/constant/triSurface/'+name, mode=stl.Mode.ASCII,update_normals=True)`

image

Uvar commented 5 years ago

In principle, unless you explicitly define that empty/duplicate polygons should be dropped at loading time, there fundamentally should not be any changes to your data shape. Therefore I'm tempted to ask you to take a detailed look at the files themselves:

  1. do they contain extra information outside the STL format? 2a. does each file have multiple STL definitions or 2b. lots of empty carriage returns?
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.