コード例 #1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IntPtr       topoData   = IntPtr.Zero;
            List <Curve> parts      = new List <Curve>();
            List <Curve> boundaries = new List <Curve>();

            if (!DA.GetData(0, ref topoData))
            {
                return;
            }
            if (!DA.GetDataList(1, parts))
            {
                return;
            }
            DA.GetDataList(2, boundaries);

            CPolyLines polyLines = new CPolyLines();

            TopoCreator.RhinoPolylinesToCPolyline(parts, boundaries, ref polyLines, true);
            if (boundaries.Count == 0)
            {
                TopoCreator.setCrossMesh(ref polyLines, topoData, false);
            }
            else
            {
                TopoCreator.setCrossMesh(ref polyLines, topoData, true);
            }

            Marshal.FreeHGlobal(polyLines.atBoundary);
            Marshal.FreeHGlobal(polyLines.points);
            Marshal.FreeHGlobal(polyLines.sta_ends);

            DA.SetData(0, topoData);
            return;
        }
コード例 #2
0
ファイル: GH_ModifyPattern.cs プロジェクト: kevlund/TopoRhino
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IntPtr       topoData = IntPtr.Zero;
            List <Curve> pattern  = new List <Curve>();
            List <Curve> empty    = new List <Curve>();

            if (!DA.GetData(0, ref topoData))
            {
                return;
            }
            if (!DA.GetDataList(1, pattern))
            {
                return;
            }

            CPolyLines polylines = new CPolyLines();

            TopoCreator.RhinoPolylinesToCPolyline(pattern, empty, ref polylines, false);
            TopoCreator.setPattern(ref polylines, topoData);

            Marshal.FreeHGlobal(polylines.atBoundary);
            Marshal.FreeHGlobal(polylines.points);
            Marshal.FreeHGlobal(polylines.sta_ends);

            DA.SetData(0, topoData);
        }