示例#1
0
        private void BtnGetFBXFiles_MouseUp(object sender, MouseEventArgs e)
        {
            DirectoryInfo theroot = new DirectoryInfo("P:/20/2005007.000/Admin/03.0 Consultants/3.23 Land Surveyor/B&F/201221_FBX Files/036527 308 Queen Street FBX/Data");

            DirectoryInfo[] dirs = theroot.GetDirectories();

            var fbxlist = new List <FileInfo>();

            foreach (DirectoryInfo dir in dirs)
            {
                //Grab each of the FBX folders
                var fbxfolder = new DirectoryInfo(theroot.FullName + "/" + dir.Name + "/");

                //Look in each of the folders and grab any FBX files.
                var fbxfiles = fbxfolder.GetFiles("*.fbx");


                foreach (FileInfo afile in fbxfiles)
                {
                    txtFileNames.AppendText((txtFileNames.Text == "") ? afile.Name : $"{Environment.NewLine + afile.Name}");

                    //Append the current FBX file to the Federated Navisworks models
                    nwApp.AppendFile(afile.FullName);

                    //Increment the counter on the form
                    filecount++;
                    lblCount.Text = filecount.ToString();
                }
            }
        }
        public override int Execute(params string[] parameters)
        {
            //throw new NotImplementedException();

            //starts an invisible instance of Navisworks
            NavisworksApplication app_nav = new NavisworksApplication();
            Document doc = Autodesk.Navisworks.Api.Application.ActiveDocument;

            foreach (string s in parameters)
            {
                // adds a to the current navisworks document
                app_nav.AppendFile(s);
            }

            // save Navisworks file in location
            app_nav.SaveFile(@"C:\test\newnavisfile.nwd");

            // program failed
            return(-1);
        }