I just started studying C#. Yes I'm a newbie.
Through Microsoft Visual Studio 2010, I would like to import the drawing I created in Autocad.
http://exchange.autodesk.com/autocadarchitecture/enu/online-help/browse#WS73099cc142f48755f2fc9df120970276f7-5354.htm[
^]
is the autodesk website where I followed the process, and here's the following code I copied.
-------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
[assembly: CommandClass(typeof(MyFirstProject1.Class1))]
namespace MyFirstProject1
{
public class Class1
{
[CommandMethod("AdskGreeting")]
public void AdskGreeting()
{
Document acDoc = Application.DocumentManager.MdiActiveDocument;
Database acCurDb = acDoc.Database;
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
BlockTable acBlkTbl;
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,
OpenMode.ForRead) as BlockTable;
BlockTableRecord acBlkTblRec;
acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
OpenMode.ForWrite) as BlockTableRecord;
MText objText = new MText();
objText.Location = new Autodesk.AutoCAD.Geometry.Point3d(2, 2, 0);
objText.Contents = "Greetings, Welcome to the AutoCAD .NET Developer's Guide";
objText.TextStyleId = acCurDb.Textstyle;
acBlkTblRec.AppendEntity(objText);
acTrans.AddNewlyCreatedDBObject(objText, true);
acTrans.Commit();
}
}
}
}
--------------------------------------------------------------------------------
I'm getting errors on CommandClass, CommandMethod, Document, and Document Manager.
I referecned acdbmgd.dll, acmgd.dll(Autocad .NET API ) files, and added
using Autodesk.AutoCAD.Runtime;
However, the error says that The type or namespace could not be found.I don't get it!!