I am trying to create a sphere by using C# pulling the values for location(x,y,z), radius, and color from a SQL DB. I can't seem to figure out how to generate my sphere anywhere but at the origin.
How can I move the location of my sphere to x,y,z.
Also, I noticed that Autodesk.AutoCAD.Geometry.Sphere has a constructor that allows you to specify a center but I then have problems adding it to the block table record.
Any suggestions would be greatly appreciated.
Thanks!
Here's the method I have so far:
public void createSphere(double x,double y,double z,double radius,int ci)
{
BlockTableRecord btr;
Transaction trans = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction();
Database db = HostApplicationServices.WorkingDatabase;
Solid3d sphere=new Solid3d();
sphere.ColorIndex = ci;
//I want to set center of sphere to x,y,z here
sphere.CreateSphere(radius);
btr = (BlockTableRecord)trans.GetObject(HostApplicationServices.WorkingDatabase.CurrentSpaceId, OpenMode.ForWrite);
btr.AppendEntity(sphere);
trans.AddNewlyCreatedDBObject(sphere, true);
trans.Commit();
trans.Dispose();
}