protected override void Initialize() { base.Initialize(); if (Doc != null) Doc.SolutionEnd += OnDocSolutionEnd; m_py = PythonScript.Create(); if (m_py != null) { //UnpackScriptResources(); SetScriptTransientGlobals(); m_py.Output = m_py_output.Write; m_py.SetVariable("__name__", "__main__"); m_env = new PythonEnvironment(this, m_py); m_py.SetVariable(PARENT_ENVIRONMENT_NAME, m_env); m_py.SetIntellisenseVariable(PARENT_ENVIRONMENT_NAME, m_env); m_py.ContextId = 2; // 2 is Grasshopper m_env.LoadAssembly(typeof(GH_Component).Assembly); //add Grasshopper.dll reference } }
protected override void Initialize() { base.Initialize(); if (Doc != null) Doc.SolutionEnd += OnDocSolutionEnd; _py = PythonScript.Create(); if (_py != null) { SetScriptTransientGlobals(); _py.Output = m_py_output.Write; _py.SetVariable("__name__", "__main__"); _env = new PythonEnvironment(this, _py); _py.SetVariable(PARENT_ENVIRONMENT_NAME, _env); _py.SetIntellisenseVariable(PARENT_ENVIRONMENT_NAME, _env); _py.ContextId = 2; // 2 is Grasshopper } }