You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I want to generate an STL mesh from a random distribution of ellipsoids in a .csv file.
The following exception occurs in the code below:
Exception: No elements in volume 33 47
Would you be so kind to check why this is happening since I have no idea?
from math import pi
import pygmsh
import meshio
from csv import reader
with open('data_1_ell.csv', 'r') as csv_file:
csv_reader = reader(csv_file)
# Passing the csv_reader object to list() to get a list of lists
list_of_rows = list(csv_reader)
#print(list_of_rows)
#for element in list_of_rows:
# print(element[0], element[1], element[2], element[3], element[4], element[5], element[7], element[8] )
#print(type(list_of_rows))
#print(list_of_rows[1][0:3])
def ellipsoid_rotated(obj, center, angle1, axis1, angle2, axis2):
geom.rotate(obj, center, angle1, axis1)
geom.rotate(obj, center, angle2, axis2)
mesh_size_obj = 0.1
ind = 0
limit = 50
object_list=[]
with pygmsh.occ.Geometry() as geom:
geom.characteristic_length_max = 0.1
for element in list_of_rows:
if (ind > 0 and ind < limit):
obj = geom.add_ellipsoid([float(element[0]),float(element[1]),float(element[2])], [float(element[3]),float(element[4]),float(element[5])], mesh_size=mesh_size_obj)
ellipsoid_rotated(obj, [float(element[0]),float(element[1]),float(element[2])], float(element[7]), [0.0, 0.1, 0.0], float(element[8]), [0.0, 0.0, 0.1])
object_list.append(obj)
ind = ind + 1
print("Performing union of objects ...")
geom.boolean_union(object_list)
print("Creating mesh ...")
mesh = geom.generate_mesh()
print("Saving .stl file")
mesh.write("ellipsoids_rotated_" + str(limit) + "s.stl")
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I want to generate an STL mesh from a random distribution of ellipsoids in a .csv file.
The following exception occurs in the code below:
Exception: No elements in volume 33 47
Would you be so kind to check why this is happening since I have no idea?
data_1_ell.csv
Beta Was this translation helpful? Give feedback.
All reactions