Hi,
I ran into an issue where I could not purge some usertext entries with python rhinoscript
specifically these type of entries:
In userdata.py the method GetDocumentUserText pointed to the cause, apparently there was a need to filter escape characters for reasons unknown to me:
I
#todo: leaky abstraction: "\\" logic should be inside doc.Strings implementation
keys = [scriptcontext.doc.Strings.GetKey(i) for i in range(scriptcontext.doc.Strings.Count) if not "\\" in scriptcontext.doc.Strings.GetKey(i)]
I’d like to purge the document form all userdata and want do it like so:
import rhinoscriptsyntax as rs
import scriptcontext as sc
keys = [sc.doc.Strings.GetKey(i) for i in range(sc.doc.Strings.Count)]
for key in keys:
rs.SetDocumentUserText(str(key),'')
It clears all entries including those with the escape-characters.
However given the comment in the python method, I’d like to know if and what danger there lies in not filtering out keys with escape characters.
Thanks
-Willem