Hi,
I have installed the autocad ObjectARX 2011 and .Net wizzard to start writing a .Net application for adding custom drawing parameters to all our acad drawings. I have found two issues detailed below. This is my first attempt at using c# with autocad so any pointers on what I am doing wrong will be well received.
1. If add the AcDbMgd.dll and AcMgd.dll references and set copy local to false as the documentation advises then I get a FileNotFoundException, could not load file or assembly 'acdbmgd'. If I set the copy local to true then the error goes away.
2. I tried using the code below to add a paramater but I get an exception on the first line System.TypeLoadException: Method 'CopyTo'.
Autodesk.AutoCAD.DatabaseServices.Databasedatabase = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
//Users builder to edit the summary info (file properties) of the drawing
Autodesk.AutoCAD.DatabaseServices.DatabaseSummaryInfoBuilder infoBuilder = new Autodesk.AutoCAD.DatabaseServices.DatabaseSummaryInfoBuilder(database.SummaryInfo);
string key = "test";
string value = "testvalue";
infoBuilder.CustomPropertyTable.Add(key, value);
database.SummaryInfo = infoBuilder.ToDatabaseSummaryInfo();
Hello, gbstsma
Take a look at the way I do.
I Hope that this example helps you.
My references AcDbMgd and AcMgd Path: C:\ObjectARX 2010\inc-win32
(Copy Local = False)
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application; privatevoid TransferirDadostoolStripButton_Click(object sender, EventArgs e) { ClearSummaryCustom(); PopulaCustomComuns(); } publicvoid PopulaCustomComuns() { AcadDocument doc = (AcadDocument)AcadApp.DocumentManager.MdiActiveDocument.AcadDocument; doc.SummaryInfo.AddCustomInfo(textBoxD_Number.Tag.ToString(), textBoxD_Number.Text); doc.SummaryInfo.AddCustomInfo(textBoxRev.Tag.ToString(), textBoxRev.Text); doc.SummaryInfo.AddCustomInfo(textBoxLab.Tag.ToString(), tratamentoStrings(textBoxLab.Text)); doc.SummaryInfo.AddCustomInfo(textBoxProduct_Group.Tag.ToString(), tratamentoStrings(textBoxProduct_Group.Text)); doc.SummaryInfo.AddCustomInfo(textBoxProduct_Type.Tag.ToString(), tratamentoStrings(textBoxProduct_Type.Text)); doc.SummaryInfo.AddCustomInfo(textBoxUnidade.Tag.ToString(), tratamentoStrings(textBoxUnidade.Text)); doc.Save(); }
Can't find what you're looking for? Ask the community or share your knowledge.