wolph / numpy-stl

Simple library to make working with STL files (and 3D objects in general) fast and easy.

Home Page:http://numpy-stl.readthedocs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Z-height

agen49 opened this issue · comments

Hello,

Thanks to everyone who made this library available to public.

  1. Is there an option to rotate an stll object using x, y, and z angles? If yes, how?

  2. Is there an option to find the Z-height of an stl object at a specific orientation? If yes, how?

Thank you.

P.S. I am new to programming, my background is in environmental engineering.

  1. Yes, take a look at the example of the readme: https://github.com/WoLpH/numpy-stl#modifying-mesh-objects
  2. The easiest method I can think of is by rotating first and doing mesh.z.max() - mesh.z.min()

Thank you for replying back. I appreciate the time.

  1. I've tried to follow the code but I am kinda lost. Would you please post a code example on this page for ONLY the lines of codes that any user can use to rotate their parts?

  2. I am getting an error "module 'stl.mesh' has no attribute 'z'".

from stl import mesh


your_mesh = mesh.Mesh.from_file('tests/stl_binary/HalfDonut.stl')

# Rotate 90 degrees over the Y axis
your_mesh.rotate([0.0, 0.5, 0.0], math.radians(90))

z_height = your_mesh.z.max() - your_mesh.z.min()

Thank you very much. Honestly, I didn't expect it to be that simple, I thought I need to copy all the code under "modifying mech objects" and tweak it. Thank you for clarifying that, very kind of you. I've seen you posted a citation for your code on another post, I'll make sure to use that. Have a good day/night.