Macro MatrixTransform/en

Description
Applies linear transformation to a shape, defined by a 3x3 matrix. It is possible to:
 * apply non-linear scaling to a shape
 * shear a shape
 * rotate a shape

The transformation in the macro is linear. Lines remain straight, planes remain planar, parallel things remain parallel, only angles are distorted.

Installation:
download these two files and save them in macro directory:

https://github.com/DeepSOIC/FreeCAD-Macros/raw/master/MatrixTransform/MatrixTransform.FCMacro

https://github.com/DeepSOIC/FreeCAD-Macros/raw/master/MatrixTransform/MatrixTransform.py

How to use:

 * 1) Select the shape to be transformed
 * 2) In FreeCAD menu: Macro -> Macros... -> double-click MatrixTransform.FCMacro . A new object will be created.
 * 3) Select the new object, and edit v1,v2,v3 properties on data tab to set the transformation matrix.

Matrix is defined by three vectors:

v1x  v2x   v3x M = ( v1y   v2y   v3y ) v1z  v2z   v3z Here, v1,v2,v3 are vectors that can be defined in properties. They correspond to new directions of what was originally X,Y,Z axes.

No transformation
1 0  0    0  1  0    0  0  1

non-uniform scaling
scaleX   0      0 0  scaleY    0 0     0   scaleZ

shearing
(operation that makes regular text into italic; assuming text is in XY plane) 1 shear  0 0   1    0    0    0    1 'Shear' coefficient defines the amount of shearing. 0 is no shearing. 1 makes the text italic by 45 degrees. -1 shears in backslash-like fashion.

Warning. All geometry is converted to B-splines, even if it doesn't have to. This can cause all sorts of trouble. Use only if absolutely necessary.

Script
ToolBar Icon

MatrixTransform.py:

Macro MatrixTransform.FCMacro

Run the macro

MatrixTransform.FCMacro: