Beispiel #1
0
        public void TestPanelInsert()
        {
            Point3d p0, pf;

            if (Picker.Point("Selecciona el punto inicial", out p0) &&
                Picker.Point("Selecciona el punto final", p0, out pf))
            {
                App.Riviera.Is3DEnabled = true;
                new QuickTransactionWrapper((Document doc, Transaction tr) =>
                {
                    RivieraSize frente = new RivieraSize()
                    {
                        Measure = KEY_FRONT, Nominal = 18, Real = 18 * 0.0254d
                    },
                    alto1 = new RivieraSize()
                    {
                        Measure = KEY_HEIGHT, Nominal = 27, Real = 27 * 0.0254d
                    },
                    alto2 = new RivieraSize()
                    {
                        Measure = KEY_HEIGHT, Nominal = 15, Real = 15 * 0.0254d
                    };
                    PanelMeasure panel     = new PanelMeasure(frente, alto1),
                    panel2                 = new PanelMeasure(frente, alto2);
                    BordeoPanelStack stack = new BordeoPanelStack(p0, pf, panel);
                    stack.AddPanel(panel2);
                    stack.Draw(tr);
                }).Run();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Sows as Linear panel.
        /// </summary>
        /// <param name="doc">The active document.</param>
        /// <param name="tr">The active transaction.</param>
        protected override RivieraObject InitSowing(Document doc, Transaction tr, params RivieraMeasure[] sizes)
        {
            Point3d p0, pf;

            if (this.PickStartDirection(out p0, out pf))
            {
                //Se convierten los tamaños a tamaños de bordeo
                IEnumerable <PanelMeasure> pSizes = sizes.Select(x => x as PanelMeasure);
                //El panel inferios se usa como distancia base del arreglo de paneles.
                var first = sizes[0] as PanelMeasure;
                BordeoPanelStack stack = new BordeoPanelStack(p0, pf, first);
                //Se agregan los tamaños superiores
                for (int i = 1; i < sizes.Length; i++)
                {
                    stack.AddPanel(sizes[i] as PanelMeasure);
                }
                //Se dibuja el stack
                stack.Draw(tr);
                var db = App.Riviera.Database.Objects;
                if (db.FirstOrDefault(x => x.Handle.Value == stack.Handle.Value) == null)
                {
                    db.Add(stack);
                }
                return(stack);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Sows as Linear panel.
        /// </summary>
        /// <param name="doc">The active document.</param>
        /// <param name="tr">The active transaction.</param>
        protected RivieraObject InsertLinearPanel(RivieraObject obj, ArrowDirection direction, params RivieraMeasure[] sizes)
        {
            //1: Se calcula la dirección y orientación del panel
            Point3d end, start;

            if (direction == ArrowDirection.FRONT) //Misma dirección
            {
                if (obj is BordeoLPanelStack)
                {
                    Polyline pl = (obj as BordeoLPanelStack).FirstOrDefault().PanelGeometry;
                    start = obj.End.ToPoint3d();
                    double angle = pl.GetPoint2dAt(2).GetVectorTo(pl.GetPoint2dAt(3)).Angle;
                    end = start.ToPoint2d().ToPoint2dByPolar(1, angle).ToPoint3d();
                }
                else
                {
                    start = obj.End.ToPoint3d();
                    end   = start.ToPoint2d().ToPoint2dByPolar(1, obj.Angle).ToPoint3d();
                }
            }
            else //Se invierte la dirección
            {
                start = obj.Start.ToPoint3d();
                end   = start.ToPoint2d().ToPoint2dByPolar(1, obj.Angle + Math.PI).ToPoint3d();
            }
            //Se convierten los tamaños a tamaños de bordeo
            IEnumerable <PanelMeasure> pSizes = sizes.Select(x => x as PanelMeasure);
            //El panel inferios se usa como distancia base del arreglo de paneles.
            var first = sizes[0] as PanelMeasure;
            //Se crea el panel
            BordeoPanelStack stack = new BordeoPanelStack(start, end, first);

            //Se agregan los tamaños superiores
            for (int i = 1; i < sizes.Length; i++)
            {
                stack.AddPanel(sizes[i] as PanelMeasure);
            }
            //Se dibuja en el plano
            this.DrawObjects(null, stack);
            obj.Connect(direction, stack);
            //Se regresa el stack como objeto creado
            return(stack);
        }