Questions tagged [numpy-stl]

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

35 questions
6
votes
1 answer

How do you extract vertices from a numpy-stl mesh?

I am trying to use numpy-stl to extract the vertices from an stl model to use for coherent point drift registration. How do you go about extracting the vertices? I understand how to create a mesh from a list of vertices and faces, but not how to go…
stanatomist
  • 73
  • 2
  • 6
5
votes
2 answers

Rendering 2D images from STL file

I would like to load an STL file and produce a set of 2D images in different rotations. I got the basics working with numpy-stl based on this example, ended up with this code - from stl import mesh from mpl_toolkits import mplot3d from matplotlib…
Yossi Dahan
  • 5,389
  • 2
  • 28
  • 50
5
votes
1 answer

How to save multiple meshes in python using numpy-stl

I am working on a piece of python code that will take in an image in grey scale, scale it, and output a 3d model with the height of each pixel being determined by the value of the grey scale. I have everything working except the output of the 3d…
Jared Perkins
  • 51
  • 1
  • 4
4
votes
2 answers

Convert Stl into numpy array

Is there way to convert the stl file content into a numpy array or a set of numpy arrays? I know that I can always read stl as file and then assign variables, but I was wondering if there is an automated way!
marco
  • 915
  • 4
  • 17
  • 35
3
votes
2 answers

Scale an .stl file using python script

I have an .stl file and I want to write a python script to scale if. So for example, if I have a file with a cube of dimensions 2x2x2mm, and I have my scale set to 10, the script should spit out an stl file with a cube of dimensions 20x20x20mm. I…
Umar Dastgir
  • 688
  • 9
  • 25
2
votes
0 answers

is there a general code that can export Matplotlib plots to .stl?

I have already downloaded the Numpy-stl library but I am not sure how a general export would work for a simple code for example a cube? So, if I plot a Cube in Matplotlib, and want to export it to an .stl file to be able to open in CAD, how should I…
Arpan Ray
  • 21
  • 1
2
votes
2 answers

Rotate stl file in matplotlib 3d

I'm using numpy-stl for open stl file in plot. It is open stl file. But i have a problem. I want to rotate stl file in plot like this image: Code is here: from stl import mesh from mpl_toolkits import mplot3d from matplotlib import pyplot from math…
woz523
  • 77
  • 1
  • 9
2
votes
1 answer

Load from ZipFile stl files by numpy-stl

is there a way how to load a stl files from zip by numpy-stl? I can read stl files normaly from file system by numpy-stl but Im not able to connect it to opened zip file. It is python 2.7 For example: this is code for reading scene.xml from…
Tibor
  • 81
  • 1
  • 7
2
votes
2 answers

Importing of 3D STL Image in Python (ImportError: No module named ascii)

I am planning to write a program in Python for raspberrypi, to import a 3D STL image. For that purpose, I googled and got a Python library called "numpy-stl" which is suitable for my requirement. I install it according to the instructions of website…
Irfan Ghaffar7
  • 1,143
  • 4
  • 11
  • 30
1
vote
2 answers

How do I convert STL file to numpy array and format it to overlay with Dicom data?

I have STL files of 3D objects and I have converted them into both mesh objects and numpy arrays using the numpy-stl package. I have also converted DCM data into numpy arrays with the pydicom package, but the numpy array versions of the STL files…
1
vote
0 answers

How do I solve this issue: process finished with exit code -1066598274 (0xC06D007E)

I am trying to use the numpy-stl library to rotate a triangular mesh, but the process keeps failing. For reference, this is the code I am running: from stl import mesh import math sphere = mesh.Mesh.from_file('bones.stl') sphere.rotate([0.0, 1,…
big_game
  • 11
  • 1
1
vote
2 answers

How to get rid of "numpy.ndarray" has no attribute split?

I have try to edit one stl file. With regards to this, I read the stl file using numpy-stl. Now, when I try to split the lines present in it, it shows me an error as: 'numpy.ndarray' object has no attribute 'split' How to overcome this? Below is the…
rasunag27
  • 55
  • 4
  • 11
1
vote
2 answers

triangulate 2d shape to get STL

I am generating 2D binary shapes in python. After that, I want them to be converted to a 3D STL file for 3D printing. This kind of works, but only with "simple" shapes like triangles and squares. For more complex shapes I get the following Shape…
DrEichenbach
  • 382
  • 1
  • 2
  • 13
0
votes
0 answers

Not able to visualize slices of stl file

I am trying to visualize slices of a stl file using matplotlib in python but receiving empty plots. Here is the code. z_min = np.min(your_mesh.vectors[:, :, 2]) z_max = np.max(your_mesh.vectors[:, :, 2]) num_slices = 10 # Number of slices # Create…
0
votes
0 answers

mplot3d's inconsistent render of Poly3DCollection from a numpy stl mesh.Mesh

This is a simplified version of a make_pyramid function. from stl import mesh import numpy as np import matplotlib.pyplot as plt def plot_mesh(stl_mesh): fig = plt.figure() ax = fig.add_subplot(111, projection="3d") …
1
2 3