本文整理汇总了C#中IGH_DataAccess.DisableGapLogic方法的典型用法代码示例。如果您正苦于以下问题:C# IGH_DataAccess.DisableGapLogic方法的具体用法?C# IGH_DataAccess.DisableGapLogic怎么用?C# IGH_DataAccess.DisableGapLogic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGH_DataAccess
的用法示例。
在下文中一共展示了IGH_DataAccess.DisableGapLogic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
DA.DisableGapLogic();
if (DA.Iteration <= 0)
{
// Solveinstance is being called as many times as the length
// of the input data. Why? Dunno. But it messes things up, outputting
// n*n data.
DA.SetDataTree(0, P.VolatileData);
DA.SetDataTree(1, P.History);
DA.SetData(2, lStep);
DA.SetData(3, cStep);
}
}
示例2: SafeSolveInstance
protected override void SafeSolveInstance(IGH_DataAccess 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;
//.........这里部分代码省略.........
示例3: SafeSolveInstance
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);
//.........这里部分代码省略.........