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


C# IGH_DataAccess.SetEnum1D方法代码示例

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


在下文中一共展示了IGH_DataAccess.SetEnum1D方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 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.SetEnum1D方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。