当前位置: 首页>>代码示例>>C#>>正文


C# IGH_DataAccess类代码示例

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


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


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