Message 1 of 6
Problem in drawing sphere...
Not applicable
02-09-2009
01:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to draw Sphere but it is giving me error;
{code}
using (tran = db.TransactionManager.StartTransaction())
{
try
{
BlockTable bt = (BlockTable)tran.GetObject(db.BlockTableId,OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)tran.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
Solid3d s = new Solid3d();
//Rectangle3d rec = new Rectangle3d(new Point3d(10, 20, 0), new Point3d(20, 20, 0), new Point3d(10, 0, 0), new Point3d(20, 10, 0));
Sphere sph = new Sphere(5, new Point3d(10, 10, 0), Vector3d.ZAxis, Vector3d.XAxis, 0, 360, 0, 360);
btr.AppendEntity(sph);
tran.AddNewlyCreatedDBObject(sph, true);
tran.Commit();
}
catch(Autodesk.AutoCAD.Runtime.Exception ex)
{
editor.WriteMessage("\nAutoCAD >>" + ex.Message);
}
catch(System.Exception ex)
{
editor.WriteMessage("\nSystem >>" + ex.Message);
}
}
{code}
{code}
using (tran = db.TransactionManager.StartTransaction())
{
try
{
BlockTable bt = (BlockTable)tran.GetObject(db.BlockTableId,OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)tran.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
Solid3d s = new Solid3d();
//Rectangle3d rec = new Rectangle3d(new Point3d(10, 20, 0), new Point3d(20, 20, 0), new Point3d(10, 0, 0), new Point3d(20, 10, 0));
Sphere sph = new Sphere(5, new Point3d(10, 10, 0), Vector3d.ZAxis, Vector3d.XAxis, 0, 360, 0, 360);
btr.AppendEntity(sph);
tran.AddNewlyCreatedDBObject(sph, true);
tran.Commit();
}
catch(Autodesk.AutoCAD.Runtime.Exception ex)
{
editor.WriteMessage("\nAutoCAD >>" + ex.Message);
}
catch(System.Exception ex)
{
editor.WriteMessage("\nSystem >>" + ex.Message);
}
}
{code}