protected override void SafeSolveInstance(IGH_DataAccess DA)
        {
            if (_py == null)
            {
                DA.SetData(0, "No Python engine available. This component needs Rhino v5");
                return;
            }

            DA.DisableGapLogic(0);

            m_py_output.Reset();

            var rhdoc       = RhinoDoc.ActiveDoc;
            var prevEnabled = (rhdoc != null) && rhdoc.Views.RedrawEnabled;

            try
            {
                // set output variables to "None"
                for (int i = HideCodeOutput ? 0 : 1; i < Params.Output.Count; i++)
                {
                    string varname = Params.Output[i].NickName;
                    _py.SetVariable(varname, null);
                }

                // caching variable to keep things as fast as possible
                bool showing_code_input = CodeInputVisible;
                // Set all input variables. Even null variables may be used in the
                // script, so do not attempt to skip these for optimization purposes.
                // Skip "Code" input parameter
                // Please pay attention to the input data structure type
                for (int i = showing_code_input ? 1 : 0; i < Params.Input.Count; i++)
                {
                    string varname = Params.Input[i].Name; // ksteinfe: changed from Params.Input[i].Nickname
                    object o       = _marshal.GetInput(DA, i);
                    _py.SetVariable(varname, o);
                    //_py.SetIntellisenseVariable(varname, o); // ksteinfe: i think this set the Intellisense thingos for all the input variables.  we are converting, so Intellisense would just be confusing.
                }

                // the "code" string could be embedded in the component itself
                if (showing_code_input || _compiled_py == null)
                {
                    string script;
                    if (!showing_code_input)
                    {
                        script = CodeInput;
                    }
                    else
                    {
                        script = null;
                        DA.GetData(0, ref script);
                    }

                    if (string.IsNullOrWhiteSpace(script))
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "No script to execute");
                        return;
                    }

                    // ksteinfe - i think we put our hack here.
                    //_py.ExecuteScript(DcPython.Decodes.DecodesAppendedCode.header);
                    //script = script + DcPython.Decodes.DecodesAppendedCode.footer;
                    script = DcPython.Decodes.DecodesAppendedCode.header + script + DcPython.Decodes.DecodesAppendedCode.footer;

                    if (_compiled_py == null ||
                        string.Compare(script, _previousRunCode, StringComparison.InvariantCulture) != 0)
                    {
                        if (!(_inDocStringsMode = DocStringUtils.FindApplyDocString(script, this)))
                        {
                            ResetAllDescriptions();
                        }
                        _compiled_py     = _py.Compile(script);
                        _previousRunCode = script;
                    }
                }

                if (_compiled_py != null)
                {
                    _compiled_py.Execute(_py);
                    // Python script completed, attempt to set all of the
                    // output paramerers
                    for (int i = HideCodeOutput ? 0 : 1; i < Params.Output.Count; i++)
                    {
                        string varname = Params.Output[i].NickName;
                        object o       = _py.GetVariable(varname); // ksteinfe: this is a tree coming in from gh python out.  can we just scan the tree and grab the attributes to store somewhere, then bake each param?
                        _marshal.SetOutput(o, DA, i);
                    }
                }
                else
                {
                    m_py_output.Write("There was a permanent error parsing this script. Please report to [email protected].");
                }
            }
            catch (Exception ex)
            {
                AddErrorNicely(m_py_output, ex);
                SetFormErrorOrClearIt(DA, m_py_output);
                throw;
            }
            finally
            {
                if (rhdoc != null && prevEnabled != rhdoc.Views.RedrawEnabled)
                {
                    rhdoc.Views.RedrawEnabled = true;
                }
            }
            SetFormErrorOrClearIt(DA, m_py_output);
        }
        protected override void SafeSolveInstance(IGH_DataAccess da)
        {
            m_env.DataAccessManager = da;

            if (m_py == null)
            {
                da.SetData(0, "No Python engine available. This component needs Rhino v5");
                return;
            }

            if (!HiddenOutOutput)
            {
                da.DisableGapLogic(0);
            }

            m_py_output.Reset();

            var rhdoc       = RhinoDoc.ActiveDoc;
            var prevEnabled = (rhdoc != null) && rhdoc.Views.RedrawEnabled;

            try
            {
                // set output variables to "None"
                for (int i = HiddenOutOutput ? 0 : 1; i < Params.Output.Count; i++)
                {
                    string varname = Params.Output[i].NickName;
                    m_py.SetVariable(varname, null);
                }

                // caching variable to keep things as fast as possible
                bool showing_code_input = !HiddenCodeInput;
                // Set all input variables. Even null variables may be used in the
                // script, so do not attempt to skip these for optimization purposes.
                // Skip "Code" input parameter
                // Please pay attention to the input data structure type
                for (int i = showing_code_input ? 1 : 0; i < Params.Input.Count; i++)
                {
                    string varname = Params.Input[i].NickName;
                    object o       = m_marshal.GetInput(da, i);
                    m_py.SetVariable(varname, o);
                    m_py.SetIntellisenseVariable(varname, o);
                }

                // the "code" string could be embedded in the component itself
                if (showing_code_input || m_compiled_py == null)
                {
                    string script;
                    if (!showing_code_input)
                    {
                        script = Code;
                    }
                    else
                    {
                        script = null;
                        da.GetData(0, ref script);
                    }

                    if (string.IsNullOrWhiteSpace(script))
                    {
                        AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "No script to execute");
                        return;
                    }

                    if (m_compiled_py == null ||
                        string.Compare(script, m_previousRunCode, StringComparison.InvariantCulture) != 0)
                    {
                        if (!(m_inDocStringsMode = DocStringUtils.FindApplyDocString(script, this)))
                        {
                            ResetAllDescriptions();
                        }
                        m_compiled_py     = m_py.Compile(script);
                        m_previousRunCode = script;
                    }
                }

                if (m_compiled_py != null)
                {
                    string localPath;
                    bool   added = AddLocalPath(out localPath);

                    m_compiled_py.Execute(m_py);

                    if (added)
                    {
                        RemoveLocalPath(localPath);
                    }

                    // Python script completed, attempt to set all of the
                    // output paramerers
                    for (int i = HiddenOutOutput ? 0 : 1; i < Params.Output.Count; i++)
                    {
                        string varname = Params.Output[i].NickName;
                        object o       = m_py.GetVariable(varname);
                        m_marshal.SetOutput(o, da, i);
                    }
                }
                else
                {
                    m_py_output.Write("There was a permanent error parsing this script. Please report to [email protected].");
                }
            }
            catch (Exception ex)
            {
                AddErrorNicely(m_py_output, ex);
                SetFormErrorOrClearIt(da, m_py_output);
                throw;
            }
            finally
            {
                if (rhdoc != null && prevEnabled != rhdoc.Views.RedrawEnabled)
                {
                    rhdoc.Views.RedrawEnabled = true;
                }
            }
            SetFormErrorOrClearIt(da, m_py_output);
        }