File Format FCStd/es: Difference between revisions

From FreeCAD Documentation
(Created page with "Para incrustar otros tipos de archivos dentro de un archivo FCStd, primero hay que crear un objeto scriptado desde la Python_console/es|consola de Py...")
(Created page with "A continuación, en el Editor de propiedades puede ir a la propiedad añadida y elegir un archivo en el ordenador. Una vez guardado el archivo FCStd, el...")
Line 150: Line 150:
Para incrustar otros tipos de archivos dentro de un archivo FCStd, primero hay que crear un [[Scripted_objects/es|objeto scriptado]] desde la [[Python_console/es|consola de Python]], y darle una propiedad {{incode|App::PropertyFileIncluded}}.
Para incrustar otros tipos de archivos dentro de un archivo FCStd, primero hay que crear un [[Scripted_objects/es|objeto scriptado]] desde la [[Python_console/es|consola de Python]], y darle una propiedad {{incode|App::PropertyFileIncluded}}.


Then in the [[Property_editor|property editor]] you can go to the added property and choose a file in the computer. Once the FCStd file is saved, the file assigned to the {{PropertyData|PropertyFileIncluded}} property will be packed inside the {{incode|.FCStd}}. When the document is restored, the same file will be restored with the {{PropertyData|PropertyFileIncluded}} property.
A continuación, en el [[Property_editor/es|Editor de propiedades]] puede ir a la propiedad añadida y elegir un archivo en el ordenador. Una vez guardado el archivo FCStd, el archivo asignado a la propiedad {{PropertyData|PropertyFileIncluded}} se empaquetará dentro del {{incode|.FCStd}}. Al restaurar el documento, se restaurará el mismo archivo con la propiedad {{PropertyData|PropertyFileIncluded}}.


{{Code|code=
{{Code|code=

Revision as of 22:57, 6 September 2021

Resumen

El FreeCAD Standard formato de archivo (.FCStd) es el principal formato de archivo de FreeCAD. Es un formato compuesto, soporta la compresión y la incrustación de diferentes tipos de datos.

Internos de los archivos .FCStd

FCStd es un archivo zip estándar que contiene uno o más archivos en una específica. Como tal, es posible desempaquetar un archivo .FCStd utilizando una herramienta de descompresión zip normal, pero hay que tener cuidado al empaquetar el contenido de un archivo .FCStd. FreeCAD contiene una "Utilidad de Proyecto" para re-empaquetar archivos .FCStd, su uso se describe en Cambiar la fuente del archivo .FCStd más abajo.

Document.xml

Este es el archivo principal .xml que describe todos los objetos dentro de un documento de FreeCAD, es decir, sólo la definición geométrica y paramétrica de los objetos, no su representación visual. Si FreeCAD se ejecuta en modo consola (sin la GUI), sólo se utilizará este Document.xml.

Ejemplo Document.xml

<?xml version='1.0' encoding='utf-8'?>
 <Document SchemaVersion="4">
    <Properties Count="9">
       <Property name="Comment" type="App::PropertyString">
          <String value=""/>
       </Property>
       <Property name="Company" type="App::PropertyString">
          <String value=""/>
       </Property>
       <Property name="CreatedBy" type="App::PropertyString">
          <String value=""/>
       </Property>
       <Property name="CreationDate" type="App::PropertyString">
          <String value="Fri Jan 29 15:14:38 2010 "/>
       </Property>
       <Property name="FileName" type="App::PropertyString">
          <String value="/tmp/test.FCStd"/>
       </Property>
       <Property name="Id" type="App::PropertyString">
          <String value="201b746f-a1ed-4297-bf3d-65d5ec11abe0"/>
       </Property>
       <Property name="Label" type="App::PropertyString">
          <String value="names"/>
       </Property>
       <Property name="LastModifiedBy" type="App::PropertyString">
          <String value=""/>
       </Property>
       <Property name="LastModifiedDate" type="App::PropertyString">
          <String value="Fri Jan 29 15:15:21 2010 "/>
       </Property>
    </Properties>
    <Objects Count="2">
       <Object type="Mesh::Cube" name="Cube" />
       <Object type="Part::Box" name="Box" />
    </Objects>
    <ObjectData Count="2">
       <Object name="Cube">
          <Properties Count="7">
             <Property name="Height" type="App::PropertyFloatConstraint">
                <Float value="10"/>
             </Property>
             <Property name="Label" type="App::PropertyString">
                <String value="Cube"/>
             </Property>
             <Property name="Length" type="App::PropertyFloatConstraint">
                <Float value="10"/>
             </Property>
             <Property name="Mesh" type="Mesh::PropertyMeshKernel">
                <Mesh file="MeshKernel.bms"/>
             </Property>
             <Property name="Placement" type="App::PropertyPlacement">
                <PropertyPlacement Px="0" Py="0" Pz="0" Q0="0" Q1="0" Q2="0" Q3="1"/>
             </Property>
             <Property name="Pos" type="App::PropertyPlacementLink">
                <Link value=""/>
             </Property>
             <Property name="Width" type="App::PropertyFloatConstraint">
                <Float value="10"/>
             </Property>
          </Properties>
       </Object>
       <Object name="Box">
          <Properties Count="7">
             <Property name="Height" type="App::PropertyLength">
                <Float value="10"/>
             </Property>
             <Property name="Label" type="App::PropertyString">
                <String value="Box2"/>
             </Property>
             <Property name="Length" type="App::PropertyLength">
                <Float value="10"/>
             </Property>
             <Property name="Placement" type="App::PropertyPlacement">
                <PropertyPlacement Px="0" Py="0" Pz="0" Q0="0" Q1="0" Q2="0" Q3="1"/>
             </Property>
             <Property name="Pos" type="App::PropertyPlacementLink">
                <Link value=""/>
             </Property>
             <Property name="Shape" type="Part::PropertyPartShape">
                <Part file="PartShape.brp2"/>
             </Property>
             <Property name="Width" type="App::PropertyLength">
                <Float value="10"/>
             </Property>
          </Properties>
       </Object>
    </ObjectData>
 </Document>

GuiDocument.xml

Es la contrapartida de la interfaz gráfica de usuario del archivo Document.xml. Para cada objeto descrito en Document.xml, hay un objeto correspondiente en GuiDocument.xml, que describe la representación visual de ese objeto (color, ancho de línea, etc).

Thumbnails/thumbnail.png

This is a 128x128 pixels thumbnail image of the document, which is a screenshot of the 3D view at save time. Thumbnails are generated only if the corresponding option is enabled in the FreeCAD preferences.

*.brep

These are the B-rep shapes of all objects that have a Part shape in the Document.xml. Each object, even if it is parametric, has its shape stored as an individual .brep file, so it can be accessed by components without the need to recalculate the shape.

*.svg

These are the template svg files used in TechDraw pages.

Estructura típica

Structure of a typical .FCStd file. The extension can be changed to .zip to explore it like a normal directory. The Document.xml and GuiDocument.xml are at the root of the archive, together with any number of .brp (BREP) files. One subdirectory may hold the thumbnail, and another the SVG templates used by TechDraw.

File.FCStd (File.zip)
  |
  |--thumbnails/
  |  |
  |  :--Thumbnail.png
  |
  :--Document.xml
  :--GuiDocument.xml
  :--Shape1.brp
  :--Shape2.brp
  :--MyPage.svg
  :--etc.

Incrustar otros archivos

Para incrustar otros tipos de archivos dentro de un archivo FCStd, primero hay que crear un objeto scriptado desde la consola de Python, y darle una propiedad App::PropertyFileIncluded.

A continuación, en el Editor de propiedades puede ir a la propiedad añadida y elegir un archivo en el ordenador. Una vez guardado el archivo FCStd, el archivo asignado a la propiedad DatosPropertyFileIncluded se empaquetará dentro del .FCStd. Al restaurar el documento, se restaurará el mismo archivo con la propiedad DatosPropertyFileIncluded.

custom_obj = App.ActiveDocument.addObject("App::FeaturePython", "CustomObject")
custom_obj.addProperty("App::PropertyFileIncluded", "AttachedFile")

See the forum thread, PDF inside the project.

Cambiar la fuente del archivo .FCStd

Otros

  • Una utilidad de conversión de archivos ImageConv.