[CommandMethod("doit")]
public void test()
{
Bitmap bitmap = new Bitmap("C:\\zot.bmp");
Database db = AcAp.Application.DocumentManager.MdiActiveDocument.Database;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
AcDb.BlockTableRecord currentSpace = tr.GetObject
(db.CurrentSpaceId, OpenMode.ForWrite) as AcDb.BlockTableRecord;
for (int i = 0; i < bitmap.Width; i++)
{
for (int j = 0; j < bitmap.Height; j++)
{
DBPoint point = new DBPoint();
Teigha.Colors.Color color =
Teigha.Colors.Color.FromColor(bitmap.GetPixel(i, j));
point.Color = color;
double z = (color.ColorValue.R + color.ColorValue.G + color.ColorValue.B) * 0.01;//change this
point.Position = new Point3d(i, j, z);
currentSpace.AppendEntity(point);
tr.AddNewlyCreatedDBObject(point, true);
}
}
tr.Commit();
}