R
r h
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk;
using Autodesk.AutoCAD;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.DatabaseServices;
namespace AcadProj2
{
public class Commands
{
[CommandMethod("newCmd1")]
static public void newCmd1()
{
Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Place your code here.");
}
[CommandMethod("DIS")]
static public void DrawInModelSpace()
{
TransactionManager myTransMan;
Transaction myTrans;
Database myDB;
BlockTable myBT;
BlockTableRecord myBTR;
Point3d cenPT = new Point3d(1,2,3);
Vector3d cVect = new Vector3d(0,0,1);
Circle myCircle = new Circle(cenPT,cVect,1);
//open the database for Read
myBT = (BlockTable) myDB.BlockTableId.GetObject(OpenMode.ForRead);
//Get the block table record and add a new circle to the block.
myBTR = (BlockTableRecord)myBT[BlockTableRecord.ModelSpace].GetObject(OpenMode.ForWrite);
myBTR.AppendEntity(myCircle);
myTrans.AddNewlyCreatedDBObject(myCircle,true);
//commit the Transaction
myTrans.Commit();
//Dispose of the Transaction objects
myTrans.Dispose();
myTransMan.Dispose();
}
}
}
EggHeadCafe - Software Developer Portal of Choice
C# and GDI : draw Round rectangles, fonts, ellipse, fonts
http://www.eggheadcafe.com/tutorial...f96-f7b6c502a6e2/c-and-gdi--draw-round-r.aspx
using System.Collections.Generic;
using System.Text;
using Autodesk;
using Autodesk.AutoCAD;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.DatabaseServices;
namespace AcadProj2
{
public class Commands
{
[CommandMethod("newCmd1")]
static public void newCmd1()
{
Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Place your code here.");
}
[CommandMethod("DIS")]
static public void DrawInModelSpace()
{
TransactionManager myTransMan;
Transaction myTrans;
Database myDB;
BlockTable myBT;
BlockTableRecord myBTR;
Point3d cenPT = new Point3d(1,2,3);
Vector3d cVect = new Vector3d(0,0,1);
Circle myCircle = new Circle(cenPT,cVect,1);
//open the database for Read
myBT = (BlockTable) myDB.BlockTableId.GetObject(OpenMode.ForRead);
//Get the block table record and add a new circle to the block.
myBTR = (BlockTableRecord)myBT[BlockTableRecord.ModelSpace].GetObject(OpenMode.ForWrite);
myBTR.AppendEntity(myCircle);
myTrans.AddNewlyCreatedDBObject(myCircle,true);
//commit the Transaction
myTrans.Commit();
//Dispose of the Transaction objects
myTrans.Dispose();
myTransMan.Dispose();
}
}
}
EggHeadCafe - Software Developer Portal of Choice
C# and GDI : draw Round rectangles, fonts, ellipse, fonts
http://www.eggheadcafe.com/tutorial...f96-f7b6c502a6e2/c-and-gdi--draw-round-r.aspx