How to set group name when exporting pyvista mesh to wavefront obj
I am generating some cylinder meshes from some csv data and adding them to a PyVista plotter, using this I then export them to an '.obj' file using the export_obj
method. The problem is I want to associate a group name with each mesh inside the obj file so I can use that information later, however the exporter seems to assign a random name like grp123
to each mesh.
IDS = df[ID_FIELD].values
p = pv.Plotter()
length = len(IDS)
for index, id in enumerate(IDS[: NUM_TO_GENERATE]):
print(f"Making Column {index}/{length}", end=", ")
data = dfa.loc[dfa[ID_FIELD] == id]
print(f"NUM ROWS: {len(data)}")
print(id)
x = float(df.loc[df[ID_FIELD] == id][C1])
z = float(df.loc[df[ID_FIELD] == id][C2])
for row in data.values:
height = float(row[C3]) - float(row[C4])
cyl = pv.Cylinder(height=height, center=(
x, float(row[FROM_COLUMN]) + height/2, z), direction=(0, 1.0, 0))
p.add_mesh(cyl, name=id, label=id)
p.add_axes()
p.export_obj("data.obj")
So yeah basically help associating a name with each group inside the obj file would be helpful.
Comments
Post a Comment