本文整理汇总了C#中IGH_DataAccess.SetData方法的典型用法代码示例。如果您正苦于以下问题:C# IGH_DataAccess.SetData方法的具体用法?C# IGH_DataAccess.SetData怎么用?C# IGH_DataAccess.SetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGH_DataAccess
的用法示例。
在下文中一共展示了IGH_DataAccess.SetData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetOutputs
protected override void SetOutputs(IGH_DataAccess da)
{
desiredVelocity = CalculateDesiredVelocity();
Vector3d appliedForce = ApplyDesiredVelocity();
da.SetData(nextOutputIndex++, appliedForce);
da.SetData(nextOutputIndex++, desiredVelocity);
}
示例2: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
string name = null;
GH_Plane tcp = null;
double weight = 0;
GH_Mesh mesh = null;
GH_Point centroid = null;
List<GH_Plane> planes = new List<GH_Plane>();
if (!DA.GetData(0, ref name)) { return; }
if (!DA.GetData(1, ref tcp)) { return; }
DA.GetDataList(2, planes);
if (!DA.GetData(3, ref weight)) { return; }
DA.GetData(4, ref centroid);
DA.GetData(5, ref mesh);
var tool = new Tool(tcp.Value, name, weight, centroid?.Value, mesh?.Value);
if (planes.Count > 0)
{
if (planes.Count != 4)
this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, " Calibration input must be 4 planes");
else
tool.FourPointCalibration(planes[0].Value, planes[1].Value, planes[2].Value, planes[3].Value);
}
DA.SetData(0, new GH_Tool(tool));
DA.SetData(1, tool.Tcp);
}
示例3: SetOutputs
protected override void SetOutputs(IGH_DataAccess da)
{
da.SetData(nextOutputIndex++, agent.MaxSpeed);
da.SetData(nextOutputIndex++, agent.MaxForce);
da.SetData(nextOutputIndex++, agent.VisionRadius);
da.SetData(nextOutputIndex++, agent.VisionAngle);
}
示例4: SetOutputs
protected override void SetOutputs(IGH_DataAccess da)
{
//da.SetDataList(nextOutputIndex++, particle.velocity3DHistory.ToList());
da.SetData(nextOutputIndex++, particle.Velocity3D);
if (particle.Environment.GetType() == typeof (SurfaceEnvironmentType))
{
da.SetData(nextOutputIndex++, particle.Velocity);
}
}
示例5: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
// Indata
WR_Utilisation util = null;
if (!DA.GetData(0, ref util)) { return; }
DA.SetData(0, util.GetUtilisationDegree());
DA.SetData(1, util.ToString());
}
示例6: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
ResultElement res = null;
if (!DA.GetData(0, ref res)) { return; }
DA.SetData(0, new Line(res.sPos, res.ePos));
DA.SetData(1, CrossSectionCasts.GetRhinoString(res.SectionPropertyString));
DA.SetData(2, res.elNormal);
}
示例7: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
WR_Structure struc = null;
if(!DA.GetData(0, ref struc)) { return; }
DA.SetData(0, struc.GetWeight());
DA.SetData(1, struc.NodeCount);
DA.SetData(2, struc.ElementCount);
}
示例8: SetOutputs
protected override void SetOutputs(IGH_DataAccess da)
{
if (!apply)
{
da.SetData(nextOutputIndex++, false);
return;
}
bool behaviorApplied = Run();
da.SetData(nextOutputIndex++, behaviorApplied);
}
示例9: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
DHr dhr = new DHr();
if (DA.GetData(0, ref dhr))
{
DA.SetData(0, dhr.hr);
DA.SetDataList(1, dhr.keys);
DA.SetDataList(2, dhr.values);
DA.SetData(3, dhr.color);
DA.SetData(4, dhr.pos);
}
}
示例10: SolveInstance
protected override void SolveInstance(IGH_DataAccess da)
{
bool set = false;
da.GetData(PInSet, ref set);
bool reset = false;
da.GetData(PInReset, ref reset);
if (set) FOutput = true;
else if (reset) FOutput = false;
da.SetData(POutOutput, FOutput);
da.SetData(POutInverseOutput, !FOutput);
}
示例11: SolveInstance
/// <summary>
/// This is the method that actually does the work.
/// </summary>
/// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
protected override void SolveInstance(IGH_DataAccess DA)
{
//Input
Object[] output = new Object[2];
DA.GetData(0, ref output);
//Casting
Point3d pt = (Point3d) output[0];
Vector3d force = (Vector3d) output[1];
//Output
DA.SetData(0, pt);
DA.SetData(1, force);
}
示例12: SolveInstance
/// <summary>
/// This is the method that actually does the work.
/// </summary>
/// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
protected override void SolveInstance(IGH_DataAccess DA)
{
//Input
Line line = new Line();
DA.GetData(0, ref line);
double eModulus = 0.0;
DA.GetData(1, ref eModulus);
double area = 0.0;
DA.GetData(2, ref area);
double preStress = 0.0;
if (this.Params.Input[3].SourceCount != 0)
{
DA.GetData(3, ref preStress);
}
//Create instance of bar
GoalObject cableElement = new CableGoal(line, eModulus, area, preStress);
//Output
DA.SetData(0, cableElement);
}
示例13: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
SpringMesh iSpringMesh = null;
DA.GetData<SpringMesh>("Spring Mesh", ref iSpringMesh);
DA.SetData("Rhino Mesh", iSpringMesh.ConvertToRhinoMesh());
}
示例14: SolveInstance
/// <summary>
/// This is the method that actually does the work.
/// </summary>
/// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
protected override void SolveInstance(IGH_DataAccess DA)
{
//Input
Point3d supportPt = new Point3d();
DA.GetData(0, ref supportPt);
bool isXFixed = true;
DA.GetData(1, ref isXFixed);
bool isYFixed = true;
DA.GetData(2, ref isYFixed);
bool isZFixed = true;
DA.GetData(3, ref isZFixed);
double weight = 1.0;
DA.GetData(4, ref weight);
//Warning if no direction is fixed
if (!isXFixed && !isYFixed && !isZFixed)
{
this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "The specified point is free to move!");
}
//Create simple support goal
GoalObject support = new SupportGoal(supportPt, isXFixed, isYFixed, isZFixed, weight);
//Output
DA.SetData(0, support);
}
示例15: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
string name = null;
GH_RobotSystem robotSystem = null;
var initCommandsGH = new List<GH_Command>();
var targetsA = new List<GH_Target>();
var targetsB = new List<GH_Target>();
var multiFileIndices = new List<int>();
double stepSize = 1;
if (!DA.GetData(0, ref name)) { return; }
if (!DA.GetData(1, ref robotSystem)) { return; }
if (!DA.GetDataList(2, targetsA)) { return; }
DA.GetDataList(3, targetsB);
DA.GetDataList(4, initCommandsGH);
DA.GetDataList(5, multiFileIndices);
if (!DA.GetData(6, ref stepSize)) { return; }
var initCommands = initCommandsGH.Count > 0 ? new Robots.Commands.Group(initCommandsGH.Select(x => x.Value)) : null;
var targets = new List<IEnumerable<Target>>();
targets.Add(targetsA.Select(x => x.Value));
if (targetsB.Count > 0) targets.Add(targetsB.Select(x => x.Value));
var program = new Program(name, robotSystem.Value, targets, initCommands, multiFileIndices, stepSize);
DA.SetData(0, new GH_Program(program));
if (program.Code != null)
{
var path = DA.ParameterTargetPath(2);
var structure = new GH_Structure<GH_String>();
for (int i = 0; i < program.Code.Count; i++)
{
var tempPath = path.AppendElement(i);
for (int j = 0; j < program.Code[i].Count; j++)
{
structure.AppendRange(program.Code[i][j].Select(x => new GH_String(x)), tempPath.AppendElement(j));
}
}
DA.SetDataTree(1, structure);
}
DA.SetData(2, program.Duration);
if (program.Warnings.Count > 0)
{
DA.SetDataList(3, program.Warnings);
this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Warnings in program");
}
if (program.Errors.Count > 0)
{
DA.SetDataList(4, program.Errors);
this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Errors in program");
}
}