예제 #1
0
 public void TestBlock()
 {
     new QuickTransactionWrapper((Document doc, Transaction tr) =>
     {
         try
         {
             Point3d start, end;
             TabBordeoMenu ctrl = this.Controls.Where(x => x is TabBordeoMenu).FirstOrDefault() as TabBordeoMenu;
             Editor ed          = Application.DocumentManager.MdiActiveDocument.Editor;
             if (Picker.Point("Selecciona el punto inicial", out start))
             {
                 end      = start + new Vector3d(10, 0, 0);
                 var size = ctrl.GetL135Panels().FirstOrDefault() as LPanelMeasure;
                 BordeoL135Panel panel = new BordeoL135Panel(SweepDirection.Counterclockwise, start, end, size);
                 panel.Draw(tr);
                 this.InitContent(panel, tr);
                 ed.Regen();
             }
         }
         catch (System.Exception exc)
         {
             Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
             ed.WriteMessage(exc.Message);
         }
     }).Run();
 }
예제 #2
0
        public void TestPanelLInsert()
        {
            Point3d       start;
            Point3d       end;
            TabBordeoMenu ctrl = this.Controls.Where(x => x is TabBordeoMenu).FirstOrDefault() as TabBordeoMenu;
            BordeoLPanel  panel;
            var           size = ctrl.GetL90Panels().FirstOrDefault() as LPanelMeasure;
            Editor        ed   = Application.DocumentManager.MdiActiveDocument.Editor;

            for (int i = 0; i < 4 && ctrl.SelectHeights.Length > 0; i++)
            {
                new QuickTransactionWrapper((Document doc, Transaction tr) =>
                {
                    if (Picker.Point("Selecciona el punto inicial", out start))
                    {
                        end = start + new Vector3d(10, 0, 0);
                        if (i == 0)
                        {
                            panel = new BordeoL135Panel(SweepDirection.Clockwise, start, end, size);
                        }
                        else if (i == 1)
                        {
                            panel = new BordeoL135Panel(SweepDirection.Counterclockwise, start, end, size);
                        }
                        else if (i == 2)
                        {
                            panel = new BordeoL135Panel(SweepDirection.Clockwise, start, end, size.InvertFront());
                        }
                        else if (i == 3)
                        {
                            panel = new BordeoL135Panel(SweepDirection.Counterclockwise, start, end, size.InvertFront());
                        }
                        else
                        {
                            panel = null;
                        }
                        if (panel != null)
                        {
                            panel.Draw(tr);
                            panel.DrawGeometry(tr);
                        }
                        ed.Regen();
                    }
                }).Run();
            }
        }
예제 #3
0
        private void InitContent(BordeoL135Panel panel, Transaction tr)
        {
            Dictionary <LBlockType, AutoCADBlock>
            blocks2D                 = new Dictionary <LBlockType, AutoCADBlock>(),
                blocks3D             = new Dictionary <LBlockType, AutoCADBlock>();
            RivieraLBlock rBlock     = (panel.Block as RivieraLBlock);
            AutoCADBlock  block2d    = new AutoCADBlock(String.Format(rBlock.Block2DName, rBlock.BlockName), rBlock.GetBlockFilePath(), tr);
            AutoCADBlock  block3d    = new AutoCADBlock(String.Format(rBlock.Block3DName, rBlock.BlockName), rBlock.GetBlockFilePath(false), tr);
            AutoCADBlock  varBlock2d = new AutoCADBlock(String.Format(SUFFIX_BLOCK2D, rBlock.VariantBlockName), rBlock.GetBlockFilePath(rBlock.VariantBlockName), tr);
            AutoCADBlock  varBlock3d = new AutoCADBlock(String.Format(SUFFIX_BLOCK3D, rBlock.VariantBlockName), rBlock.GetBlockFilePath(rBlock.VariantBlockName, false), tr);

            (panel.Block as RivieraLBlock).LoadBlocks(Application.DocumentManager.MdiActiveDocument, tr, out blocks2D, out blocks3D);
            string blockName        = block2d.Blockname.Substring(0, block2d.Blockname.Length - 2),
                   variantBlockName = varBlock2d != null?varBlock2d.Blockname.Substring(0, varBlock2d.Blockname.Length - 2) : null;

            AutoCADBlock blockRecord = blocks2D[LBlockType.LEFT_SAME_SIZE];

            blockRecord.Open(tr, OpenMode.ForWrite);
            blockRecord.Clear(tr);
            String code           = blockName.Substring(0, 6);
            Double frente1        = 18d.GetPanel135DrawingSize() * Math.Sin(Math.PI / 4),
                   frente2        = 18d.GetPanel135DrawingSize() + 18d.GetPanel135DrawingSize() * Math.Cos(Math.PI / 4);
            BlockReference blkRef = block2d.CreateReference(new Point3d(), 0);

            //Se rota 270°

            blkRef.TransformBy(Matrix3d.Rotation(-3 * Math.PI / 4, Vector3d.ZAxis, new Point3d()));
            Vector3d offset = new Vector3d(frente2, frente1, 0);

            //Offset BR2020
            if (code == CODE_PANEL_90)
            {
                offset = new Vector3d(offset.X + 0.1002d, offset.Y + 0.1002d, 0);
            }
            //Offset BR2030
            else
            {
                offset = new Vector3d(offset.X + 0.0709d, offset.Y + 0.0293d, 0);
            }
            //Se traslada el punto final al punto inicial
            blkRef.TransformBy(Matrix3d.Displacement(new Vector3d(offset.X, offset.Y, 0)));
            blockRecord.Draw(tr, blkRef);
        }