コード例 #1
0
        public void CheckHomeView()
        {
            bool HVExist = false;

            try
            {
                foreach (SavedItem oSVP in oDoc.SavedViewpoints.Value)
                {
                    if (oSVP.DisplayName == "HomeView")
                    {
                        HVExist = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            if (HVExist == false)
            {
                DS_NW_Viewpoint_tools dS_NW_Viewpoint_Tools = new DS_NW_Viewpoint_tools();
                dS_NW_Viewpoint_Tools.HomeViewpoint_Set(out InwOpView oSV);

                //Save viewpoint
                oSV.name = "HomeView";
                oState.SavedViews().Add(oSV);
            }
        }
コード例 #2
0
        public void FilesCheck(string PathCheck)
        {
            //Tools for work with files creation
            DS_DirTools dS_DirTools = new DS_DirTools();

            bool fe = dS_DirTools.DirCheckForFiles(PathCheck, out string[] FilesList, "nwf");

            if (fe == false)
            {
                return;
            }

            //Through each file iterating
            foreach (string f in FilesList)
            {
                //Open Navisworks document
                Navisworks_Tools   navisworks_Tools = new Navisworks_Tools(f);
                Document           oDoc             = navisworks_Tools.OpenDoc();
                DocumentClash      documentClash    = oDoc.GetClash();
                DocumentClashTests oDCT             = documentClash.TestsData;

                if (oDCT.Tests.Count != 0)
                {
                    oDCT.TestsRunAllTests();

                    //Through each clash test iterating
                    Clash_Viewpoints clash_Viewpoints = new Clash_Viewpoints(oDoc);

                    clash_Viewpoints.CheckHomeView();

                    clash_Viewpoints.ClashElementSearch();
                    clash_Viewpoints.ViewpointsCreation(out bool ClashTestsResultsExist);

                    if (ClashTestsResultsExist == false)
                    {
                        FilesWithNoClashRes.Add(f);
                    }
                    else
                    {
                        //Set current view
                        DS_NW_Viewpoint_tools dS_NW_Viewpoint_Tools = new DS_NW_Viewpoint_tools();
                        dS_NW_Viewpoint_Tools.HomeViewpoint_Set(out _);

                        navisworks_Tools.FilesSave();

                        SavedFiles.Add(f);
                    }
                }
                else
                {
                    FilesWithNoClashTests.Add(f);
                }
            }
        }