Beispiel #1
0
        private bool ReadHistory(Rhino.DocObjects.ReplayHistoryData replay, ref Rhino.DocObjects.ObjRef objref, ref int segmentCount, ref int pointCount)
        {
            if (_historyVersion != replay.HistoryVersion)
            {
                return(false);
            }

            objref = replay.GetRhinoObjRef(0);
            if (null == objref)
            {
                return(false);
            }

            if (!replay.TryGetInt(1, out segmentCount))
            {
                return(false);
            }

            if (!replay.TryGetInt(2, out pointCount))
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Rhino calls this function to remake objects when inputs have changed.
        /// </summary>
        protected override bool ReplayHistory(Rhino.DocObjects.ReplayHistoryData replay)
        {
            Rhino.DocObjects.ObjRef objref = null;
            int segmentCount = 0;
            int pointCount   = 0;

            if (!ReadHistory(replay, ref objref, ref segmentCount, ref pointCount))
            {
                return(false);
            }

            Rhino.Geometry.Curve curve = objref.Curve();
            if (null == curve)
            {
                return(false);
            }

            if (pointCount != replay.Results.Length)
            {
                return(false);
            }

            Rhino.Geometry.Point3d[] points;
            curve.DivideByCount(segmentCount, true, out points);
            if (null == points)
            {
                return(false);
            }

            for (int i = 0; i < points.Length; i++)
            {
                replay.Results[i].UpdateToPoint(points[i], null);
            }

            return(true);
        }