本文整理汇总了C#中IGH_DataAccess.GetData方法的典型用法代码示例。如果您正苦于以下问题:C# IGH_DataAccess.GetData方法的具体用法?C# IGH_DataAccess.GetData怎么用?C# IGH_DataAccess.GetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGH_DataAccess
的用法示例。
在下文中一共展示了IGH_DataAccess.GetData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
string name = String.Empty;
bool gravityOn = false;
Vector3d gravField = Vector3d.Unset;
List<PointLoadCarrier> ptLds = new List<PointLoadCarrier>();
if (!DA.GetData(0, ref name)) { return; }
if (!DA.GetData(1, ref gravityOn)) { return; }
if (!DA.GetData(2, ref gravField)) { return; }
if(!DA.GetDataList(3, ptLds))
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "No pointloads provided");
}
WR_LoadCombination loadComb;
if(gravityOn)
{
loadComb = new WR_LoadCombination(name, new WR_Vector(gravField.X, gravField.Y, gravField.Z));
}
else
{
loadComb = new WR_LoadCombination(name, gravityOn);
}
foreach (PointLoadCarrier plc in ptLds)
{
loadComb.AddPointLoad(plc.CIForce, plc.CIMoment, plc.CIPos);
}
DA.SetData(0, loadComb);
}
示例2: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
// string crossSection = "";
WR_IXSec xSec= null;
WR_ReleaseBeam3d stREl = null;
WR_ReleaseBeam3d enREl = null;
WR_Material mat = null;
WR_Element3dOptProp optProp = null;
if (!DA.GetData(0, ref xSec)) { return; }
if (!DA.GetData(1, ref stREl)) { return; }
if (!DA.GetData(2, ref enREl)) { return; }
if (!DA.GetData(3, ref mat)) { return; }
// Check releases
if (!CheckReleases(stREl, enREl))
return;
BeamProperties beamProp;
if (!DA.GetData(4, ref optProp))
beamProp = new BeamProperties(mat, xSec, stREl, enREl);
else
beamProp = new BeamProperties(mat, xSec, stREl, enREl, optProp);
DA.SetData(0, beamProp);
}
示例3: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
// Indata
WR_Structure structure = null;
bool go = false;
List<int> modes = new List<int>();
double sFac = 0;
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
if (!DA.GetData(0, ref structure)) { return; }
if (!DA.GetData(1, ref go)) { return; }
if (!DA.GetDataList(2, modes)) { return; }
if (!DA.GetData(3, ref sFac)) { return; }
if (go)
{
_resElems = new List<ResultElement>();
_log.Clear();
watch.Restart();
// Solve
WR_ModeShapeOptimizer optimizer = new WR_ModeShapeOptimizer(structure);
watch.Stop();
_log.Add(String.Format("Initialising: {0}ms", watch.ElapsedMilliseconds));
watch.Restart();
//Run
optimizer.Run(modes, sFac);
watch.Stop();
_log.Add(String.Format("Run mode shape optimization: {0}ms", watch.ElapsedMilliseconds));
watch.Restart();
// Extract results
List<WR_IElement> elems = structure.GetAllElements();
for (int i = 0; i < elems.Count; i++)
{
if (elems[i] is WR_Element3d)
{
WR_Element3d el3d = (WR_Element3d)elems[i];
ResultElement re = new ResultElement(el3d);
_resElems.Add(re);
}
}
watch.Stop();
_log.Add(String.Format("Extract results: {0}ms", watch.ElapsedMilliseconds));
}
DA.SetDataList(0, _log);
DA.SetDataList(1, _resElems);
}
示例4: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
// Declare a variable for the input String
string filename = null;
bool activate = false;
// 1. Declare placeholder variables and assign initial invalid data.
// This way, if the input parameters fail to supply valid data, we know when to abort.
// 2. Retrieve input data.
if (!DA.GetData(0, ref filename)) { return; }
if (!DA.GetData(1, ref activate)) { return; }
// If the retrieved data is Nothing, we need to abort.
if (filename == null) { return; }
if (!File.Exists(filename)) { return; }
if (activate)
{
GH_Cluster cluster = new GH_Cluster();
cluster.CreateFromFilePath(filename);
GH_Document doc = OnPingDocument();
doc.AddObject(cluster, false);
}
}
示例5: 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)
{
var parameters = new List<RhinoNestKernel.Nesting.RhinoNestObject>();
//Declaration.
var Object = new List<Guid>();
var orientation = new OrientationGoo();
var criterion = new CriterionGoo();
var copies = 0;
var priority = 0;
//clear value and get the objects.
if (!da.GetDataList(0, Object)) return;
da.GetData(1, ref copies);
da.GetData(2, ref priority);
da.GetData(3, ref orientation);
da.GetData(4, ref criterion);
var organizer = new RhinoNestKernel.Curves.OrganizeObjects(Object);
var res = organizer.Sort();
foreach (var rhinoNestObject in organizer.Result)
{
rhinoNestObject.Parameters.Priority = priority;
rhinoNestObject.Parameters.Copies = copies;
rhinoNestObject.Parameters.Criterion = criterion.Value.Constraint;
rhinoNestObject.Parameters.Orientation = orientation.Value.Constraint;
parameters.Add(rhinoNestObject);
}
//Put the list to Output.
da.SetDataList(0, parameters);
}
示例6: GetInputs
protected override bool GetInputs(IGH_DataAccess da)
{
if (!base.GetInputs(da)) return false;
if (!da.GetData(nextInputIndex++, ref mass)) return false;
if (!da.GetData(nextInputIndex++, ref lowerLimit)) return false;
if (!da.GetData(nextInputIndex++, ref upperLimit)) return false;
if (mass <= 0)
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, RS.massErrorMessage);
return false;
}
if (lowerLimit <= 0)
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Lower limit must be greater than 0.");
return false;
}
if (upperLimit <= 0)
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Upper limit must be greater than 0.");
return false;
}
if (upperLimit < lowerLimit)
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Upper limit must be greater than lower limit.");
return false;
}
return true;
}
示例7: 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)
{
String uri = "";
// Default values
String password = BIMPlusServer.Password;
String username = BIMPlusServer.Username;
//String serializer = BimPlusApi.Ifc2XSersializer;
DA.GetData<String>(0, ref uri);
DA.GetData(1, ref username);
DA.GetData(2, ref password);
//DA.GetData(3, ref serializer);
BIMPlusServer bimPlusServer = new BIMPlusServer();
try
{
bimPlusServer.authorize();
}
catch (System.IO.FileNotFoundException e)
{
Console.WriteLine(e.FileName);
}
}
示例8: SolveInstance
protected override void SolveInstance(IGH_DataAccess DA)
{
BeamProperties prop = null;
Line ln = Line.Unset;
Vector3d norm = Vector3d.Unset;
if (!DA.GetData(0, ref ln)) { return; }
if (!DA.GetData(1, ref prop)) { return; }
if (!DA.GetData(2, ref norm)) { return; }
norm.Unitize();
//Check if angle between tangent and normal is less than 1 degree
if(Vector3d.VectorAngle(norm, ln.UnitTangent) < 0.0174 || Vector3d.VectorAngle(-norm, ln.UnitTangent) < 0.0174)
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The given normal is within 1 degree of the tangent of the centre line. Please adjust normal");
return;
}
double factor = Utilities.GetScalingFactorFromRhino();
WR_Vector wrNorm = new WR_Vector(norm.X, norm.Y, norm.Z);
WR_XYZ st = new WR_XYZ(ln.FromX* factor, ln.FromY* factor, ln.FromZ* factor);
WR_XYZ en = new WR_XYZ(ln.ToX* factor, ln.ToY* factor, ln.ToZ* factor);
WR_Elem3dRcp beam = new WR_Elem3dRcp(st, en, prop.StartRelease, prop.EndRelease, prop.CrossSection, prop.Material, wrNorm, prop.OptimizationProperties);
DA.SetData(0, beam);
}
示例9: 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);
}
示例10: 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");
}
}
示例11: GetInputs
protected override bool GetInputs(IGH_DataAccess da)
{
if (!base.GetInputs(da)) return false;
if (!da.GetData(nextInputIndex++, ref minTimeToCollision)) return false;
if (!da.GetData(nextInputIndex++, ref potentialCollisionDistance)) return false;
return true;
}
示例12: GetInputs
protected override bool GetInputs(IGH_DataAccess da)
{
if(!base.GetInputs(da)) return false;
// First, we need to retrieve all data from the input parameters.
// Then we need to access the input parameters individually.
// When data cannot be extracted from a parameter, we should abort this method.
if (!da.GetData(nextInputIndex++, ref vehicle)) return false;
if (!da.GetData(nextInputIndex++, ref visionRadiusMultiplier)) return false;
if (!da.GetData(nextInputIndex++, ref visionAngleMultiplier)) return false;
if (!da.GetData(nextInputIndex++, ref crossed)) return false;
if (!(0.0 <= visionRadiusMultiplier && visionRadiusMultiplier <= 1.0))
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, RS.visionRadiusMultiplierErrorMessage);
return false;
}
if (!(0.0 <= visionAngleMultiplier && visionAngleMultiplier <= 1.0))
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, RS.visionAngleMultiplierErrorMessage);
return false;
}
sensorLeftPos = vehicle.GetSensorPosition(visionRadiusMultiplier, visionAngleMultiplier);
sensorRightPos = vehicle.GetSensorPosition(visionRadiusMultiplier, -visionAngleMultiplier);
return true;
}
示例13: 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);
}
示例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)
{
// 1. Get Input Data
Curve path=null;
DA.GetData(0, ref path);
Plane pathPlane=new Plane();
DA.GetData(1, ref pathPlane);
Curve section=null;
DA.GetData(2, ref section);
Plane sectionPlane=new Plane();
DA.GetData(3, ref sectionPlane);
// 2. Orientate section profile to path
Point3d origin = path.PointAtStart;
Vector3d xDir = pathPlane.Normal;
Vector3d yDir = path.TangentAt(path.Domain.T0);
yDir.Rotate(Rhino.RhinoMath.ToRadians(90.0), xDir);
Plane targetPlane = new Plane(origin,xDir,yDir);
section.Transform(Transform.PlaneToPlane(sectionPlane, targetPlane));
// 3. Generate Member
SweepOneRail sweep = new SweepOneRail();
Brep[] beam = sweep.PerformSweep(path, section);
DA.SetDataList(0, beam);
}