Some time ago I reported the following issue #3959. Since I have not done any coding soon I decided to leave it at that but today I found some drawings that I thought recreating and remembered about that problem. And decided to look into the code and find how it was done.
Creating ImagePlane is done in https://github.com/FreeCAD/FreeCAD/blob ... ommand.cpp and sizing is done in lines 141-149
Code: Select all
std::string FeatName = getUniqueObjectName("ImagePlane");
double xPixelsPerM = impQ.dotsPerMeterX();
double width = impQ.width();
width = width * 1000 / xPixelsPerM;
int nWidth = static_cast<int>(width+0.5);
double yPixelsPerM = impQ.dotsPerMeterY();
double height = impQ.height();
height = height * 1000 / yPixelsPerM;
int nHeight = static_cast<int>(height+0.5);
For scans this could be neglected but I am pretty sure that 90% of the time images used as ImagePlane are either cropped photos or something downloaded from some site where only displaying on screen is important.
So my proposal is to change the last line to:
Code: Select all
double nHeight = nWidth * height / width