.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

writing tool to add custom drawing properties

1 REPLY 1
Reply
Message 1 of 2
gbstsma
2176 Views, 1 Reply

writing tool to add custom drawing properties

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();

 

 

1 REPLY 1
Message 2 of 2
MarcioCartacho
in reply to: gbstsma

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)

 

 

Create Material

 

 

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();
        } 

 

Metso Minerals

Márcio Lourenço Cartacho
C.A.D application Developer

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost