I tried to handle multiple documents issues on mac in a method called by a background thread:
def create_results(results, callback_data, msg=None):
parent_layer = callback_data["parent_layer"]
rs.AddLayer(parent_layer)
docId = callback_data["docId"]
old_doc = scriptcontext.doc
scriptcontext.doc = scriptcontext.doc.FromId(docId)
.....
except Exception as e:
print(e)
print("error happened in create_results")
finally:
scriptcontext.doc = old_doc
but somehow the results are still created sometimes in the wrong document. Do I need to use RhinoCommon to create the geometries or is there a way to use rhinoscriptsyntax