![]() |
What's the meaning of dtype=mesh.Mesh.dtype? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: What's the meaning of dtype=mesh.Mesh.dtype? (/thread-42095.html) |
What's the meaning of dtype=mesh.Mesh.dtype? - FerdiFuchs - May-09-2024 Hi there, I'm trying to create STL files using python code and found the following sample: from stl import mesh import math import numpy # Create 3 faces of a cube data = numpy.zeros(6, dtype=mesh.Mesh.dtype) # Top of the cube data['vectors'][0] = numpy.array([[0, 1, 1], [1, 0, 1], [0, 0, 1]]) data['vectors'][1] = numpy.array([[1, 0, 1], [0, 1, 1], [1, 1, 1]]) # Right face data['vectors'][2] = numpy.array([[1, 0, 0], [1, 0, 1], [1, 1, 0]]) data['vectors'][3] = numpy.array([[1, 1, 1], [1, 0, 1], [1, 1, 0]]) # Left face data['vectors'][4] = numpy.array([[0, 0, 0], [1, 0, 0], [1, 0, 1]]) data['vectors'][5] = numpy.array([[0, 0, 0], [0, 0, 1], [1, 0, 1]])Now I'm wondering what's the exact meaning of dtype=mesh.Mesh.dtype. Looks like it assigns a data type to the list, however, I don't understand its structure. What's the meaning of the fist 'mesh', what's the meaning of the second 'Mesh' and what's the meaning of the 'dtype' in the expression. Could anybody given an explanation, please? I didn't find useful documentation for a beginners level. Best regards RE: What's the meaning of dtype=mesh.Mesh.dtype? - deanhystad - May-09-2024 stl is a package mesh is a sub-package of stl. mesh.Mesh is probably a class. You can find out by asking Python. I'm not going to install stl just for this, so I'll use tkinter.ttk as an example. for stl.mess, start up the python interpreter and mport mesh from stl and ask python wht "mesh" is. You could even ask for help.>>>help(mesh)Do the same thing to learn more about Mesh.
RE: What's the meaning of dtype=mesh.Mesh.dtype? - FerdiFuchs - May-10-2024 Thanks, that helped already. Meanwhile, I noticed that I am actually able to create some STL files without understanding the full details of the data structure. |