Macro Snip

Description
Use this macro to easily post screenshots to the FreeCAD forum.

It is best to add this macro to your global custom macros toolbar for quick and easy access.

When posting to the FreeCAD forum it is often useful to be able to include screenshots. The problem is this is a somewhat tedious task. This macro is to make that task a bit easier.

The macro can take screenshots or it can use existing screenshots that have already been copied to the system clipboard. To bypass the image already in clipboard press the Shift key while invoking the macro. To use the macro to take the screenshot adjust the size and placement of the dialog that pops up, then click OK. Upon clicking OK the macro will attempt to take a screenshot of the area of the screen covered by the dialog. The dialog itself is semi-transparent, so you can see the contents beneath. (Note: at this time the macro only can take a screenshot if you are using one of the FreeCAD Qt5 builds, but it can still be used to manage the screenshots already on the system clipboard.)



After clicking OK, the macro then takes the screenshot and saves it to a temporary file. A file open dialog is then opened at the file's location. You can drag and drop the file from there to the forum into the textarea where you type in your text for your forum post. Upon canceling the dialog the temporary screenshot file is deleted automatically. You may also open the screenshot file in your default application installed for opening .png files. On Windows this is typically Paint. This can be useful if you wish to add some annotations to the screenshot or perhaps additional editing, such as cropping.



If the macro doesn't work on your system to capture screenshots it can still be useful for screenshots you have captured using other tools. Simply copy the screenshot to the clipboard, then run the macro. It will create the temporary file and open the file's directory in an open file dialog for you. Some other tools for taking screenshots:

On Windows: Windows Key + Shift + S On Mac: Command + Shift + 4 On Linux: gnone-screenshot utility

The Macro supports user parameters, which can be set using Tools menu → Edit Parameters. Look in Plugins → Snip_Macro. LastX, LastY, LastWidth, LastHeight -- location and size of snip box last use WindowOpacity (0.85) -- value between 0.0 (less opaque) and 1.0 (more opaque) SnipDelay (0.5) -- time (in seconds) delay between snip box close and snip

The Last parameters are reset by the macro each time it is run. This is how it keeps track of where to place the snip box, which is the last place it was when the user took a screenshot.

The WindowOpacity parameter is the opacity of the snip box.

The SnipDelay parameter can be adjusted to speed things up a bit, but if it is too small the screenshot taken might include the snip box itself because we need to wait for it to close before taking the screenshot.

Script
ToolBar icon

Macro_Snip.FCMacro

Link
The forum discussion Snip macro