• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IGH_DataAccess类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IGH_DataAccess的典型用法代码示例。如果您正苦于以下问题:C# IGH_DataAccess类的具体用法?C# IGH_DataAccess怎么用?C# IGH_DataAccess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IGH_DataAccess类属于命名空间,在下文中一共展示了IGH_DataAccess类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GH_Program program = null;
            GH_String ip = null;

            if (!DA.GetData(0, ref program)) { return; }

            var robotCellUR = program.Value.RobotSystem as RobotCellUR;
            if (DA.GetData(1, ref ip) && ip != null)
                robotCellUR.Remote.IP = ip.Value;

            bool connect = false, upload = false, play = false, pause = false;
            if (!DA.GetData("Connect", ref connect)) { return; }
            if (!DA.GetData("Upload", ref upload)) { return; }
            if (!DA.GetData("Play", ref play)) { return; }
            if (!DA.GetData("Pause", ref pause)) { return; }

            if (connect && !connected) { robotCellUR.Remote.Connect(); connected = true; }
            if (!connect && connected) { robotCellUR.Remote.Disconnect(); connected = false; }
            if (upload && connected) robotCellUR.Remote.UploadProgram(program.Value);
            if (play && connected) robotCellUR.Remote.Play();
            if (pause && connected) robotCellUR.Remote.Pause();

            DA.SetDataList(0, robotCellUR.Remote.Log);
        }
开发者ID:visose,项目名称:Robots,代码行数:25,代码来源:Remote.cs


示例2: SolveInstance

        protected override void SolveInstance(IGH_DataAccess da)
        {
            //Process input
            double increment = 0;
            da.GetData(PInIncrement, ref increment);

            bool up = false;
            da.GetData(PInUp, ref up);
            if (up) FCounter += increment;

            bool down = false;
            da.GetData(PInDown, ref down);
            if (down) FCounter -= increment;

            double defaultValue = 0.0;
            da.GetData(PInDefault, ref defaultValue);

            bool reset = false;
            da.GetData(PInReset, ref reset);
            if (reset) FCounter = defaultValue;

            double min = 0.0;
            da.GetData(PInMinimum, ref min);
            if (FCounter < min) FCounter = min;

            double max = 0.0;
            da.GetData(PInMaximum, ref max);
            if (FCounter > max) FCounter = max;

            //Output
            da.SetData(POutOutput, FCounter);
        }
开发者ID:smakhtin,项目名称:BoolFrog,代码行数:32,代码来源:Counter.cs


示例3: 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");
            }
        }
开发者ID:visose,项目名称:Robots,代码行数:60,代码来源:Program.cs


示例4: 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;
 }
开发者ID:lxfschr,项目名称:Quelea,代码行数:7,代码来源:AvoidUnalignedCollisionForceComponent.cs


示例5: SetOutputs

 protected override void SetOutputs(IGH_DataAccess da)
 {
   int n = vehicle.Wheels.Length;
   da.SetData(nextOutputIndex++, vehicle.Orientation);
   List<Point3d> wheelPositions = new List<Point3d>(n);
   List<Vector3d> wheelVelocities = new List<Vector3d>(n);
   List<double> wheelAngles = new List<double>(n);
   List<double> wheelRadii = new List<double>(n);
   List<double> wheelSpeeds = new List<double>(n);
   foreach (IWheel wheel in vehicle.Wheels)
   {
     wheelPositions.Add(wheel.Position);
     Vector3d wheelVelocity = vehicle.Velocity;
     wheelVelocity.Unitize();
     wheelVelocity = Vector3d.Multiply(wheelVelocity, wheel.TangentialVelocity);
     wheelVelocities.Add(wheelVelocity);
     wheelAngles.Add(wheel.Angle);
     wheelRadii.Add(wheel.Radius);
     wheelSpeeds.Add(wheel.AngularVelocity);
   }
   da.SetDataList(nextOutputIndex++, wheelPositions);
   da.SetDataList(nextOutputIndex++, wheelVelocities);
   da.SetDataList(nextOutputIndex++, wheelAngles);
   da.SetDataList(nextOutputIndex++, wheelRadii);
   da.SetDataList(nextOutputIndex++, wheelSpeeds);
 }
开发者ID:lxfschr,项目名称:Quelea,代码行数:26,代码来源:DeconstructVehicleComponent.cs


示例6: GetInputs

 /// <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 bool GetInputs(IGH_DataAccess da)
 {
   if (!base.GetInputs(da)) return false;
   if (!da.GetData(nextInputIndex++, ref targetPt)) return false;
   targetPt = agent.Environment.MapTo2D(targetPt);
   return true;
 }
开发者ID:lxfschr,项目名称:Quelea,代码行数:11,代码来源:AbstractSeekForceComponent.cs


示例7: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
#if DEBUG
            Rhino.RhinoApp.WriteLine("Designer " + this.Name + " is solving");
#endif
            
            // check if the controller is online
            SOGrasshopperController con = SOGrasshopperController.GetInstance(OnPingDocument());

            List<SODesigner_GHData> designerList = new List<SODesigner_GHData>();
            DA.GetDataList<SODesigner_GHData>(0, designerList);
            this.m_Designer.ClearDesigners();
            foreach (SODesigner_GHData data in designerList)
            {
                this.m_Designer.AddDesigner(data.Value);
            }
            
            if (this.m_Designer == null) { return; }
            try
            {
                this.m_Designer.RunDesigner();
            }
            catch (Exception)
            {
                return;
            }

            // return the designer data
            SODesigner_GHData data1 = new SODesigner_GHData(this.m_Designer);
            DA.SetData(0, data1);
#if DEBUG
            Rhino.RhinoApp.WriteLine("> Controller state: " + SOController.Instance.State.ToString());
#endif
        }
开发者ID:sustainability-open,项目名称:sustainability-open,代码行数:34,代码来源:SODesigner_Component.cs


示例8: 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);
        }
开发者ID:CecilieBrandt,项目名称:K2Engineering,代码行数:36,代码来源:Support.cs


示例9: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            SpringMesh iSpringMesh = null;
            DA.GetData<SpringMesh>("Spring Mesh", ref iSpringMesh);

            DA.SetData("Rhino Mesh", iSpringMesh.ConvertToRhinoMesh());
        }
开发者ID:GeneKao,项目名称:Pavilion2015_ITECH,代码行数:7,代码来源:GHC_SpringMeshToRhinoMesh.cs


示例10: 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);
        }
开发者ID:parkjunseok,项目名称:Beaver,代码行数:29,代码来源:Beaver.cs


示例11: SolveInstance

 protected override void SolveInstance(IGH_DataAccess da)
 {
     if (!GetInputs(da)) return;
     connect = new List<Line>();
     weight = new List<double>();
     Random rand = new Random(DateTime.Now.Millisecond);
     float[,,] value = env.getTrails();
     float maxv = env.getMaxTrailValue();
     Point3d[,,] pos = env.getPosition();
     for (int i = 0; i < env.u; i++)
     {
         for (int j = 0; j < env.v; j++)
         {
             for (int k = 0; k < env.w; k++)
             {
                 if (rand.NextDouble() > (value[i, j, k]  / maxv) * possib)
                     continue;
                 Point3d thispt = pos[i,j,k];
                 List<Point3d> neighbor = env.getNeighbourTrailClosePos(i,j,k,radius, near_level);
                 foreach (Point3d pt in neighbor)
                 {
                     if (rand.NextDouble() < (value[i, j, k] / maxv)  * 0.5)
                     {
                         connect.Add(new Line(pt, thispt));
                         Point3d indexpos = env.getIndexByPosition(pt.X, pt.Y, pt.Z);
                         weight.Add(value[i, j, k] + value[(int)indexpos.X, (int)indexpos.Y, (int)indexpos.Z]);
                     }
                 }
             }
         }
     }
     SetOutputs(da);
 }
开发者ID:maajor,项目名称:Physarealm,代码行数:33,代码来源:FieldInterconnectComponent.cs


示例12: SolveInstance

 protected override void SolveInstance(IGH_DataAccess da)
 {
     if (!GetInputs(da)) return;
     if (reset == true)
     {
         trailTree = new DataTree<Point3d>();
         iter = 0;
         maxid = 0;
     }
     else
     {
         foreach (Amoeba amo in p.population)
         {
             GH_Path thispath = new GH_Path(amo.ID);
             if (amo.ID > maxid)
             {
                 trailTree.Add(amo.prev_loc, thispath);
                 maxid = amo.ID;
             }
             trailTree.Add(amo.Location, thispath);
             if (trailTree.Branch(thispath).Count > history)
             {
                 trailTree.Branch(thispath).RemoveAt(0);
             }
         }
         foreach (int id in p._todie_id)
         {
             GH_Path thispath = new GH_Path(id);
             trailTree.Branch(thispath).Clear();
         }
         iter++;
     }
     SetOutputs(da);
 }
开发者ID:maajor,项目名称:Physarealm,代码行数:34,代码来源:PopulationTrailComponent.cs


示例13: GetInputs

 protected override bool GetInputs(IGH_DataAccess da)
 {
     if (!da.GetData(0, ref p)) return false;
     if (!da.GetData(1, ref history)) return false;
     if (!da.GetData(2, ref reset)) return false;
     return true;
 }
开发者ID:maajor,项目名称:Physarealm,代码行数:7,代码来源:PopulationTrailComponent.cs


示例14: 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);
        }
开发者ID:IsakNaslund,项目名称:MasterThesis,代码行数:29,代码来源:ConstructBeam.cs


示例15: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            if (this.Analysis == null) { return; }

            base.SolveInstance(DA);
            DA.SetData(1, ((QTOAnalysis)this.Analysis).TextualOutput);
        }
开发者ID:sustainability-open,项目名称:sustainability-open,代码行数:7,代码来源:QTOAnalysis_Component.cs


示例16: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Declare a variable for the input
            GH_Model model = null;

            // Use the DA object to retrieve the data inside the first input parameter.
            // If the retieval fails (for example if there is no data) we need to abort.
            if (!DA.GetData(0, ref model)) { return; }

            List<Vector3d> displacementVectors = new List<Vector3d>();
            List<Point3d> displacedPoints = new List<Point3d>();
            List<GeometryBase> displacedElements = new List<GeometryBase>();

            for (int i = 0; i < model.Nodes.Count; i++) {
                Vector3d vector = model.GetNodeDisplacement(i);
                Point3d point = model.GetDisplacedPoint(i);
                displacementVectors.Add(vector);
                displacedPoints.Add(point);
            }

            foreach (GH_Element element in model.Elements) {

                displacedElements.Add(element.GetDeformedGeometry(model));

            }

            DA.SetDataList(0, displacementVectors);
            DA.SetDataList(1, displacedPoints);
            DA.SetDataList(2, displacedElements);
        }
开发者ID:AndreasBak,项目名称:GrasshopperSharpFE,代码行数:30,代码来源:NodeDisplacementResultsComponent.cs


示例17: 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;
    }
开发者ID:lxfschr,项目名称:Quelea,代码行数:25,代码来源:AbstractVehicleForceComponent.cs


示例18: 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);
        }
开发者ID:visose,项目名称:Robots,代码行数:29,代码来源:Machine.cs


示例19: 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
            List<Line> bars = new List<Line>();
            if(!DA.GetDataList(0, bars)) { return; }

            List<Point3d> nodes = new List<Point3d>();
            if(!DA.GetDataList(1, nodes)) { return; }

            List<double> displacements = new List<double>();
            if(!DA.GetDataList(2, displacements)) { return; }

            List<Color> gradientColours = new List<Color>();
            if(!DA.GetDataList(3, gradientColours)) { return; }


            //Calculate
            lines = new List<Line>();
            for(int i=0; i<bars.Count; i++)
            {
                lines.Add(bars[i]);
            }

            List<double> barDispl = calcBarDisplacements(bars, nodes, displacements);
            colours = mapDisplToColour(barDispl, gradientColours);

        }
开发者ID:CecilieBrandt,项目名称:K2Engineering,代码行数:31,代码来源:DisplacementVisualisation.cs


示例20: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var location = default(Plane);
            var text = default(string);
            var size = default(double);
            var bold = default(bool);
            var hAlign = default(int);
            var vAlign = default(int);

            if (!DA.GetData(0, ref location)) return;
            if (!DA.GetData(1, ref text)) return;
            if (!DA.GetData(2, ref size)) return;
            if (!DA.GetData(3, ref bold)) return;
            if (!DA.GetData(4, ref hAlign)) return;
            if (!DA.GetData(5, ref vAlign)) return;

            var typeWriter = bold ? Typewriter.Bold : Typewriter.Regular;

            var position = location.Origin;
            var unitX = location.XAxis * size;
            var unitZ = location.YAxis * size;

            var curves = typeWriter.Write(text, position, unitX, unitZ, hAlign, vAlign);

            DA.SetDataList(0, curves);

            //FontWriter.Save(@"C:\Users\Thomas\Desktop\Test.xml", new[] { Typewriter.Regular, Typewriter.Bold });
        }
开发者ID:olitur,项目名称:Bowerbird,代码行数:28,代码来源:BBTextComponent.cs



注:本文中的IGH_DataAccess类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IGalleryObject类代码示例发布时间:2022-05-24
下一篇:
C# IFuture类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap