question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Append multiple vedo objects into an array, and save all into one file

See original GitHub issue

Hi @marcomusy! A question regarding exporting mesh, splines, points, pictures, plots, for later visualization through show(). Is it possible to append multiple vedo objects into an array, and save all into one file. Instead of write() and load() all objects with a supported format? I tried to write() multiple objects with the format .npz, but I didnt suceed when trying to load().

I did look into this example regarding exporting scenes,examples/other/export_numpy.py An error did occur when trying to save a image through ‘Picture(image)’ with a Mesh in a scene with the following line:

p= show(mesh, Picture(image), axes=1)
exportWindow('scene.npz')
p.close()

Error: C:\Users\eivin\anaconda3\envs\project\lib\site-packages\vedo\utils.py:342: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray faces = np.array(faces)

Also, when exporting only a mesh the example did work, but the colors in the pointcloud scene was not the same before and after exporting.

I did read this issue #357 It is somehow possible to merge multiple objects and then split it afterwards?

In advance, Thank you @marcomusy!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
eivindtncommented, May 5, 2021

Great @marcomusy ! Thank you! This works fine! It is nice to recreate the plots without loading all the files.

1reaction
marcomusycommented, May 5, 2021

Is there a way to export two single renders(two files) and then visualize them as multiple renders after loading?

what about this:

from vedo import *

pic = Picture("https://api.time.com/wp-content/uploads/2019/03/kitten-report.jpg")
cube= Cube(side=500)
sphere= Sphere(r=250).lw(1)

show(cube,   pic, axes=1).export("scene1.npz").close()
show(sphere, pic, axes=1).export("scene2.npz").close()

######################### load back
plt1 = load("scene1.npz")
plt2 = load("scene2.npz")

plt = Plotter(N=2, axes=1)
plt.show("RENDERER 0", *plt1.actors, pic, at=0)
plt.show("RENDERER 1", *plt2.actors, pic, at=1)
plt.show(interactive=1)

plt.close()
plt2.close()
plt1.close()

Screenshot from 2021-05-05 21-06-15

Read more comments on GitHub >

github_iconTop Results From Across the Web

Merge multiple objects inside the same array into one object
This solution, simply gathers all the keys and their values in every object in the result , which is finally returned to us...
Read more >
How to create an array of objects from multiple arrays in ...
In this article, we will try to understand how we may create an array of objects from multiple arrays in JavaScript. Let us...
Read more >
JavaScript Array of Objects Tutorial – How to Create, Update ...
Add a new object at the start - Array.​​ To add an object at the first position, use Array. unshift .
Read more >
Append an Item at the End of an Array in JavaScript or Node.js
This tutorial shows you three ways of appending new items to the end of an existing array. Node.js Series Overview. Node.js; Strings; Streams ......
Read more >
How to Save a NumPy Array to File for Machine Learning
NPZ File (compressed). 1. Save NumPy Array to .CSV File (ASCII). The most common file format for storing numerical data in files is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found