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


C# IGH_DataAccess.SetDataList方法代码示例

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


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

示例1: 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

示例2: 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)
        {
            // 1. Declare placeholder variables
            var struts = new List<Curve>();
            double tol = 0.0;
            // 2. Attempt to retrieve input
            if (!DA.GetDataList(0, struts)) { return; }
            if (!DA.GetData(1, ref tol)) { return; }
            // 3. Validate input
            if (struts == null || struts.Count == 1) { return; }
            if (tol < 0) { return; }

            // 4. Call cleaning method
            var nodes = new Point3dList();
            var nodePairs = new List<IndexPair>();
            struts = FrameTools.CleanNetwork(struts, tol, out nodes, out nodePairs);

            // 5. Organize index lists
            var strutStart = new List<int>();
            var strutEnd = new List<int>();
            foreach (IndexPair nodePair in nodePairs)
            {
                strutStart.Add(nodePair.I);
                strutEnd.Add(nodePair.J);
            }

            // 6. Set output
            DA.SetDataList(0, struts);
            DA.SetDataList(1, nodes);
            DA.SetDataList(2, strutStart);
            DA.SetDataList(3, strutEnd);

        }
开发者ID:smor,项目名称:intralattice,代码行数:37,代码来源:CleanNetworkComponent.cs

示例3: 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

示例4: 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);
     }
 }
开发者ID:ksteinfe,项目名称:dyear,代码行数:12,代码来源:Components+Primitive.cs

示例5: 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

示例6: 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

示例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)
        {
            //Input
            List<Line> bars = new List<Line>();
            DA.GetDataList(0, bars);


            //Calculate
            Point3d[] nodes = extractNodes(bars);
            double[] nodalLengths = calcNodalLengths(bars, nodes);


            //Output
            DA.SetDataList(0, nodes);
            DA.SetDataList(1, nodalLengths);
        }
开发者ID:CecilieBrandt,项目名称:K2Engineering,代码行数:20,代码来源:BarLength.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)
        {
            PlanktonMesh P = null;
            if (!DA.GetData(0, ref P)) return;

            List<Point3d> Positions = new List<Point3d>();
            List<int> OutHEdge = new List<int>();

            foreach (PlanktonVertex v in P.Vertices)
            {
                Positions.Add(new Point3f(v.X, v.Y, v.Z));
                OutHEdge.Add(v.OutgoingHalfedge);
            }
           
            List<int> StartV = new List<int>();
            List<int> AdjF = new List<int>();
            List<int> Next = new List<int>();
            List<int> Prev = new List<int>();
            List<int> Pair = new List<int>();

            for (int i = 0; i < P.Halfedges.Count; i++)
            {
                StartV.Add(P.Halfedges[i].StartVertex);
                AdjF.Add(P.Halfedges[i].AdjacentFace);
                Next.Add(P.Halfedges[i].NextHalfedge);
                Prev.Add(P.Halfedges[i].PrevHalfedge);
                Pair.Add(P.Halfedges.GetPairHalfedge(i));
            }
     
            List<int> FaceEdge = new List<int>();
            for (int i = 0; i < P.Faces.Count; i++)
            {
                FaceEdge.Add(P.Faces[i].FirstHalfedge);
            }

            DA.SetDataList(0, Positions);
            DA.SetDataList(1, OutHEdge);

            DA.SetDataList(2, StartV);
            DA.SetDataList(3, AdjF);
            DA.SetDataList(4, Next);
            DA.SetDataList(5, Prev);
            DA.SetDataList(6, Pair);

            DA.SetDataList(7, FaceEdge);    

        }
开发者ID:jackliu87,项目名称:Plankton,代码行数:51,代码来源:DecomposePlankton.cs

示例9: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Indata
            ResultElement re = null;
            string name = null;
            if (!DA.GetData(0, ref re)) { return; }

            if (!DA.GetData(1, ref name))
            {
                name = re.N1.First().Key;
            }

            DA.SetDataList(0, re.pos);
            DA.SetDataList(1, re.u[name]);
            DA.SetDataList(2, re.v[name]);
            DA.SetDataList(3, re.w[name]);
            DA.SetDataList(4, re.fi[name]);
        }
开发者ID:IsakNaslund,项目名称:MasterThesis,代码行数:18,代码来源:ElementDeformationsComponent.cs

示例10: SolveInstance

 protected override void SolveInstance(IGH_DataAccess DA)
 {
     HashType value = new HashType();
     DA.GetData("Hash", ref value);
     List<object> valuelist = new List<object>();
     valuelist.Add(value.Key);
     DA.SetDataList(0, valuelist);
     IEnumerable list = value.HashValue as IEnumerable;
     if (list != null)
     {
         DA.SetDataList(1, list);
     }
     else
     {
         List<object> outlist = new List<object>();
         outlist.Add(value.HashValue);
         DA.SetDataList(1, outlist);
     }
 }
开发者ID:arendvw,项目名称:ExportTools,代码行数:19,代码来源:ExplodeHashComponent.cs

示例11: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            AWorld refwrld = new AWorld();
            if (!DA.GetData(0, ref refwrld) || !refwrld.IsValid) return;
            AWorld wrld = new AWorld(refwrld);

            int g = 0;
            if (!DA.GetData(1, ref g)) return;
            if (g > wrld.GenCount - 1) g = wrld.GenCount - 1;
            DA.SetDataList(0, wrld.gens[g]);
        }
开发者ID:ksteinfe,项目名称:ants,代码行数:11,代码来源:AntsWorldBuilders.cs

示例12: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //container for errors/messages passed by controller, partition, etc.
            List<String> errorContainer = new List<String>();

            GH_PreviewUtil preview = new GH_PreviewUtil(true);

            //declare placeholder variables and assign initial empty mesh
            Mesh baseMesh = new Rhino.Geometry.Mesh();
            int errorMetricIdentifer = -1;
            int numPanels = -1;

            //Retrieve input data
            if (!DA.GetData(0, ref baseMesh)) { return; }
            if (!DA.GetData(1, ref errorMetricIdentifer)) { return; }
            if (!DA.GetData(2, ref numPanels)) { return; }

            if (baseMesh.DisjointMeshCount > 1)
            {
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Problem with mesh input - disjoint mesh");
            }
            else
            {
                //compute and unify normal
                baseMesh.Normals.ComputeNormals();
                baseMesh.UnifyNormals();

                //create wingedmesh from rhinomesh
                WingedMesh myMesh = new WingedMesh(errorContainer, baseMesh);

                PlanarMesher controller = new PlanarMesher(errorContainer, myMesh, baseMesh, numPanels, errorMetricIdentifer, preview);

                controller.createFirstCluster();

                for (int i = 0; i < 40; i++)
                {
                    controller.iterateCluster();
                    //controller.currentPartition.drawProxies(preview);
                }

                controller.createConnectivityMesh();

                //creating voronoi
                WingedMesh voronoiMesh = new WingedMesh(errorContainer, controller.currentPartition.proxyToMesh.convertWingedMeshToPolylines());

                //set all the output data
                DA.SetDataList(0, voronoiMesh.convertWingedMeshToPolylines());
            }

            foreach (var item in errorContainer)
            {
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, item);
            }
        }
开发者ID:formateng,项目名称:giraffe,代码行数:54,代码来源:LloydsComponent.cs

示例13: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ITurtleMesh m = null;
            if (DA.GetData(0, ref m))
            {
                List<ITurtleMesh> l = new List<ITurtleMesh>();
                for (int i = 0; i < m.FaceCount; i++)
                {
                    l.Add(ITurtleMeshExtensions.ExportFaceAt(m, i));
                }

                DA.SetDataList(0, l);
            }
        }
开发者ID:goznauk,项目名称:TurtleMesh,代码行数:14,代码来源:ExplodeTMeshesComponent.cs

示例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--------------------//
            PlanktonMesh pMesh = new PlanktonMesh();
            DA.GetData(0, ref pMesh);

            bool projXY = false;
            DA.GetData(1, ref projXY);



            //------------------CALCULATE--------------------//
            PMeshExt pMeshE = new PMeshExt(pMesh);

            if (!pMeshE.isMeshTriangulated())
            {
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The mesh has to be triangulated");
            }

            //Extract vertices from initial 3d pMesh
            Point3d[] verticesXYZ = pMeshE.convertVerticesToXYZ();

            //If projected then create new pMesh
            if (projXY)
            {
                pMeshE = pMeshE.projectMeshToXY();
            }

            Vector3d[] vertexAreas = pMeshE.calcVertexVoronoiAreas(projXY);



            //------------------OUTPUT--------------------//
            DA.SetDataList(0, verticesXYZ);
            DA.SetDataList(1, vertexAreas);
        }
开发者ID:CecilieBrandt,项目名称:K2Engineering,代码行数:40,代码来源:MeshVertexArea.cs

示例15: SetOutputs

 protected override void SetOutputs(IGH_DataAccess da)
 {
   da.SetDataList(nextOutputIndex++, particle.Position3DHistory.ToList());
   da.SetData(nextOutputIndex++, particle.Velocity3D);
   da.SetData(nextOutputIndex++, particle.PreviousAcceleration3D);
   da.SetData(nextOutputIndex++, particle.Lifespan);
   //da.SetData(nextOutputIndex++, particle.Mass);
   //da.SetData(nextOutputIndex++, particle.BodySize);
   if (particle.Environment.GetType() == typeof (SurfaceEnvironmentType))
   {
     da.SetData(nextOutputIndex++, particle.Position);
     da.SetData(nextOutputIndex++, particle.Velocity);
     da.SetData(nextOutputIndex++, particle.PreviousAcceleration);
   }
 }
开发者ID:lxfschr,项目名称:Quelea,代码行数:15,代码来源:DeconstructParticleComponent.cs


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