Mesh called back from pickle, not work for rs.projectcurvetomesh

Hello all,

I saved a mesh as a .dat file using pickle and call back to a python component in rhino
however, I found that the rs.projectcurvetomesh function does not accept the mesh file
but when i pass the mesh variable from one py component to another one
it works again.

What is happening?

If the curve/mesh comes as a standalone entity, possibly the curve/mesh should be added to the document.

Try:

import scriptcontext as sc
mesh_id = sc.doc.Objects.Add(my_mesh)

Does it help? If not, post a sample, please.

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

I see. however, there is no Add method in sc.doc. is that in a different path?

update: I found Add in sc.doc.Objects.Add. and it works so fine

I am quite confused about the meaning of the documents.
in my mind, it seems that guid type is used in ghdoc. It means that I have to change the document to Rhino doc to open the file i call back from the .dat file?

thanks again

1 Like

Yes, sorry I wrote it by heart. I edited the original post.

Thanks dude !

1 Like

Grasshopper does not have native components for text that is geometry. What is available, are RhinoScript command that edit the Rhino document directly. That’s why you need to switch target.

1 Like

I got it. It seems Rhino commands are more primary to use with python, no need to change formats first. But I think it is quite hard to learn :joy:
thanks again for everything :grinning: