Arbeitsbereich Tabellenkalkulation

From FreeCAD Documentation
Revision as of 17:48, 27 January 2018 by Ulrich1a (talk | contribs) (Created page with "Noteː Zell-Referenzen müssen mit Großbuchstaben angegeben werden.")

introduced in version 0.15/deDer Arbeitsbereich Tabellenkalkulation ermöglicht die Erstellung und Bearbeitung von Tabellen, die Durchführen von Berechnungen und die Daten eines 3D-Models einzufügen. Die Daten der Tabelle können im CSV-Format exportiert werden zur Verwendung in Anwendungen wie LibreOffice oder Microsoft Excel.



Unterstützte Funktionen

Die folgenden Funktionen mit einem oder zwei Argumenten stehen zur Verfügung: abs, acos, asin, atan, atan2, cos, cosh, exp, log, log10, mod, pow, sin, sinh, sqrt, tan, tanh

Trigonometrische Funktionen verwenden Grad als Standardeinheit. Durch Hinzufügen von "rad" kann auch die Einheit Radiant verwendet werden.

Die zusätzlichen Funktionen: ceil, floor, trunc, und round stehen in FreeCAD seit introduced in version 0.16/de zur Verfügung.

Die folgenden statistischen Funktionen sind verfügbar: average, count, max, min, stddev, sum.

Die statistischen Funktionen können mit einem oder mehreren Argumenten getrennt durch ein Komma oder ein Semikolon aufgerufen werden. Als Argumente können auch Bereiche (zwei Zellverweise getrennt durch einen Doppelpunkt) angegeben werden, z. B.: =average(B1:B8)

Die Konstanten pi und e sind vordefiniert.

Die bedingte Anweisung wird wie folgt benutzt: = Bedingung ? Wahr-Ergebnis : Falsch-Ergebnis

Die Bedingung muss ein Ausdruck sein, der entweder 0 (für falsch) oder ungleich 0 für wahr ergibt. Die folgenden Vergleichsoperatoren stehen zur Verfügung: ==, !=, >, <, >=, und <=.

Formeln werden wie folgt eingegeben: =A2+A3

Noteː Zell-Referenzen müssen mit Großbuchstaben angegeben werden.

Reference To CAD-Data

It is possible to use data from the construction in the spreadsheet. The following table shows some examples assuming the model has a feature named "Cube" (note that this is the internal name of the feature, not the user assigned Label):

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 FreeCADExpressions 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.

Importing and exporting

Sheets can be imported and exported to the csv format which can also be read and written by most other spreadsheet applications such as Microsoft Excel or LibreOffice Calc. When importing files into FreeCAD, the delimiter (the character that is used to separate columns) must be the TAB character (this can be set when exporting from other applications).

Spreadsheets in Excel-format "xlsx" can be imported into a FreeCAD document. Excel-spreadsheets can also be opened by FreeCAD. In this case a new document with a spreadsheet inside is created. Supported are the following features:

  • all functions that are also available in the FreeCAD spreadsheet. Other functions do give an error in the corresponding cell after the import.
  • Alias names for cells
  • More than one table in the Excel-sheet. In this case more FreeCAD spreadsheets are created.

Other functionality is not imported into the FreeCAD spreadsheet. The Excel-import is introduced in version 0.17of FreeCAD.

Current Limitations

It is not possible providing data for a geometry, for example a length, in a spreadsheet and retrieving in the same spreadsheet the volume of the resulting shape. This will create a circular reference. This is a design decision. However, it is possible to use two different spreadsheets: one as data-source for geometry and another for reporting geometry-data.

It is not possible to select and copy multiple cells. Only the content of a cell from the input field can be copied and paste into the input field of another cell.

For FreeCAD earlier versions see Spreadsheet legacy