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 code.
import numpy as np
import stl
from stl import mesh
lines = mesh.Mesh.from_file('mesh.stl')
count = 0
for line in lines:
if line.split()[0] == "solid":
repl = line.split()[1]
print(repl)
Any leads will be appreciated.
Regards, Sunag R A.
It's because you obtain an ndarray object where you apply split.
Just convert it to a string (with tostring() method) before doing it, and it will work.