by Fenton Webb
Currently, for Plant3d 2012 and 2013 it’s not possible to use the PlantProject.LoadProject() function. The problem is that the Project Manager does not update.
The solution is to use the command line “-OPENPROJECT”, here’s how:
// open Plant3d project.xml by Fenton Webb, DevTech, 17/9/12 [CommandMethod("OpenMyProject")] public void OpenMyProject() { // select project.xml System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog(); DirectoryInfo defaultPathDI = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); dlg.InitialDirectory = defaultPathDI.FullName; dlg.FileName = "project.xml"; dlg.Multiselect = false; System.Windows.Forms.DialogResult dlgResult = dlg.ShowDialog(); // if ok if (dlgResult == System.Windows.Forms.DialogResult.OK) { AcadApp.DocumentManager.MdiActiveDocument.SendStringToExecute("-_.OPENPROJECT "" + dlg.FileName + ""n", true, false, true); } } If the LoadProject() was working you would use it like this… [CommandMethod("loadMyProject")] public void loadProject() { // select project.xml System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog(); DirectoryInfo defaultPathDI = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); dlg.InitialDirectory = defaultPathDI.FullName; dlg.FileName = "project.xml"; dlg.Multiselect = false; System.Windows.Forms.DialogResult dlgResult = dlg.ShowDialog(); // if ok if (dlgResult == System.Windows.Forms.DialogResult.OK) { PlantProject pp = PlantProject.LoadProject(dlg.FileName, true, "", ""); PlantApplication.SetCurrentProject(pp, true); } }

Leave a Reply