Set UserString on a mesh face


Is there a way to put some UserString on a mesh face?
I can easely get a ON_MeshFaceRef:
ON_MeshFaceRef refFACE = pMESH->FaceRef( 99 );
SetUserString is available on it:
bool bSetUS = refFACE.SetUserString( L"test", “1234” );
returned bSetUS is “true”…
But _GetUserText always returns on faces in the documents…

Any idea/sugestion ?


(Dale Fugier) #2

Hi @fthomas,

In order to store user data or user text, the object needs to be derived from ON_Object. ON_MeshFace does not derive from ON_Object. And ON_MeshFaceRef are not persistent, so this isn’t a good object to use.

Your best bet is to add some user data, perhaps a dictionary or hash set, to ON_Mesh, that stores the face index and the corresponding text.

Does this help?

– Dale


Hi Dale,

Thank you for your help.

Kind regards,