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


C# IGH_DataAccess.SetEnum2D方法代码示例

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


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

示例1: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // --- Input

            var mesh = default(Mesh);
            var countA = default(int);
            var countZ = default(int);
            var thickness = default(double);
            var plane = default(Plane);
            var radius = default(double);
            var deeper = default(double);
            var project = default(bool);
            var projectDistance = default(double);

            DA.GetData(0, ref mesh);
            DA.GetData(1, ref countA);
            DA.GetData(2, ref countZ);
            DA.GetData(3, ref thickness);
            DA.GetData(4, ref plane);
            DA.GetData(5, ref radius);
            DA.GetData(6, ref deeper);
            DA.GetData(7, ref project);
            DA.GetData(8, ref projectDistance);


            // --- Execute

            var unit = DocumentTolerance();

            var result = Radial.Create(mesh, plane, thickness, deeper, radius, countA, countZ, unit, project, projectDistance);


            // --- Output

            DA.SetEnum2D(0, result.CurvesA);
            DA.SetEnum2D(1, result.CurvesZ);
            DA.SetEnum1D(2, result.PlanesA);
            DA.SetEnum1D(3, result.PlanesZ);
        }
开发者ID:olitur,项目名称:Bowerbird,代码行数:39,代码来源:BBRadialComponent.cs

示例2: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // --- Input

            var mesh = default(Mesh);
            var planes = new List<Plane>();
            var thickness = default(double);
            var deeper = default(double);

            DA.GetData(0, ref mesh);
            DA.GetDataList(1, planes);
            DA.GetData(2, ref thickness);
            DA.GetData(3, ref deeper);


            // --- Execute

            var tolerance = DocumentTolerance();

            var slitPlanes = new SlitPlane[planes.Count];

            for (int i = 0; i < planes.Count; i++)
                slitPlanes[i] = new SlitPlane(mesh, planes[i], tolerance);

            var bbox = mesh.GetBoundingBox(false);
            var dmax = bbox.Diagonal.Length;
                      
            for (int i = 0; i < planes.Count; i++)
            {
                for (int j = i + 1; j < planes.Count; j++)
                {
                    var a = planes[i];
                    var b = planes[j];

                    var origin = default(Vector3d);
                    var direction = default(Vector3d);

                    if (a.Normal.IsParallelTo(b.Normal) != 0)
                        continue;

                    IntersectPlanes(a, b, out origin, out direction);

                    var cPlane = new Plane(bbox.Center, direction);
                    origin = (Vector3d)cPlane.ClosestPoint((Point3d)origin);                    

                    var originA = origin.Map2D(a);
                    var directionA = direction.Map2D(a);

                    var originB = origin.Map2D(b);
                    var directionB = direction.Map2D(b);

                    var line = new LineCurve((Point3d)(origin - dmax * direction), ((Point3d)origin + dmax * direction));

                    var alpha = Vector3d.VectorAngle(a.Normal, b.Normal);
                    var t = thickness * Math.Tan(alpha / 2);

                    slitPlanes[i].AddSlit(line.PointAtStart, line.PointAtEnd, t, deeper);
                    slitPlanes[j].AddSlit(line.PointAtEnd, line.PointAtStart, t, deeper);
                }
            }


            // --- Output

            DA.SetEnum2D(0, slitPlanes.Select(o => o.GetResult()));
        }
开发者ID:olitur,项目名称:Bowerbird,代码行数:66,代码来源:BBSectionComponent.cs

示例3: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // --- Input

            var mesh = default(Mesh);
            var thickness = default(double);
            var plane = default(Plane);
            var border = default(double);

            DA.GetData(0, ref mesh);
            DA.GetData(1, ref thickness);
            DA.GetData(2, ref plane);
            DA.GetData(3, ref border);


            // --- Check

            if (thickness <= 0)
                throw new Exception(@"Thickness must be a positive value!");

            if (border < 0)
                throw new Exception(@"Border must be a positive value!");

            if (!mesh.IsValid)
                throw new Exception(@"Mesh is not valid!");

            if (!mesh.IsClosed)
                throw new Exception(@"Mesh is not closed!");


            // --- Execute

            var unit = DocumentTolerance();

            var box = mesh.Box(plane);

            var corners = box.GetCorners();

            var origin = corners[0];
            var unitX = box.Plane.XAxis;
            var unitY = box.Plane.YAxis;
            var unitZ = box.Plane.ZAxis;

            var layerCount = (int)Math.Round(box.Z.Length / thickness);

            var olines = new List<List<IntPoint>>[layerCount];
            var offset = new List<List<IntPoint>>[layerCount];
            var ilines = new List<List<IntPoint>>[layerCount];
            var planes = new Plane[layerCount];

            for (int i = 0; i < layerCount; i++)
            {
                var z = (i + 0.5) * thickness;

                var sectionOrigin = origin + z * unitZ;
                var sectionPlane = new Plane(sectionOrigin, unitZ);

                planes[i] = sectionPlane;

                olines[i] = mesh.Section(sectionPlane, unit);
                offset[i] = Offset(olines[i], -border / unit);
            }

            if (border > 0)
            {
                ilines[0] = new List<List<IntPoint>>();

                for (int i = 1; i < layerCount - 1; i++)
                    ilines[i] = Intersect(Intersect(offset[i], offset[i - 1]), offset[i + 1]);

                ilines[layerCount - 1] = new List<List<IntPoint>>();
            }


            // --- Output

            DA.SetEnum2D(0, olines.Select((o, i) => o.ToCurves(planes[i], unit)));
            if (border > 0) DA.SetEnum2D(1, ilines.Select((o, i) => o.ToCurves(planes[i], unit)));
            DA.SetEnum1D(2, planes);
        }
开发者ID:olitur,项目名称:Bowerbird,代码行数:80,代码来源:BBLayerComponent.cs


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