https://github.com/FreeCAD/FreeCAD/pull/5125
It is based on this macro from kisolre:
Code: Select all
from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
vpSize = Gui.activeView().getSize()
invHeight = min(vpSize[0], vpSize[1])
vpDpi = Gui.getMainWindow().physicalDpiX()
cam.height.setValue(invHeight*25.4/vpDpi)
What it does, when it works, is zooms the camera to a height such that, for example, a 10mm cube will measure (using a ruler held up to your screen) to be 10mm across (obviously when viewed orthogonally directly from front, side, top, etc.). This could be very handy when trying to model something to mate with another object, at least to get a rough approximation by holding the other part up to the screen for a comparison, and also just to get a better feel for the actual size of the object you are modeling.
One little problem: doesn't always work. We need folks to run the macro and report whether it worked or not for them and if not what their hardware specs are so we can get a better idea of what the failure rates are and decide from there whether this is worth merging into master. The only failure I know of is when running inside a virtual machine: (ubuntu guest running in a Virtual Box vm with a Windows 10 host). The cube measures 15mm instead of the expected 10 inside the VM, depending on the scaling being used in the Virtual Box settings.
There is a tweak parameter to solve this issue in these cases. It will be in the View folder in Edit Parameters: BaseApp/Preferences/View/ZoomActualTweak (float property). The way the tweak works is you measure the cube (or whatever) and if your measurement is 15mm when the expected size was 10mm then you would enter 1.5 as the tweak parameter. With the tweak it should work flawlessly after that (unless the VM scaling is changed). Is the tweak needed only for people running FreeCAD inside a Virtual Machine or can it also be required with some particular hardware, such as notebooks, tablets, or some graphics cards?
I'm adding a 3-day poll to make it easier to gauge responses.