public void OpenSheetSet() { // User Input: editor equals command line // To talk to the user you use the command line, aka the editor Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptStringOptions pso = new PromptStringOptions("\nHello Nadia! \nWhat Sheet Set would you like to open?"); pso.DefaultValue = @"C:\Users\rhale\Documents\AutoCAD Sheet Sets\Squid666.dst"; pso.UseDefaultValue = true; pso.AllowSpaces = true; PromptResult pr = ed.GetString(pso); // Get a reference to the Sheet Set Manager object IAcSmSheetSetMgr sheetSetManager = default(IAcSmSheetSetMgr); sheetSetManager = new AcSmSheetSetMgr(); // Open a Sheet Set file AcSmDatabase sheetSetDatabase = default(AcSmDatabase); //sheetSetDatabase = sheetSetManager.OpenDatabase(@"C:\Users\Robert\Documents\AutoCAD Sheet Sets\Expedia.dst", false); sheetSetDatabase = sheetSetManager.OpenDatabase(pr.StringResult, false); // Return the namd and description of the sheet set MessageBox.Show("Sheet Set Name: " + sheetSetDatabase.GetSheetSet().GetName() + "\nSheet Set Description: " + sheetSetDatabase.GetSheetSet().GetDesc()); // Close the sheet set sheetSetManager.Close(sheetSetDatabase); }
public void CreateSheetSet() { // User Input: editor equals command line // To talk to the user you use the command line, aka the editor Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptResult pr = ed.GetFileNameForSave("Hello Nadia, Where would you would like to save the new Sheet Set?"); PromptStringOptions pso = new PromptStringOptions("\nHello Nadia! \nWhat will be the name of the new Sheet Set?"); pso.AllowSpaces = true; PromptResult prSheetSetName = ed.GetString(pso); PromptStringOptions psoDescription = new PromptStringOptions("\nHello Nadia! \nWhat will be the description of the new Sheet Set?"); psoDescription.AllowSpaces = true; PromptResult prSheetSetDescription = ed.GetString(psoDescription); //pso.DefaultValue = @"C:\Users\Robert\Documents\AutoCAD Sheet Sets\Expedia.dst"; //pso.UseDefaultValue = true; // works... // Get a reference to the Sheet Set Manager object IAcSmSheetSetMgr sheetSetManager = new AcSmSheetSetMgr(); // Create a new sheet set file //AcSmDatabase sheetSetDatabase = sheetSetManager.CreateDatabase(@"C:\Users\Robert\Documents\AutoCAD Sheet Sets\ExpediaSheetSetDemo.dst", "", true); AcSmDatabase sheetSetDatabase = sheetSetManager.CreateDatabase(pr.StringResult, "", true); // Get the sheet set from the database AcSmSheetSet sheetSet = sheetSetDatabase.GetSheetSet(); // Attempt to lock the database if (LockDatabase(ref sheetSetDatabase, true) == true) { // Set the name and description of the sheet set //sheetSet.SetName("ExpediaSheetSetTest"); sheetSet.SetName(prSheetSetName.StringResult); //sheetSet.SetDesc("Aluminum Bronze Fabricator's Sheet Set Object Demo"); sheetSet.SetDesc(prSheetSetDescription.StringResult); // Unlock the database LockDatabase(ref sheetSetDatabase, false); // Return the name and description of the sheet set MessageBox.Show("Sheet Set Name: " + sheetSetDatabase.GetSheetSet().GetName() + "\nSheet Set Description: " + sheetSetDatabase.GetSheetSet().GetDesc()); } else { // Display error message MessageBox.Show("Sheet set could not be opened for write."); } // Close the sheet set sheetSetManager.Close(sheetSetDatabase); }
public void Close(Database database) { IAcSmSheetSetMgr ssMgr = new AcSmSheetSetMgr(); AcSmDatabase dbToClose = database.BaseObject; ssMgr.Close(dbToClose); dbToClose.Clear(); dbToClose = null; }
public void CreateSheetSet_WithSubset() { // User Input: editor equals command line // To talk to the user you use the command line, aka the editor Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptResult pr = ed.GetFileNameForSave("Hello Nadia, Where would you would like to save the new Sheet Set?"); PromptStringOptions pso = new PromptStringOptions("\nHello Nadia! \nWhat will be the name of the new Sheet Set?"); pso.AllowSpaces = true; PromptResult prSheetSetName = ed.GetString(pso); PromptStringOptions psoDescription = new PromptStringOptions("\nHello Nadia! \nWhat will be the description of the new Sheet Set?"); psoDescription.AllowSpaces = true; PromptResult prSheetSetDescription = ed.GetString(psoDescription); // Get a reference to the Sheet Set Manager object IAcSmSheetSetMgr sheetSetManager = new AcSmSheetSetMgr(); // Create a new sheet set file //AcSmDatabase sheetSetDatabase = sheetSetManager.CreateDatabase("C:\\Datasets\\CP318-4\\CP318-4.dst", "", true); AcSmDatabase sheetSetDatabase = sheetSetManager.CreateDatabase(pr.StringResult, "", true); // Get the sheet set from the database AcSmSheetSet sheetSet = sheetSetDatabase.GetSheetSet(); // Attempt to lock the database if (LockDatabase(ref sheetSetDatabase, true) == true) { // Set the name and description of the sheet set sheetSet.SetName(prSheetSetName.StringResult); sheetSet.SetDesc(prSheetSetDescription.StringResult); // Create two new subsets AcSmSubset subset = default(AcSmSubset); //subset = CreateSubset(sheetSetDatabase, "Plans", "Building Plans", "", "C:\\Datasets\\CP318-4\\CP318-4.dwt", "Sheet", false); subset = CreateSubset(sheetSetDatabase, "Submittals", "Project Submittals", "", @"C:\Users\Robert\Documents\AutoCAD Sheet Sets\ABFStylesSS.dwt", "Sheet", false); //subset = CreateSubset(sheetSetDatabase, "Elevations", "Building Elevations", "", "C:\\Datasets\\CP318-4\\CP318-4.dwt", "Sheet", true); subset = CreateSubset(sheetSetDatabase, "As Builts", "Project As Builts", "", @"C:\Users\Robert\Documents\AutoCAD Sheet Sets\ABFStylesSS.dwt", "Sheet", true); // Unlock the database LockDatabase(ref sheetSetDatabase, false); } else { // Display error message MessageBox.Show("Sheet set could not be opened for write."); } // Close the sheet set sheetSetManager.Close(sheetSetDatabase); }
public void SyncProperties() { // User Input: editor equals command line // To talk to the user you use the command line, aka the editor Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptResult pr1 = ed.GetFileNameForOpen("Hello Nadia, Please select the Sheet Set you would like to edit."); PromptStringOptions pso = new PromptStringOptions("\nHello Nadia! \nWhat version # is the drawing at?"); //pso.DefaultValue = @"C:\Users\Robert\Documents\AutoCAD Sheet Sets\Expedia.dst"; //pso.UseDefaultValue = true; pso.AllowSpaces = true; PromptResult pr = ed.GetString(pso); string versionNumber = pr.StringResult; pso = new PromptStringOptions("\nHello Nadia! \nWhat is the version issue date?"); pr = ed.GetString(pso); string versionIssueDate = pr.StringResult; // Get a reference to the Sheet Set Manager object IAcSmSheetSetMgr sheetSetManager = new AcSmSheetSetMgr(); // Create a new sheet set file //AcSmDatabase sheetSetDatabase = sheetSetManager.CreateDatabase("C:\\Datasets\\CP318-4\\CP318-4.dst", "", true); //AcSmDatabase sheetSetDatabase = sheetSetManager.CreateDatabase(@"C:\Users\rhale\Documents\AutoCAD Sheet Sets\Expedia.dst", "", true); // Open a Sheet Set file AcSmDatabase sheetSetDatabase = default(AcSmDatabase); //sheetSetDatabase = sheetSetManager.OpenDatabase("C:\\Program Files\\AutoCAD 2010\\Sample\\Sheet Sets\\Architectural\\IRD Addition.dst", false); //sheetSetDatabase = sheetSetManager.OpenDatabase(@"C:\Users\rhale\Documents\AutoCAD Sheet Sets\Expedia.dst", false); sheetSetDatabase = sheetSetManager.OpenDatabase(pr1.StringResult, false); // Get the sheet set from the database AcSmSheetSet sheetSet = sheetSetDatabase.GetSheetSet(); // Attempt to lock the database if (LockDatabase(ref sheetSetDatabase, true) == true) { // Get the folder the sheet set is stored in string sheetSetFolder = null; sheetSetFolder = sheetSetDatabase.GetFileName().Substring(0, sheetSetDatabase.GetFileName().LastIndexOf("\\")); // Set the default values of the sheet set //SetSheetSetDefaults(sheetSetDatabase, "CP318-4", "AU2009 Sheet Set Object Demo", sheetSetFolder, "C:\\Datasets\\CP318-4\\CP318-4.dwt", "Sheet"); SetSheetSetDefaults(sheetSetDatabase, "Expedia Sheet Set", "ABF Sheet Set Object Demo", sheetSetFolder, @"C:\Users\rhale\Documents\AutoCAD Sheet Sets\ABFStylesSS.dwt", "Sheet"); // Create a sheet set property SetCustomProperty(sheetSet, "Project Approved By", "Erin Tasche", PropertyFlags.CUSTOM_SHEETSET_PROP); // Create sheet properties //SetCustomProperty(sheetSet, "Checked By", "LAA", PropertyFlags.CUSTOM_SHEET_PROP); //SetCustomProperty(sheetSet, "Complete Percentage", "0%", PropertyFlags.CUSTOM_SHEET_PROP); SetCustomProperty(sheetSet, "Version #", versionNumber, PropertyFlags.CUSTOM_SHEET_PROP); SetCustomProperty(sheetSet, "Version Issue Date", versionIssueDate, PropertyFlags.CUSTOM_SHEET_PROP); //AddSheet(sheetSetDatabase, "Title Page", "Project Title Page", "Title Page", "T1"); // Create two new subsets AcSmSubset subset = default(AcSmSubset); //subset = CreateSubset(sheetSetDatabase, "Plans", "Building Plans", "", "C:\\Datasets\\CP318-4\\CP318-4.dwt", "Sheet", false); subset = CreateSubset(sheetSetDatabase, "Submittals", "Project Submittals", "", @"C:\Users\Robert\Documents\AutoCAD Sheet Sets\ABFStylesSS.dwt", "Sheet", false); //subset = CreateSubset(sheetSetDatabase, "Elevations", "Building Elevations", "", "C:\\Datasets\\CP318-4\\CP318-4.dwt", "Sheet", true); subset = CreateSubset(sheetSetDatabase, "As Builts", "Project As Builts", "", @"C:\Users\Robert\Documents\AutoCAD Sheet Sets\ABFStylesSS.dwt", "Sheet", true); // Add a sheet property //SetCustomProperty(sheetSet, "Drafted By", "KMA", PropertyFlags.CUSTOM_SHEET_PROP); // Add a subset property SetCustomProperty(sheetSet, "Count", "0", PropertyFlags.CUSTOM_SHEETSET_PROP); // Sync the properties of the sheet set with the sheets and subsets SyncProperties(sheetSetDatabase); // Unlock the database LockDatabase(ref sheetSetDatabase, false); } else { // Display error message MessageBox.Show("Sheet set could not be opened for write."); } // Close the sheet set sheetSetManager.Close(sheetSetDatabase); }
public void CreateSheetSet_AddCustomProperty() { // Get a reference to the Sheet Set Manager object IAcSmSheetSetMgr sheetSetManager = new AcSmSheetSetMgr(); // Create a new sheet set file //AcSmDatabase sheetSetDatabase = sheetSetManager.CreateDatabase("C:\\Datasets\\CP318-4\\CP318-4.dst", "", true); //AcSmDatabase sheetSetDatabase = sheetSetManager.CreateDatabase("C:\\Datasets\\CP318-4\\CP318-4.dst", "", true); //AcSmDatabase sheetSetDatabase = sheetSetManager.OpenDatabase(@"C:\Users\rhale\Documents\AutoCAD Sheet Sets\Expedia.dst", true); //AcSmDatabase sheetSetDatabase = sheetSetManager.(@"C:\Users\rhale\Documents\AutoCAD Sheet Sets\Expedia.dst", true); // Open a Sheet Set file AcSmDatabase sheetSetDatabase = default(AcSmDatabase); //sheetSetDatabase = sheetSetManager.OpenDatabase("C:\\Program Files\\AutoCAD 2010\\Sample\\Sheet Sets\\Architectural\\IRD Addition.dst", false); sheetSetDatabase = sheetSetManager.OpenDatabase(@"C:\Users\rhale\Documents\AutoCAD Sheet Sets\Expedia.dst", false); // Get the sheet set from the database AcSmSheetSet sheetSet = sheetSetDatabase.GetSheetSet(); // Attempt to lock the database if (LockDatabase(ref sheetSetDatabase, true) == true) { // Get the folder the sheet set is stored in string sheetSetFolder = null; sheetSetFolder = sheetSetDatabase.GetFileName().Substring(0, sheetSetDatabase.GetFileName().LastIndexOf("\\")); // Set the default values of the sheet set SetSheetSetDefaults(sheetSetDatabase, "My Expedia Sheet Set", "A&B Fabricators Sheet Set Object Demo", sheetSetFolder, @"C:\Users\rhale\Documents\AutoCAD Sheet Sets\ABFStylesSS.dwt", "Sheet"); // Create a sheet set property SetCustomProperty(sheetSet, "Project Approved By", "Erin Tasche", PropertyFlags.CUSTOM_SHEETSET_PROP); // Create sheet properties SetCustomProperty(sheetSet, "Checked By", "NK", PropertyFlags.CUSTOM_SHEET_PROP); SetCustomProperty(sheetSet, "Complete Percentage", "90%", PropertyFlags.CUSTOM_SHEET_PROP); SetCustomProperty(sheetSet, "Version #", "D", PropertyFlags.CUSTOM_SHEET_PROP); SetCustomProperty(sheetSet, "Version Issue Date", "08/29/19", PropertyFlags.CUSTOM_SHEET_PROP); //AddSheet(sheetSetDatabase, "Title Page", "Project Title Page", "Title Page", "T1"); // Create two new subsets AcSmSubset subset = default(AcSmSubset); subset = CreateSubset(sheetSetDatabase, "Plans", "Building Plans", "", @"C:\Users\rhale\Documents\AutoCAD Sheet Sets\ABFStylesSS.dwt", "Sheet", false); //AddSheet(subset, "North Plan", "Northern section of building plan", "North Plan", "P1"); subset = CreateSubset(sheetSetDatabase, "Elevations", "Building Elevations", "", @"C:\Users\rhale\Documents\AutoCAD Sheet Sets\ABFStylesSS.dwt", "Sheet", true); // Sync the properties of the sheet set with the sheets and subsets SyncProperties(sheetSetDatabase); // Unlock the database LockDatabase(ref sheetSetDatabase, false); } else { // Display error message MessageBox.Show("Sheet set could not be opened for write."); } // Close the sheet set sheetSetManager.Close(sheetSetDatabase); }