Exemplo n.º 1
0
        static bool CATCHMENT_SampleDrawingTopography(vdDocument vdoc)
        {
            string file_p = Path.Combine(Application.StartupPath, "DRAWINGS\\Catchment\\Contour_Drawing.vdml");

            if (!File.Exists(file_p))
            {
                file_p = Path.Combine(Application.StartupPath, "DRAWINGS\\Catchment\\Contour.vdml");
            }
            if (!File.Exists(file_p))
            {
                file_p = Path.Combine(Application.StartupPath, "DRAWINGS\\Catchment\\Contours.vdml");
            }



            if (File.Exists(file_p))
            {
                return(vdoc.Open(file_p));
            }
            else
            {
                MessageBox.Show(file_p + " not found.");
            }
            return(false);
        }
Exemplo n.º 2
0
        public void File_Save_Open(vdDocument doc)
        {
            string f_name = doc.FileName;

            doc.SaveAs(f_name);
            doc.ClearAll();
            doc.ClearEraseItems();
            doc.Open(f_name);
        }
Exemplo n.º 3
0
        public void Draw_HYDROGRAPH(string drawing_file)
        {
            HydroCrossSection.DrawHrdrographFromDataFile(drawing_file, mainDoc);
            mainDoc.Palette.Background = Color.Black;
            mainDoc.Redraw(true);

            string f_name = Path.GetDirectoryName(system_path); // User Path

            f_name = Path.Combine(f_name, "HYDROGRAPH.VDML");
            mainDoc.SaveAs(f_name);
            mainDoc.ClearEraseItems();
            mainDoc.Open(f_name);
            return;
        }
Exemplo n.º 4
0
 public CRevit2vdl(string strFile, ProgressBar pgressBar)
 {
     progressBar1 = pgressBar;
     vec.EnsureDocument();
     vec.ActiveDocument.EnsureDefaults();
     doc           = vec.ActiveDocument;
     vec.Progress += vec_Progress;
     doc.Open(strFile);
     foreach (vdFigure vdf in doc.ActiveLayOut.Entities)
     {
         if (vdf is vdPolyface)
         {
             vdPolyface vdp = vdf as vdPolyface;
             gPoints    gps = vdp.VertexList.Clone() as gPoints;
             gps.RemoveEqualPoints();
         }
     }
 }
Exemplo n.º 5
0
        static bool CATCHMENT_SampleDrawingHydrograph(vdDocument vdoc)
        {
            switch (frmOpenHydrologyDrawing.Get_DrawingType())
            {
            case frmOpenHydrologyDrawing.eHydroDrawing.SampleDrawing:
                #region Sample Drawing
                string sam_drawing_file = Path.Combine(Application.StartupPath, "DRAWINGS\\Catchment\\River Alignment.vdml");

                if (!File.Exists(sam_drawing_file))
                {
                    sam_drawing_file = Path.Combine(Application.StartupPath, "DRAWINGS\\Catchment\\River Alignment.dwg");
                }
                if (!File.Exists(sam_drawing_file))
                {
                    sam_drawing_file = Path.Combine(Application.StartupPath, "DRAWINGS\\Bridges\\Catchment\\Terrain_River_Contour.vdml");
                }
                if (!File.Exists(sam_drawing_file))
                {
                    sam_drawing_file = Path.Combine(Application.StartupPath, "DRAWINGS\\Bridges\\Catchment\\Terrain River Contour.vdml");
                }
                if (!File.Exists(sam_drawing_file))
                {
                    sam_drawing_file = Path.Combine(Application.StartupPath, "DRAWINGS\\Catchment\\Terrain_River_Contour.vdml");
                }
                string sam_data_file = Path.Combine(Application.StartupPath, @"DESIGN\DefaultData\Catment_Data\Terrain Topo Data.TXT");
                if (!File.Exists(sam_data_file))
                {
                    Path.Combine(Application.StartupPath, @"DESIGN\DefaultData\Catment_Data\Terrain.TXT");
                }

                string drawing_file = "";
                string data_file    = "";
                string work_folder  = "";

                using (FolderBrowserDialog fbd = new FolderBrowserDialog())
                {
                    if (fbd.ShowDialog() != DialogResult.Cancel)
                    {
                        work_folder = fbd.SelectedPath;
                    }
                }

                if (!Directory.Exists(work_folder))
                {
                    return(false);
                }


                drawing_file = Path.Combine(work_folder, Path.GetFileName(sam_drawing_file));
                data_file    = Path.Combine(work_folder, Path.GetFileName(sam_data_file));

                if (File.Exists(sam_drawing_file))
                {
                    File.Copy(sam_drawing_file, drawing_file, true);
                    if (File.Exists(sam_data_file))
                    {
                        File.Copy(sam_data_file, data_file, true);
                        sample_data = data_file;
                        System.Diagnostics.Process.Start(data_file);
                        //sam_drawing_file = Path.Combine(Application.StartupPath, "DRAWINGS\\Catchment\\Terrain+River+Contour.vdml");
                    }
                    return(vdoc.Open(drawing_file));
                }



                if (!File.Exists(sam_drawing_file))
                {
                    MessageBox.Show(sam_drawing_file + " not found.");
                }
                #endregion Sample Drawing
                break;

            case frmOpenHydrologyDrawing.eHydroDrawing.ProjectDrawing:
                string proj_drawing_file = "";
                using (OpenFileDialog ofd = new OpenFileDialog())
                {
                    ofd.Filter = "Drawing Files (*.vdml;*.vdcl;*.dwg;*.dxf)|*.vdml;*.vdcl;*.dwg;*.dxf|All Files (*.*)|*.*";
                    if (ofd.ShowDialog() != DialogResult.Cancel)
                    {
                        sample_data       = "";
                        proj_drawing_file = ofd.FileName;
                        vdoc.Open(proj_drawing_file);
                    }
                }
                break;
            }
            return(false);
        }
Exemplo n.º 6
0
        private void toolStripButtons_Click(object sender, EventArgs e)
        {
            vdDocument VD = VDoc;
            bool       f  = false;

            VDoc.Prompt("command:");



            ToolStripButton tsb = sender as ToolStripButton;

            if (tsb.Name == tsb_3D_rotate.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_Vrot(VD);
            }
            else if (tsb.Name == tsb_VTop.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VTop(VD);
            }
            else if (tsb.Name == tsb_VBot.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VBottom(VD);
            }
            else if (tsb.Name == tsb_VLeft.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VLeft(VD);
            }
            else if (tsb.Name == tsb_VRight.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VRight(VD);
            }
            else if (tsb.Name == tsb_VFront.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VFront(VD);
            }
            else if (tsb.Name == tsb_VBack.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VBack(VD);
            }
            else if (tsb.Name == tsb_VNE.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VINE(VD);
            }
            else if (tsb.Name == tsb_VNW.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VINW(VD);
            }
            else if (tsb.Name == tsb_VSE.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VISE(VD);
            }
            else if (tsb.Name == tsb_VSW.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VISW(VD);
            }
            else if (tsb.Name == tsb_ZoomA.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.ZoomA_Ex(VD);
            }
            else if (tsb.Name == tsb_ZoomE.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.ZoomE_Ex(VD);
            }
            else if (tsb.Name == tsb_ZoomP.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.ZoomP_Ex(VD);
            }

            else if (tsb.Name == tsb_ZoomW.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.ZoomW_Ex(VD);
            }

            else if (tsb.Name == tsb_ZoomIn.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.ZoomIn_Ex(VD);
            }
            else if (tsb.Name == tsb_ZoomOut.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.ZoomOut_Ex(VD);
            }

            else if (tsb.Name == tsb_Pan.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.PanEx(VD);
            }
            else if (tsb.Name == tsb_ShadeOn.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_ShadeOn(VD);
            }
            else if (tsb.Name == tsb_Wire.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_Wire2d(VD);
            }
            else if (tsb.Name == tsb_Dist.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.GetDistanceEx(VD);
            }

            else if (tsb.Name == tsb_Layers.Name)
            {
                VectorDraw.Professional.Dialogs.LayersDialog.Show(VD);
            }
            //VectorDraw.Professional.ActionUtilities.vdCommandAction.Layer(VD);

            else if (tsb.Name == tsb_Rotate.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.RotateEx(VD);
            }

            else if (tsb.Name == tsb_Undo.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.UndoEx(VD);
            }

            else if (tsb.Name == tsb_Redo.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.RedoEx(VD);
            }

            else if (tsb.Name == tsb_copy.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.CopyEx(VD);
            }

            else if (tsb.Name == tsb_Erase.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.EraseEx(VD);
            }

            else if (tsb.Name == tsb_Move.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.MoveEx(VD);
            }


            else if (tsb.Name == tsb_Explode.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.ExplodeEx(VD);
            }

            else if (tsb.Name == tsb_Mirror.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.MirrorEx(VD);
            }

            else if (tsb.Name == tsb_Scale.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.ScaleEx(VD);
            }

            else if (tsb.Name == tsb_Break.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.BreakEx(VD);
            }

            else if (tsb.Name == tsb_Trim.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.TrimEx(VD);
            }

            else if (tsb.Name == tsb_Extend.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.ExtendEx(VD);
            }

            else if (tsb.Name == tsb_Insert.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.InsertEx(VD);
            }

            else if (tsb.Name == tsb_Regen.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.RegenEx(VD);
            }


            else if (tsb.Name.EndsWith("OsnapEnd"))
            {
                VD.osnapMode = OsnapMode.END;
            }
            else if (tsb.Name.EndsWith("OsnapCen"))
            {
                VD.osnapMode = OsnapMode.CEN;
            }
            else if (tsb.Name.EndsWith("OsnapIns"))
            {
                VD.osnapMode = OsnapMode.INS;
            }
            else if (tsb.Name.EndsWith("OsnapMid"))
            {
                VD.osnapMode = OsnapMode.MID;
            }
            else if (tsb.Name.EndsWith("OsnapPer"))
            {
                VD.osnapMode = OsnapMode.PER;
            }
            else if (tsb.Name.EndsWith("OsnapNea"))
            {
                VD.osnapMode = OsnapMode.NEA;
            }
            else if (tsb.Name.EndsWith("OsnapInters"))
            {
                VD.osnapMode = OsnapMode.INTERS;
            }
            else if (tsb.Name.EndsWith("OsnapNode"))
            {
                VD.osnapMode = OsnapMode.NODE;
            }
            else if (tsb.Name.EndsWith("OsnapTang"))
            {
                VD.osnapMode = OsnapMode.TANG;
            }
            else if (tsb.Name.EndsWith("OsnapApparentInt"))
            {
                VD.osnapMode = OsnapMode.APPARENTINT;
            }
            else if (tsb.Name.EndsWith("OsnapNone"))
            {
                VD.osnapMode = OsnapMode.NONE;
            }
            else if (tsb.Name.EndsWith("OsnapCancel"))
            {
                VD.osnapMode = OsnapMode.DISABLE;
            }


            else if (tsb.Name == tsb_Line.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.LineEx(VD);
            }

            else if (tsb.Name == tsb_Polyline.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.PolylineEx(VD);
            }

            else if (tsb.Name == tsb_Circle.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.CircleEx(VD);
            }

            else if (tsb.Name == tsb_arc.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.ArcEx(VD);
            }

            else if (tsb.Name == tsb_Rect.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.RectEx(VD);
            }


            else if (tsb.Name == tsb_Text.Name)
            {
                VectorDraw.Professional.ActionUtilities.vdCommandAction.TextEx(VD);
            }

            else if (tsb.Name == tsb_Ortho.Name)
            {
                VD.OrthoMode = tsb_Ortho.Checked;
            }


            //VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_Wire(VD);
            else if (tsb.Name == tsb_Save.Name)
            {
                using (SaveFileDialog sfd = new SaveFileDialog())
                {
                    sfd.Filter = "VDML File (*.vdml)|*.vdml|DXF File (*.dxf)|*.dxf|DWG File (*.dwg)|*.dwg";

                    if (File.Exists(VD.FileName))
                    {
                        sfd.InitialDirectory = Path.GetDirectoryName(VD.FileName);
                        sfd.FileName         = Path.GetFileNameWithoutExtension(VD.FileName);
                        //sfd.DefaultExt = Path.GetExtension(VD.FileName);
                    }
                    if (sfd.ShowDialog() != DialogResult.Cancel)
                    {
                        if (iApp.IsDemo)
                        {
                            MessageBox.Show("This function is not available in Demo version.", "ASTRA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            if (VD.SaveAs(sfd.FileName))
                            {
                                MessageBox.Show("File Saved successfully.", "ASTRA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                }
            }
            else if (tsb.Name == tsb_Open.Name)
            {
                using (OpenFileDialog sfd = new OpenFileDialog())
                {
                    sfd.Filter = "VDML File (*.vdml)|*.vdml|DXF File (*.dxf)|*.dxf|DWG File (*.dwg)|*.dwg";
                    if (sfd.ShowDialog() != DialogResult.Cancel)
                    {
                        //if (iApp.IsDemo)
                        //{
                        //    MessageBox.Show("This function is not available in Demo version.", "ASTRA", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        //}
                        //else
                        {
                            if (VD.Open(sfd.FileName))
                            {
                                if (Open_Drawing != null)
                                {
                                    Open_Drawing(sender, e);
                                }
                                MessageBox.Show("File Opened successfully.", "ASTRA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                }
            }
        }