Retrieve userstring from geometry

Hi @fraguada

Perhaps you can help me with this one. I am trying to retrieve the userdata stored in a geometry of an object after loading a file with the 3dmloader. When I log the object to the console I can see the userStringCount: 2 but I don’t see any property containing the userstring itself:

Any advice on how to retreive the userdata? Let me know if you need any more context.

Does this help?

https://mcneel.github.io/rhino3dm/javascript/api/CommonObject.html#getUserString

– Dale

@dale I believe at this point the geometries have been converted to three.js objects by the 3dmloader. Is this property transferred from ‘CommonObject’ to the three.js objects by the loader? and if so, how to get ahold of it?

@dale could you point me in the right direction or who could help me figuring this out?

Sorry @dadandroid, I don’t know anything about three.js.

@fraguada - is this something you can help with?

@dadandroid I am getting the strings in threejs r137 which uses rhino3dm.js 7.11.1

this would be on:
child.userData.attributes.userStrings, not on the geometry which doesn’t seem to be coming through. I’ll check on this.

1 Like

@fraguada indeed I’m able to get ahold of the geometry userstrings by copying them to the object attribute’ s userstring, but I cannot acces the geometry userstrings directly from a gh definition as I think I should be able to, if that makes sanse.

Here is a sample that showcases the issue if it´s any help. userstrings.zip (16.9 KB)

I baked a curve from your gh def and saved the 3dm. I do see the geometry user strings come through:

I think you are still using the 3dmLoader from threejs r124 and there were updates to the userString stuff after that. Update your threejs version (currently at 137) and I think it will fix this issue.

@fraguada once I update my modules to 137 I get an error in the console:


any idea why?

ok I got passed that using import maps as adviced here and I can see the geometry userstrings now. Thanks @fraguada

1 Like