Пример #1
0
        /// <summary>
        /// Read a history record and extract the references for the antecedent objects.
        /// </summary>
        private bool ReadHistory(Rhino.DocObjects.ReplayHistoryData replay, ref List <Guid> ids, ref double radius1, ref double radius2, ref int capIndex)
        {
            if (HISTORY_VERSION != replay.HistoryVersion)
            {
                return(false);
            }
            foreach (Guid g in ids)
            {
                Guid id;
                replay.TryGetGuid(0, out id);
            }

            //if (null == objrefs)
            //    return false;

            if (!replay.TryGetDouble(1, out radius1))
            {
                return(false);
            }

            if (!replay.TryGetDouble(2, out radius2))
            {
                return(false);
            }

            if (!replay.TryGetInt(3, out capIndex))
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Rhino calls the virtual ReplayHistory functions to to remake an objects when inputs have changed.
        /// </summary>
        protected override bool ReplayHistory(Rhino.DocObjects.ReplayHistoryData replay)
        {
            Rhino.DocObjects.ObjRef objref2 = null;
            List <Curve>            curves2 = new List <Curve>();

            Brep[]        pipe2;
            PipeCapMode[] pCapM = { PipeCapMode.None, PipeCapMode.Flat, PipeCapMode.Round };

            double radius1 = 0.0;
            double radius2 = 0.0;

            double[] radiParam = { 0.0, 0.5, 1.0 };
            double[] radi      = { radius1, radius2, radius1 };

            if (!ReadHistory(replay, ref ids, ref radius1, ref radius2, ref capIndex))
            {
                return(false);
            }

            foreach (Guid i in ids)
            {
                objref2 = new ObjRef(i);
                Rhino.Geometry.Curve curve = objref2.Curve();
                curves2.Add(curve);
            }

            foreach (Curve x in curves2)
            {
                pipe2 = Brep.CreatePipe(x, radiParam, radi, true, pCapM[capIndex], true, 0.01, 0.01);
                replay.Results[0].UpdateToBrep(pipe2[0], null);
            }



            return(true);
        }
Пример #3
0
 internal ReplayHistoryResult(ReplayHistoryData parent, int index)
 {
   m_parent = parent;
   m_index = index;
 }