Hi,
I started again from scratch and now I get results I comprehend. Can't say what is different now as I used the code sample from ADSK .net developer docs.
I need to replace an image which has been inserted into roughly 1000 drawings. It is georeferenced and has been inserted using AutoCAD Map command "mapiinsert". There is no API equivalent for mapiinsert in Map API and the command cannot be run in command line only.
My first idea was to insert the replacement image (georeferenced) into a new drawing using "mapiinsert" again, then read out the insertion/scale/size settings in order to reapply them within a batch routine to replace the existing image file in the drawing collection. But when I inserted the image using mapiinsert, imageattach or my plugin I got different results mainly for "Scale".
It took same time to get the settings right - although I haven't completely understood why the ones I have choosen are ok. As I have only one specific use case I don't mind that much. In case someone has a similar task - here are my settings so far (drawing units are Meter as well):
...
acRasterDef.Load();
// 0.3125 --> parameter given in world file (contains the georeference information)
acRasterDef.ResolutionMMPerPixel = new Vector2d(312.5, 312.5);
acRasterDef.ResolutionUnits = Unit.Meter;
//insertion point - easy : just the insertion point
Point3d insPt = new Point3d(2690000.95, 1255499.79, 0.0);
...
// size (width/height)
// 0.3125 --> parameter given in world file (contains the georeference information)
Vector3d u = new Vector3d(acRaster.ImageWidth * 0.3125, 0, 0);
Vector3d v = new Vector3d(0, acRaster.ImageHeight * 0.3125, 0);
acRaster.Orientation = new CoordinateSystem3d(insPt, u,v);
..
The image will be inserted with Scale = 1, exactly as if it were inserted using "mapiinsert".
Rob