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


C# IGH_DataAccess.Fetch方法代码示例

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


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

示例1: 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)
        {
            // SET ALL INPUT PARAMETERS
              Polyline plA = default(Polyline);
              if (!Polyline3D.ConvertCurveToPolyline(DA.Fetch<Curve>("Polyline"), out plA)) {
            this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Unable to convert to polyline from curve");
            return;
              }
              Point3d pt = DA.Fetch<Point3d>("Point");
              Plane pln = DA.Fetch<Plane>("Plane");
              double tolerance = DA.Fetch<double>("Tolerance");

              if (pln.Equals(default(Plane)))
              {
            pln = plA.FitPlane();
              }

              DA.SetData("Inside", plA.IsInside(pt,pln, tolerance));
        }
开发者ID:JIMMMMMMY,项目名称:clipper,代码行数:23,代码来源:PolygonContainmentComponent.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)
        {
            // SET ALL INPUT PARAMETERS
              List<Curve> A = DA.FetchList<Curve>("A");
              List<Curve> B = DA.FetchList<Curve>("B");
              try {
            ClipType type = (ClipType)DA.Fetch<int>("BooleanType");
            Plane pln = DA.Fetch<Plane>("Plane");
            double tolerance = DA.Fetch<double>("Tolerance");

            // Convert the curves to polylines
            // This is a crude way of doing this.
            // Should we add some parameters for this perhaps?
            IEnumerable<Polyline> APl = Polyline3D.ConvertCurvesToPolyline(A);
            IEnumerable<Polyline> BPl = Polyline3D.ConvertCurvesToPolyline(B);

            // If we don't have a plane, let's try to create a plane from the first curve.
            if (pln.Equals(default(Plane)) || !pln.IsValid) {
              pln = APl.First().FitPlane();
            }

            List<Polyline> result = new List<Polyline>();

            // do the boolean operation
            result = Polyline3D.Boolean(type, APl, BPl, pln, tolerance, EvenOdd);

            // OUTPUT LOGIC
            DA.SetDataList("Result", result);
              } catch (Exception e) {
            this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.Message + ": " + e.StackTrace.ToString());
              }
        }
开发者ID:JIMMMMMMY,项目名称:clipper,代码行数:36,代码来源:BooleanComponent.cs

示例3: 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)
        {
            // SET ALL INPUT PARAMETERS
              Polyline plA = default(Polyline);
              if (!Polyline3D.ConvertCurveToPolyline(DA.Fetch<Curve>("A"), out plA))
              {
            this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Unable to convert to polyline from curve");
            return;
              }
              Polyline plB = default(Polyline);
              if (!Polyline3D.ConvertCurveToPolyline(DA.Fetch<Curve>("B"), out plB)) {
            this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Unable to convert to polyline from curve");
            return;
              }

              Plane pln = DA.Fetch<Plane>("Plane");
              double tolerance = DA.Fetch<double>("Tolerance");
              if (pln.Equals(default(Plane)))
              {
            pln = plA.FitPlane();
              }

              Point3d ptCenter = new Box(pln, plB).Center;

              List<Polyline> outCurves = new List<Polyline>();
              List<Polyline> outDisplacedCurves = new List<Polyline>();
              foreach (List<IntPoint> path in ClipperLib.Clipper.MinkowskiSum(plA.ToPath2D(pln, tolerance), plB.ToPath2D(pln, tolerance), true)) {
            Polyline plSum = path.ToPolyline(pln, tolerance, true);
            //Polyline plDisplacedSum = new Polyline(plSum);
            //plDisplacedSum.Transform(Transform.Translation(-new Vector3d(ptCenter)));
            outCurves.Add(plSum);
            //outDisplacedCurves.Add(plDisplacedSum);
              }

              // OUTPUT LOGIC
              DA.SetDataList("Sum", outCurves);
              DA.SetDataList("DisplacedSum", outCurves);
        }
开发者ID:JIMMMMMMY,项目名称:clipper,代码行数:42,代码来源:MinkowskiSumComponent.cs

示例4: 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)
        {
            // SET ALL INPUT PARAMETERS
              List<Curve> curves = DA.FetchList<Curve>("Polylines");
              double dist = DA.Fetch<double>("Distance");
              Plane pln = DA.Fetch<Plane>("Plane");
              double tolerance = DA.Fetch<double>("Tolerance");
              List<Polyline3D.OpenFilletType> openType = DA.FetchList<int>("OpenFillet").Cast<Polyline3D.OpenFilletType>().ToList();
              if (openType == null || openType.Count == 0) {
            openType = new List<Polyline3D.OpenFilletType> { Polyline3D.OpenFilletType.Square };
              }
              double miter = DA.Fetch<double> ("Miter");

              List<Polyline3D.ClosedFilletType> closedType = DA.FetchList<int>("ClosedFillet").Cast<Polyline3D.ClosedFilletType>().ToList();

              IEnumerable<Polyline> polylines = Polyline3D.ConvertCurvesToPolyline(curves);

              if (pln.Equals(default(Plane)))
              {
            pln = polylines.First().FitPlane();
              }

              // set default fillet type.
              if (closedType == null || closedType.Count == 0) {
            closedType = new List<Polyline3D.ClosedFilletType> { Polyline3D.ClosedFilletType.Square };
              }

              if (curves.Count == 0) {
            return;
              }

              List<List<Polyline>> outside;
              List<List<Polyline>> holes;
              Polyline3D.Offset(polylines, openType, closedType, pln, tolerance, new List<double> { dist }, miter, 0.25, out outside, out holes);

              // OUTPUT LOGIC
              DA.SetDataList("Contour", outside.First());
              DA.SetDataList("Holes", holes.First());
        }
开发者ID:JIMMMMMMY,项目名称:clipper,代码行数:43,代码来源:OffsetComponent.cs


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