Atelier Spreadsheet

From FreeCAD Documentation
Revision as of 15:07, 28 May 2016 by ThierryM (talk | contribs) (Created page with "Les fonctions Statistiques peuvent prendre un ou plusieurs arguments, séparés par une virgule ou un pint virgule. Les arguments peuvent contenir des plages (2 cellules sépa...")

introduced in version 0.15L'atelier tableur vous permet de créer et éditer des feuille de calculs, lancer des calculs, récupérer des informations depuis le modèle et d'exporter ces données pour d'autre applications de tableur comme LibreOffice ou Microsoft Excel.



Fonctions Supportées

Le tableur met à disposition les fonctions suivantes, elles prennent un ou deux arguments : abs, acos, asin, atan, atan2, cos, cosh, exp, log, log10, mod, pow, sin, sinh, sqrt, tan, tanh

Les fonctions trigonométriques utilisent le degrés par défaut; vous devez spécifier "rad" si vous voulez que les fonctions utilisent le radian.

Les fonctions supplémentaires : ceil, floor, trunc et round sont disponible dans la introduced in version 0.16 de FreeCAD

L'ensemble des fonctions suivante est supporté : average, count, max, min, stddev, sum.

Les fonctions Statistiques peuvent prendre un ou plusieurs arguments, séparés par une virgule ou un pint virgule. Les arguments peuvent contenir des plages (2 cellules séparées par 2 points), par exemple =moyenne(B1:B8)

The constants pi and e are predefined.

The conditional statement works like this: = condition ? resultTrue : resultFalse

The condition is defined as an expression that evaluates to either 0 (for false) or non-zero for true. The following comparison operators are defined: ==, !=, >, <, >=, and <=.

Formulas are written as follows: =A2+A3

Cell-references have to be written with upper letters.

Reference To CAD-Data

It is possible to use data from the construction in the spreadsheet. The following table shows some examples:

CAD-Data Call in Spreadsheet Result
Parametric Length of a Part-Workbench Cube =Cube.Length Length with units mm
Volume of the Cube =Cube.Shape.Volume Volume in mm³ without units
Type of the Cube-shape =Cube.Shape.ShapeType String: Solid
Label of the Cube =Cube.Label String: Cube
x-coordinate of center of mass of the Cube =Cube.Shape.CenterOfMass.x x-coordinate in mm without units


Cell Properties

The properties of a spreadsheet cell can be edited with a right-click on a cell. The following dialog pops up:

It has several tabs. The following properties can be changed:

  • Text color and background color
  • Text horizontal and vertical alignment
  • Text style: bold, italic, underline
  • Display unit for this cell. Please read the section below.
  • Define an alias-name for this cell. This alias-name can be used in cell-formulas and also in FreeCAD-Expressions introduced in version 0.16

The expressions are explained here: Expressions

Spreadsheet-Data in Expressions

The usage of spreadsheet data in other parts of FreeCAD requires a fully defined name. Because it is possible to have more than one spreadsheet in a document, the spreadsheet name together with the cell name or alias is required. The following pictures showing the usage of an alias "number" from a spreadsheet "MySheet" in an expression in the PartDesign-Workbench.

Typing an "M" shows a list of available names. The arrow-buttons allow to select "MySheet".

Typing an "n" shows now the list of available alias names in MySheet starting with "n". The "number" can be selected with the down-arrow-button. Once a valid name with a usable content is given, the result field will present the calculated length.

Units

The Spreadsheet uses units. If a number has a unit, this unit will be used in all calculations. The multiplication of two length with the unit mm gives an area with the unit mm².

You can switch the length-unit from mm to inch in the dialog, you get with a right-click on a cell. The cell will now show the length in inches. The value used for calculations does not change. The results of a formula using this value do not change, when the shown unit of an input was changed. The result is still calculated from the length in mm.

A number without a unit cannot be changed in a number with unit by the cell properties dialog. One can put in a unit string, that will also be shown, but the cell still contains only a number without unit.

Sometime it is desirably to get rid of a unit. This can only to be done by multiplying with 1 with a reciprocal unit.


Current Limitations

Il n'est pas possible de fournir des données pour une géométrie, par exemple une longueur, dans une feuille de calcul et récupérer dans la même feuille le volume de la forme résultante. Ceci crée une référence circulaire. C'est une choix dans la conception. Cependant, il est possible d'utiliser deux feuilles différentes : une pour les données source de la géométrie et une autre pour reporter les données de la géométrie.

Il n'est pas possible de copier et de sélectionner plusieurs cellules. Seul le contenu d'une cellule d'un champ de saisie peut être copié et collé dans le champ de saisie d'une autre cellule.

Pour des anciennes versions de FreeCAD voir Spreadhseet legacy