Spreadsheet Workbench/es

Introducción
El Ambiente de trabajo de hojas de cálculo permite crear y editar hojas de cálculo, utilizar datos de la hoja de cálculo como parámetros en un modelo, rellenar la hoja de cálculo con datos recuperados de un modelo, realizar cálculos y exportar los datos a otras aplicaciones de hojas de cálculo como LibreOffice o Microsoft Excel.



Herramientas

 * Spreadsheet_CreateSheet.svg Crear hoja: crea una nueva hoja de cálculo.


 * Spreadsheet_Import.svg Importar: importa un archivo CSV a una hoja de cálculo.


 * Spreadsheet_Export.svg Exportar: exporta un archivo CSV desde una hoja de cálculo.


 * Spreadsheet_MergeCells.svg Unir celdas: une las celdas seleccionadas.


 * Spreadsheet_SplitCell.svg Dividir celdas: divide celdas previamente unidas.


 * Spreadsheet_AlignLeft.svg Alinear a la izquierda: alinea el contenido de las celdas seleccionadas a la izquierda.


 * Spreadsheet_AlignCenter.svg Alinear al centro: alinea el contenido de las celdas seleccionadas al centro horizontalmente.


 * Spreadsheet_AlignRight.svg Alinear a la derecha: alinea el contenido de las celdas seleccionadas a la derecha.


 * Spreadsheet_AlignTop.svg Alinear arriba: alinea el contenido de las celdas seleccionadas hacia arriba.


 * Spreadsheet_AlignVCenter.svg Alinear al centro vertical: alinea el contenido de las celdas seleccionadas al centro vertical.


 * Spreadsheet_AlignBottom.svg Alinear abajo: alinea el contenido de las celdas seleccionadas hacia abajo.


 * Spreadsheet_StyleBold.svg Estilo negrita: establece el contenido de las celdas seleccionadas a negrita.


 * Spreadsheet_StyleItalic.svg Estilo itálica: establece el contenido de las celdas seleccionadas a itálica.


 * Spreadsheet_StyleUnderline.svg Estilo subrayar: establece el contenido de las celdas seleccionadas a subrayar.


 * Spreadsheet_SetAlias.svg Establecer alias: establece el alias para una celda seleccionada.


 * y establecen los colores de primer plano y de fondo de las celdas seleccionadas.

Preferencias

 * [[Image:Preferences-spreadsheet.svg|32px]] Preferencias: las preferencias para el entorno de trabajo Spreadsheet.

Inserte elimine filas y columnas
Filas y columnas pueden ser insertadas o eliminadas haciendo clic derecho en un encabezado de fila o columna y seleccionando la opción apropiada en el menú contextual. Es posible seleccionar primero varias filas o columnas. Ya sea manteniendo presionado la tecla al seleccionar los encabezados, o manteniendo presionado el botón del mouse izquierdo y arrastrando.

En FreeCAD versión 0.19 y anteriores las filas son insertadas arriba de las filas seleccionadas, y las columnas a la izquierda de las columnas seleccionadas. En FreeCAD versión 0.20 puede especificar el lugar de inserción.

Tenga en cuenta que eliminar filas o columnas con datos puede romper la hoja de cálculo y su modelo si se basa en la hoja de cálculo. No será advertido previamente si esto sucede.

Cortar y copiar-pegar celdas
Las operaciones de cortar y copiar-pegar se pueden usar en las celdas de hojas de cálculo de FreeCAD. Puede usar los atajos normales para estas operaciones:,   y }  respectivamente. Para seleccionar múltiples celdas, mantenga presionada la tecla mientras selecciona, o mantenga presionado el botón del mouse izquierdo y arrastre para seleccionar un rango de celda rectangular.

The cut and copy operations store the contents and properties of the cells on the Clipboard. The paste operation writes the data in such a way that the content of the top left cell of the stored data is dropped in the active cell. Other stored content is placed relative to that cell. Formulas are updated accordingly.

Note that removing cells with data can break the spreadsheet and your model if it relies on the spreadheet. You are not prewarned if this happens.

In FreeCAD version 0.19 and earlier there is a bug that can cause FreeCAD to hang if a non-rectangular cell range is pasted. It is advisable to save your work before performing any paste operations.

Propiedades de la celda
Las propiedades de una celda de la hoja de cálculo pueden ser editadas haciendo clic derecho en la celda y seleccionando del menú contextual. El siguiente cuadro de diálogo aparece:



Como se indica en las pestañas, se pueden modificar las siguientes propiedades:


 * Color: Color del texto y del fondo
 * Alineación: Alineación horizontal y vertical del texto
 * Estilo: Estilo del texto: negrita, cursiva, subrayado
 * Unidades:  Muestra las unidades para esta celda. Por favor, lea la sección Unidades más abajo.
 * Alias:  Define un alias para esta celda. Este alias se puede utilizar en las fórmulas de las celdas y también en las expresiones generales; consulte la sección Datos de la hoja de cálculo en las expresiones para obtener más información.

Expresiones de la celda
Una celda de la hoja de cálculo puede contener un texto arbitrario o una expresión. Técnicamente, las expresiones deben comenzar con un signo igual '='. Sin embargo, la hoja de cálculo intenta ser inteligente; si se introduce lo que parece una expresión sin el '=' inicial, se añadirá uno automáticamente.

Las expresiones de celdas pueden contener números, funciones, referencias a otras celdas y referencias a propiedades del modelo (Pero vea Limitaciones actuales más abajo). Las celdas se referencian por su columna (letra MAYÚSCULA) y fila (número). Una celda también puede ser referenciada por su nombre_alias. Ejemplo: B4 + A6

Nota: Las expresiones de celda son tratadas por FreeCAD como código de programación. Por lo tanto, cuando editas una celda el contenido ves que no sigue su configuración de visualización:
 * el separador decimal es siempre un punto
 * el número de decimales mostrados puede diferir de tu configuración de ajustes de preferencias

Las referencias a objetos en el modelo se explican en Referencias a datos CAD más abajo. El uso de los valores de las celdas de la hoja de cálculo para definir las propiedades del modelo se explica en Datos de la hoja de cálculo en las expresiones más adelante. Para más información sobre las expresiones y las funciones disponibles, véase Expresiones.

Interacción entre las hojas de cálculo y el modelo CAD
Data in the cells of a spreadsheet may be used in CAD model parameter expressions. Thus, a spreadsheet may be used as the source for parameter values used throughout a model, effectively gathering the values in one place. When values are changed in the spreadsheet, they are propagated throughout the model.

Similarly, properties from CAD model objects may be used in expressions in spreadsheet cells. This allows use of object properties like volume or area in the spreadsheet. If the name of an object in the CAD model is changed, the change will automatically be propagated to any references in spreadsheet expressions using the name which was changed.

More than one spreadsheet may be used in a document. A spreadsheet can be identified using either its name or its label.

FreeCAD will automatically assign a unique name to a spreadsheet when it is created. These names follow the pattern, , and so on. The name can not be changed manually, and it is not visible in the properties of the spreadsheet. It can be used to refer to the spreadsheet in an Expression (see Spreadsheet data in expressions below.)

The label of a spreadsheet is automatically set to the name of the spreadsheet upon creation. Unlike the name, the label can be changed, for example in the properties panel or using the context menu action Rename. Note that the label of a spreadsheet within a document has to be unique; if you try to change the label to a label already used by another spreadsheet, FreeCAD will not accept the new label.

FreeCAD checks for cyclic dependencies. See Current limitations.

Referencias a los datos CAD
As indicated above, one can reference data from the CAD model in spreadsheet expressions.

Computed expressions in spreadsheet cells start with an equals ('=') sign. However, the spreadsheet entry mechanism attempts to be smart. An expression may be entered without the leading '='; if the string entered is a valid expression, an '=' is automatically added when the final is typed. If the string entered is not a valid expression (often the result of entering something with the wrong case, e.g. "MyCube.length" instead of "MyCube.Length"), no leading '=' is added and it is treated as simply a text string.

Note: The above behavior (auto insert of '=') has some unpleasant ramifications:
 * If you want to keep a column of names corresponding to the alias-names in an adjacent column of values, you must enter the name in the label column before giving the cell in the value column its alias-name. Otherwise, when you enter the alias-name in the label column the spreadsheet will assume it is an expression and change it to "="; and the displayed text will be the value from the  cell.
 * If you make an error when entering the name in the label column and wish to correct it, you cannot simply change it to the alias-name. Instead, you must first change the alias-name to something else, then fix the text name in the label column, then change the alias-name in the value column back to its original.

One way to side-step these issues is to prefix text labels corresponding to alias-names with a fixed string, thereby making them different. Note that "_" will not work, as it is converted to "=". However, a blank, while invisible, will work.

The following table shows some examples assuming the model has a feature named "MyCube":

Datos de la hoja de cálculo en expresiones
In order to use spreadsheet data in other parts of FreeCAD, you will usually create an Expression that refers to the spreadsheet and the cell that contains the data you want to use. You can identify spreadsheets by name or by label, and you can identify the cells by address or by alias. Autocompletion is available for all forms of referencing.

The recommended way to refer to spreadsheet data is to use the spreadsheet label and cell alias name. For a more in-depth explanation of the pros and cons of the addressing modes, see the expanded section below.

Using the spreadsheet label has the advantage that it can be freely changed to describe the contents of the spreadsheet. It is also easier to identify the spreadsheet that is being used since the text in the expression matches the label shown in the model and property views. If you decide to change the label of a spreadsheet, existing references to the contents of the spreadsheet will be updated, so you won't break your expressions by renaming the spreadsheet. The internal name of the spreadsheet is not readily available anywhere except within the expression editor, so if you use the internal name and later decide to rename the spreadsheets, you might have a hard time tracing your expression data back to its source.

Be aware that when you create a new spreadsheet, the name and the label are the same, so it is easy to accidentally use the spreadsheet name instead of the label. A simple way to avoid this is to give the spreadsheet a meaningful name before starting to use it in expressions.

While you may use the row and column number in an expression to reference a cell, best practice is to give the cell an alias name and use that. See Cell Properties above on how to set the alias. For example, if the data in cell B1 contained the length parameter for an object, an alias name of would allow the value to be referred to as  instead of. Besides being much easier to read and understand, alias names are also much easier to change if you decide to adjust the structure of your spreadsheet. Using an alias also has the advantage that it is reasier to see which cells are used to control other parts of the document. Note that FreeCAD will automatically adjust the positional references in expressions if you insert or remove rows and columns in the spreadsheet, so even if you use row and column numbers in an expression, you can insert rows and columns without breaking the references to the surrounding cells.

Modelos complejos y recálculos
Editing a spreadsheet will trigger a recompute of the 3D model, even if the changes do not affect the model. For a complex model a recompute can take a long time, and having to wait after every single edit is of course quite annoying.

There are three solutions to deal with this:
 * 1) Temporarily skip recomputes:
 * 2) * In the Tree view right-click the [[Image:Document.svg|24px]] document that contains the spreadsheet.
 * 3) * Select the option from the context menu.
 * 4) * There is a big disadvantage to this solution. New values entered in the spreadsheet will not be displayed until the document is recomputed. Instead is shown.
 * 5) * You can either recompute manually, using the Std Refresh command, or disable when you are done editing.
 * 6) Use a macro to automatically skip recomputes while editing a spreadsheet:
 * 7) * Download and run skipSheet.FCMacro.
 * 8) * This solution saves a few steps compared to the first solution, but also has the mentioned disadvantage.
 * 9) Put the spreadsheet in a separate FreeCAD file:
 * 10) * You can reference spreadsheet data from an external file with this syntax:.
 * 11) * The advantage of having the spreadsheet in another file over switching off recomputes is that the spreadsheet itself does get recomputed.
 * 12) * The disadvantage is that the model won't automatically recompute after changes to the spreadsheet.
 * 13) * In the scenario where you first open the 'spreadsheet' file, change one or more values and then open the 'model' file, there won't be any indication that the model needs to be recomputed. But if both files are open the Std Refresh icon will update correctly for the 'model' file after changes to the 'spreadsheet' file.

Unidades
The Spreadsheet has a notion of dimension (units) associated with cell values. A number entered without an associated unit has no dimension. The unit should be entered immediately following the number value, with no intervening space. If a number has an associated unit, that unit will be used in all calculations. For example, the multiplication of two lengths with the unit mm gives an area with the unit mm&sup2;.

If a cell contains a value which represents a dimension, it should be entered with its associated unit. While in many simple cases one can get by with a dimensionless value, it is unwise to not enter the unit. If a value representing a dimension is entered without its associated unit, there are some sequences of operations which cause FreeCAD to complain of incompatible units in an expression when it appears the expression should be valid. (This may be better understood by viewing this thread in the FreeCAD forums.)

You can change the units displayed for a cell value using the properties dialog units tab (above). This does not change the value contained in the cell; it only converts the existing value for display. The value used for calculations does not change, and the results of formulas using the value do not change. For example, a cell containing the value "5.08cm" can be displayed as "2in" by changing the units tab value to "in".

A dimensionless number cannot be changed to a number with a unit by the cell properties dialog. One can put in a unit string, and that string will be displayed; but the cell still contains a dimensionless number. In order to change a dimensionless value to a value with a dimension, the value itself must be re-entered with its associated unit.

Occasionally it may be desirable to get rid of a dimension in an expression. This can be done by multiplying by 1 with a reciprocal unit.

CSV format
FreeCAD spreadsheets 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. See Spreadsheet Import and Spreadsheet Export for more information.

XLSX format
Spreadsheets in the Excel-format XLSX can be imported with the Std Import command or the Std Open command. The following features are supported:


 * All functions that are also available in the FreeCAD spreadsheet. Other functions give an error in the corresponding cell after import.
 * Alias names for cells.
 * More than one sheet in the Excel-spreadsheet. In this case one FreeCAD spreadsheet is created for each Excel sheet.

Other functionality is not imported into the FreeCAD spreadsheet.

Impresión
To handle the page setup necessary for printing, FreeCAD spreadsheets are printed by inserting them into a TechDraw Spreadsheet View.

Limitaciones actuales
FreeCAD checks for cyclic dependencies when it recomputes. By design, that check stops at the level of the spreadsheet object. As a consequence, you should not have a spreadsheet which contains both cells whose values are used to specify parameters to the model, and cells whose values use output from the model. For example, you cannot have cells specifying the length, width, and height of an object, and another cell which references the total volume of the resulting shape. This restriction can be surmounted by having two spreadsheets: one used as a data-source for input parameters to the model and the other used for calculations based on resultant geometry-data.

Enlazamiento de celdas
Es posible enlazar el contenido de unas celdas a otras celdas en la hoja de cálculo. Esto puede ser útil cuando se trata de tablas grandes o para obtener contenido de celda de otra hoja de cálculo.

Crear enlaces
Para enlazar, por ejemplo, el rango de celdas A3-C4 al rango de celdas B1-D2:

  Seleccione el rango de celdas A3-C4.   Clic derecho y seleccione del menú contextual.   The dialog opens.   Set the range B1-D2 for the :   Press.   Bound cells have a blue border to highlight the binding. </li>  If you now enter something in cell C1, the same will immediately appear in cell B3. </li> </ol>



Change binding

 * 1) Right-click a bound cell (there is no need to highlight the whole bound range) and select  from the context menu.
 * 2) The  dialog opens.
 * 3) Change one or more options. Note that the, the bound cell range, cannot be changed.
 * 4) Press.

Remove binding

 * 1) Right-click a bound cell (there is no need to highlight the whole bound range) and select  from the context menu.
 * 2) The  dialog opens.
 * 3) Press.

Tablas de configuración
Puedes usar hojas de cálculo para crear tablas de configuración con conjuntos de parámetros predefinidos para tu modelo, y después cambiar dinamicamente que configuración usar. Vea este post del foro si quiere saber más sobre el funcionamiento interno de esta característica.

Expandir esta sección para un breve tutorial de como crear una tabla de configuración.

<ol>  En un nuevo documento, primero cree una Std Pieza, después cree un Part Box, un Part Cylinder y una hoja de cálculo. </li>  La caja y el cilindro se colocan automáticamente en el contenedor Std Pieza. Coloque manualmente la hoja de cálculo en el contenedor también. </li>  En la hoja de cálculo ingrese the contenido mostrado abajo. Establezca el alias para B2 como, C2 como y D2 como : </li>  Enlce las expresiones y a las propiedades  y  de la caja, respectivamente: </li>  Enlace la expresión a la propiedad  del cilindro. Tambieén cambie la del cilindro a  para que sea más bajo que la caja. </li>  Clic derecho en la celda A2 en la hoja de cálculo y seleccione del menú contextual. </li>  The dialog opens. </li>  Enter the following: </li>  Press. </li>  A new property called is be added to the Std Part container to choose the configuration as shown below: </li> </ol>

You can use either a Std Link or a PartDesign SubShapeBinder to instantiate a Variant Instance of a configurable object with the following steps:


 * 1) Create a Std Link to the Std Part container and set its  property to.
 * 2) Move the Link to a new place by changing its  so that it is easier to distinguish from the original object.
 * 3) Select a different  for the Link to create a variant instance.

Similar steps apply to a PartDesign SubShapeBinder, except that its property for activating a variant instance is called.