Part Module/es: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{Docnav
{{docnav|[[OpenSCAD Module|OpenSCAD Module]]|[[PartDesign Workbench|PartDesign Workbench]]|IconL=OpenSCADWorkbench.svg|IconR=Workbench_PartDesign.svg}}
|[[OpenSCAD Module|OpenSCAD Module]]

|[[PartDesign Workbench|PartDesign Workbench]]
[[Image:Workbench_Part.svg|64px]]
|IconL=Workbench_OpenSCAD.svg
|IconR=Workbench_PartDesign.svg
}}


[[Image:Workbench_Part.svg|thumb|128px|Part workbench icon]]
{{TOCright}}
<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Las capacidades CAD de FreeCAD se basan en el núcleo de [http://en.wikipedia.org/wiki/Open_CASCADE OpenCasCade]. El módulo de ''Piezas'' permite a FreeCAD utilizar y acceder a los objetos y funciones de OpenCascade. OpenCascade es un núcleo de CAD de nivel profesional, que cuenta con avanzadas capacidades de manipulación de geometría 3D y objetos. Los objetos ''Pieza'', en contraste con los objetos [[Mesh Module/es| Malla]], son mucho más complejos y, por tanto, permiten operaciones mucho más avanzadas, como operaciones booleanas coherentes, historial de modificaciones y comportamiento paramétrico.
Las capacidades CAD de FreeCAD se basan en el núcleo de [http://en.wikipedia.org/wiki/Open_CASCADE OpenCasCade]. El módulo de ''Piezas'' permite a FreeCAD utilizar y acceder a los objetos y funciones de OpenCascade. OpenCascade es un núcleo de CAD de nivel profesional, que cuenta con avanzadas capacidades de manipulación de geometría 3D y objetos. Los objetos ''Pieza'', en contraste con los objetos [[Mesh Module/es| Malla]], son mucho más complejos y, por tanto, permiten operaciones mucho más avanzadas, como operaciones booleanas coherentes, historial de modificaciones y comportamiento paramétrico.
</div>
</div>


The objects created with the Part Workbench are relatively simple; they are intended to be used with boolean operations (unions and cuts) in order to build more complex shapes. This modelling paradigm is known as the [[constructive solid geometry]] (CSG) workflow, and it was the traditional methodology used in early CAD systems. On the other hand, the [[PartDesign Workbench|PartDesign Workbench]] provides a more modern workflow to constructing shapes: it uses a parametrically defined sketch, that is extruded to form a basic solid body, which is then modified by parametric transformations ([[feature editing|feature editing]]), until the final object is obtained.
The objects created with the Part Workbench are relatively simple; they are intended to be used with boolean operations (unions and cuts) in order to build more complex shapes. '''This modeling paradigm is known as the [[constructive solid geometry]] (CSG) workflow, and it was the traditional methodology used in early CAD systems.''' On the other hand, the [[PartDesign Workbench|PartDesign Workbench]] provides a more modern workflow to constructing shapes: it uses a parametrically defined sketch, that is extruded to form a basic solid body, which is then modified by parametric transformations ([[feature editing|feature editing]]), until the final object is obtained.


Part objects are more complex than mesh objects created with the [[Mesh Workbench|Mesh Workbench]], as they permit more advanced operations like coherent boolean operations, modifications history, and parametric behaviour.
Part objects are more complex than mesh objects created with the [[Mesh Workbench|Mesh Workbench]], as they permit more advanced operations like coherent boolean operations, modifications history, and parametric behaviour.

{{TOCright}}
[[Image:Part example.jpg]]


[[Image:Part_Workbench_relationships.svg|600px]]
[[Image:Part_Workbench_relationships.svg|600px]]
Line 31: Line 33:
Estas son las herramientas para crear primitivas de objetos.
Estas son las herramientas para crear primitivas de objetos.


<div class="mw-translate-fuzzy">
* [[Image:Part_Box.png|32px]] [[Part_Box/es|Caja]]: Dibuja una caja especificando sus dimensiones
* [[Image:Part_Box.png|32px]] [[Part_Box/es|Caja]]: Dibuja una caja especificando sus dimensiones
* [[Image:Part_Cylinder.png|32px]] [[Part_Cylinder/es|Cilindro]]: Dibuja un cilindro especificando sus dimensiones
* [[Image:Part_Cylinder.png|32px]] [[Part_Cylinder/es|Cilindro]]: Dibuja un cilindro especificando sus dimensiones
Line 38: Line 41:
* [[Image:Part_CreatePrimitives.png|32px]] [[Part_CreatePrimitives/es|CreatePrimitives]]: Una herramienta para crear diversas primitivas geométricas paramétricas.
* [[Image:Part_CreatePrimitives.png|32px]] [[Part_CreatePrimitives/es|CreatePrimitives]]: Una herramienta para crear diversas primitivas geométricas paramétricas.
* [[Image:Part_Shapebuilder.png|32px]] [[Part_Shapebuilder/es|Shapebuilder]]: Una herramienta para crear formas más complejas a partir de diversas primitiv geométricas paramétricas
* [[Image:Part_Shapebuilder.png|32px]] [[Part_Shapebuilder/es|Shapebuilder]]: Una herramienta para crear formas más complejas a partir de diversas primitiv geométricas paramétricas
</div>


===Modificando objetos===
===Modificando objetos===
Line 43: Line 47:
Estas son las herramientas para modificar los objetos existentes. Permiten seleccionar los objetos a modificar.
Estas son las herramientas para modificar los objetos existentes. Permiten seleccionar los objetos a modificar.


<div class="mw-translate-fuzzy">
* [[Image:Part_Extrude.png|32px]] [[Part_Extrude/es|Extrusión]]: Extruye caras planas de un objeto
* [[Image:Part_Extrude.png|32px]] [[Part_Extrude/es|Extrusión]]: Extruye caras planas de un objeto
* [[Image:Part_Revolve.png|32px]] [[Part_Revolve/es|Revolución]]: Crea un objeto haciendo que gire otro objeto alrededor de un eje
* [[Image:Part_Revolve.png|32px]] [[Part_Revolve/es|Revolución]]: Crea un objeto haciendo que gire otro objeto alrededor de un eje
Line 51: Line 56:
* [[Image:Part_Loft.png|32px]] [[Part_Loft/es|Loft]]: Lofts de un perfil a otro.
* [[Image:Part_Loft.png|32px]] [[Part_Loft/es|Loft]]: Lofts de un perfil a otro.
* [[Image:Part_Sweep.png|32px]] [[Part_Sweep/es|Sweep]]: Barre uno o más perfiles a lo largo de un camino
* [[Image:Part_Sweep.png|32px]] [[Part_Sweep/es|Sweep]]: Barre uno o más perfiles a lo largo de un camino
</div>


* [[Image:Part_CompOffsetTools.png|48px]] [[Part_CompOffsetTools|Offset tools]]:
* [[Image:Part_CompOffsetTools.png|48px]] [[Part_CompOffsetTools|Offset tools]]:
** [[Image:Part_Offset.png|32px]] [[Part_Offset|3D Offset]]: Constructs a parallel shape at a certain distance from original.
** [[Image:Part_Offset.svg|32px]] [[Part_Offset|3D Offset]]: Constructs a parallel shape at a certain distance from original.
** [[Image:Part_Offset2D.png|32px]] [[Part_Offset2D|2D Offset]]: Constructs a parallel wire at certain distance from original, or enlarges/shrinks a planar face. {{Version|0.17}}
** [[Image:Part_Offset2D.svg|32px]] [[Part_Offset2D|2D Offset]]: Constructs a parallel wire at certain distance from original, or enlarges/shrinks a planar face. {{Version|0.17}}


* [[Image:Part_Thickness.png|32px]] [[Part_Thickness|Thickness]]: Hollows out a solid, leaving openings next to select faces.
* [[Image:Part_Thickness.svg|32px]] [[Part_Thickness|Thickness]]: Hollows out a solid, leaving openings next to select faces.


* [[Image:Part_ProjectionOnSurface.png|32px]] [[Part_ProjectionOnSurface|Projection on surface]]: Project a logo, text or any face,wire,edge to a surface. With the projection part it is possible to create a solid or wire. {{Version|0.19}}
* [[Image:Part_ProjectionOnSurface.png|32px]] [[Part_ProjectionOnSurface|Projection on surface]]: Project a logo, text or any face,wire,edge to a surface. With the projection part it is possible to create a solid or wire. {{Version|0.19}}


* [[Image:Part_CompCompoundTools.png|48px]] [[Part_CompCompoundTools|Compound Tools]]:
* [[Image:Part_Compound.svg|48px]] [[Part_CompCompoundTools|Compound Tools]]:
** [[Image:Part MakeCompound.png|32px]] [[Part MakeCompound|Make compound]]: Creates a compound from the selected objects.
** [[Image:Part_Compound.svg|32px]] [[Part_Compound|Make compound]]: Creates a compound from the selected objects.
** [[Image:Part_ExplodeCompound.svg|32px]] [[Part_ExplodeCompound|Explode Compound]]: Tool to split up compounds of shapes
** [[Image:Part_ExplodeCompound.svg|32px]] [[Part_ExplodeCompound|Explode Compound]]: Tool to split up compounds of shapes
** [[Image:Part Compound‏‎Filter.png|32px]] [[Part Compound‏‎Filter|Compound Filter]]: The CompoundFilter can be used to extract the individual pieces.
** [[Image:Part Compound‏‎Filter.svg|32px]] [[Part Compound‏‎Filter|Compound Filter]]: The CompoundFilter can be used to extract the individual pieces.


<div class="mw-translate-fuzzy">
* [[Image:Part_Booleans.png|32px]] [[Part_Booleans/es|Operaciones Booleanas]]: Realiza operaciones Booleanas sobre los objetos
* [[Image:Part_Booleans.png|32px]] [[Part_Booleans/es|Operaciones Booleanas]]: Realiza operaciones Booleanas sobre los objetos
* [[Image:Part_Union.png|32px]] [[Part_Union/es|Fusión]]: Fusión (unión) de dos objetos
* [[Image:Part_Union.png|32px]] [[Part_Union/es|Fusión]]: Fusión (unión) de dos objetos
* [[Image:Part_Common.png|32px]] [[Part_Common/es|Intersección]]: Extrae la parte común (intersección) de dos objetos
* [[Image:Part_Common.png|32px]] [[Part_Common/es|Intersección]]: Extrae la parte común (intersección) de dos objetos
* [[Image:Part_Cut.png|32px]] [[Part_Cut/es|Diferencia]]: Corta (resta) un objeto de otro
* [[Image:Part_Cut.png|32px]] [[Part_Cut/es|Diferencia]]: Corta (resta) un objeto de otro
</div>


* [[Image:Part_CompJoinFeatures.png|48px]] [[Part CompJoinFeatures|Join features]]: smart booleans for walled objects (e.g., pipes) {{Version|0.16}}
* [[Image:Part_CompJoinFeatures.png|48px]] [[Part CompJoinFeatures|Join features]]: smart booleans for walled objects (e.g., pipes) {{Version|0.16}}
** [[Image:Part JoinConnect.png|32px]] [[Part_JoinConnect|Connect]]: Connects interiors of objects {{Version|0.16}}
** [[Image:Part_JoinConnect.svg|32px]] [[Part_JoinConnect|Connect]]: Connects interiors of objects {{Version|0.16}}
** [[Image:Part JoinEmbed.png|32px]] [[Part_JoinEmbed|Embed]]: Embeds a walled object into another walled object {{Version|0.16}}
** [[Image:Part_JoinEmbed.svg|32px]] [[Part_JoinEmbed|Embed]]: Embeds a walled object into another walled object {{Version|0.16}}
** [[Image:Part JoinCutout.png|32px]] [[Part_JoinCutout|Cutout]]: Creates a cutout in a wall of an object for another walled object {{Version|0.16}}
** [[Image:Part_JoinCutout.svg|32px]] [[Part_JoinCutout|Cutout]]: Creates a cutout in a wall of an object for another walled object {{Version|0.16}}


* [[Image:Part_CompSplittingTools.png|48px]] [[Part CompSplittingTools|Splitting tools]]: {{Version|0.17}}
* [[Image:Part_CompSplittingTools.png|48px]] [[Part CompSplittingTools|Splitting tools]]: {{Version|0.17}}
** [[Image:Part BooleanFragments.png|32px]] [[Part_BooleanFragments|Boolean fragments]]: makes all the pieces that can be obtained by Boolean operations between objects {{Version|0.17}}
** [[Image:Part_BooleanFragments.svg|32px]] [[Part_BooleanFragments|Boolean fragments]]: makes all the pieces that can be obtained by Boolean operations between objects {{Version|0.17}}
** [[Image:Part SliceApart.svg|32px]] [[Part_SliceApart|Slice a part]]: tool to split shapes by intersection with other shapes
** [[Image:Part SliceApart.svg|32px]] [[Part_SliceApart|Slice a part]]: tool to split shapes by intersection with other shapes
** [[Image:Part Slice.png|32px]] [[Part_Slice|Slice]]: Splits an object into pieces by intersections with another object {{Version|0.17}}
** [[Image:Part_Slice.svg|32px]] [[Part_Slice|Slice]]: Splits an object into pieces by intersections with another object {{Version|0.17}}
** [[Image:Part XOR.png|32px]] [[Part_XOR|XOR]]: removes space shared by even number of objects (symmetric version of [[Part_Cut|Cut]]) {{Version|0.17}}
** [[Image:Part_XOR.svg|32px]] [[Part_XOR|XOR]]: removes space shared by even number of objects (symmetric version of [[Part_Cut|Cut]]) {{Version|0.17}}


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Line 101: Line 109:
===Otras herramientas===
===Otras herramientas===


* [[Image:Part_Import.svg|32px]] [[Part ImportCAD|Import CAD]]: This tool allows you to add a file *.IGES, *.STEP, *.BREP to the current document.
* [[Image:Part_Import.svg|32px]] [[Part Import|Import]]: This tool allows you to add a file *.IGES, *.STEP, *.BREP to the current document.
* [[Image:Part_Export.svg|32px]] [[Part ExportCAD|Export CAD]]: This tool allows you to export a part object in a *.IGES, *.STEP, *.BREP file.
* [[Image:Part_Export.svg|32px]] [[Part Export|Export]]: This tool allows you to export a part object in a *.IGES, *.STEP, *.BREP file.
* [[File:Part_BoxSelection.svg|32px]] [[Part_BoxSelection|BoxSelection]]: add to the selection the faces of the shapes that are touches by the rectangular selection. {{Version|0.19}}
* [[File:Part_BoxSelection.svg|32px]] [[Part_BoxSelection|BoxSelection]]: add to the selection the faces of the shapes that are touches by the rectangular selection. {{Version|0.19}}
* [[Image:Part_ShapeFromMesh.svg|32px]] [[Part ShapeFromMesh|Shape from Mesh]]: Creates a shape object from a mesh object.
* [[Image:Part_ShapeFromMesh.svg|32px]] [[Part ShapeFromMesh|Shape from Mesh]]: Creates a shape object from a mesh object.
Line 110: Line 118:


* Create a copy:
* Create a copy:
** [[Image:Part_CreateSimpleCopy‎.svg|32px]] [[Part SimpleCopy|Create simple copy]]: Creates a simple copy of the selected object.
** [[Image:Part_SimpleCopy‎.svg|32px]] [[Part_SimpleCopy|Create simple copy]]: Creates a simple copy of the selected object.
** [[File:Part_TransformedCopy.svg|32px]] [[Part TransformedCopy|Create transformed copy]]: creates a transformed copy of the selected object. {{Version|0.19}}
** [[File:Part_TransformedCopy.svg|32px]] [[Part_TransformedCopy|Create transformed copy]]: creates a transformed copy of the selected object. {{Version|0.19}}
** [[File:Part_ElementCopy.svg|32px]] [[Part ElementCopy|Create shape element copy]]: creates a copy from an element (vertex, edge, face) of the selected object. {{Version|0.19}}
** [[File:Part_ElementCopy.svg|32px]] [[Part_ElementCopy|Create shape element copy]]: creates a copy from an element (vertex, edge, face) of the selected object. {{Version|0.19}}
** [[Image:Part_RefineShape.svg|32px]] [[Part RefineShape|Refine shape]]: Cleans faces by removing unnecessary lines.
** [[Image:Part_RefineShape.svg|32px]] [[Part_RefineShape|Refine shape]]: Cleans faces by removing unnecessary lines.


* [[Image:Part_CheckGeometry.svg|32px]] [[Part CheckGeometry|Check geometry]]: Checks the geometry of selected objects for errors.
* [[Image:Part_CheckGeometry.svg|32px]] [[Part CheckGeometry|Check geometry]]: Checks the geometry of selected objects for errors.
Line 137: Line 145:
</div>
</div>


<blockquote style="color: slategray">''At a very high level, topology tells what pieces an object is made of, and the logical relationships between them. A shape is made of a certain set of faces. A face is bounded by a certain set of edges. Two faces are adjacent if they share a common edge.''</blockquote>

<blockquote style="color: slategray">''Topology alone does not tell you the size, curvature, or 3D locations of any of those pieces. However, each piece of topology does knows about it's underlying geometry. A face knows what surface it lies on. An edge knows what curve it lies on. The geometry knows about curvature and location in space.'' - [https://www.opencascade.com/content/geometry-and-topology Source]</blockquote>

<hr />

<blockquote style="color: slategray">''Thus, Topology defines the relationship between simple geometric entities, which can be linked together to represent complex shapes.'' - [https://www.opencascade.com/doc/occt-7.0.0/overview/html/occt_user_guides__modeling_data.html Modeling Data User's Guide]</blockquote>

[[File:ClassTopoDS_Shape_inherit_graph.png]]

<div class="mw-translate-fuzzy">
Los tipos geométricos en realidad se puede dividir en dos grandes grupos: las curvas y superficies. A partir de las curvas (líneas, círculos, ...) se puede construir un borde, a partir de las superficies (plano, cilindro, ...) se puede construir una cara. Por ejemplo, la ''primitiva'' geométrica ''línea'' es ilimitada, es decir, se define por un vector de base y un vector de dirección, mientras que su representación como ''forma'' será algo limitado por un punto de inicio y otro de fin. Y, de modo similar, una caja - un sólido - puede ser creada con seis planos limitados.
Los tipos geométricos en realidad se puede dividir en dos grandes grupos: las curvas y superficies. A partir de las curvas (líneas, círculos, ...) se puede construir un borde, a partir de las superficies (plano, cilindro, ...) se puede construir una cara. Por ejemplo, la ''primitiva'' geométrica ''línea'' es ilimitada, es decir, se define por un vector de base y un vector de dirección, mientras que su representación como ''forma'' será algo limitado por un punto de inicio y otro de fin. Y, de modo similar, una caja - un sólido - puede ser creada con seis planos limitados.
</div>


<div class="mw-translate-fuzzy">
Desde un borde o cara también puede volver a su contraparte geométrica primitiva.
Desde un borde o cara también puede volver a su contraparte geométrica primitiva.
</div>


<div class="mw-translate-fuzzy">
Así, a partir de las formas se pueden crear piezas muy complejas o, al revés, se pueden extraer todas las sub-formas de las que está hecha otra forma más compleja.
Así, a partir de las formas se pueden crear piezas muy complejas o, al revés, se pueden extraer todas las sub-formas de las que está hecha otra forma más compleja.
</div>


Thus, out of shapes you can build very complex parts or, the other way round, extract all sub-shapes a more complex shape is made of.

[[File:Part_TopoShape_relationships.svg|600px]]

{{Caption|The {{incode|Part::TopoShape}} class is the geometrical object that is seen on screen. Essentially all workbenches use these [[Part_TopoShape|TopoShapes]] internally to build and display edges, faces, and solids.}}


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Line 154: Line 185:
</div>
</div>


The most basic object that can be created is a [[Part Feature|Part Feature]], which has a simple {{PropertyData|Placement}} property, and basic properties to define its color and appearance.
The most basic object that can be created is a [[Part Feature|Part Feature]], which has a simple {{PropertyData|Placement}} property, and basic properties to define its color and appearance.

Another simple object used in 2D geometrical objects is [[Part Part2DObject|Part Part2DObject]], which is the base of [[Sketcher_SketchObject|Sketcher SketchObject]] ([[Sketcher Workbench|Sketcher]]), and most [[Draft Workbench|Draft elements]].

=== Test script ===

Test the creation of [[Part_Primitives|Part Primitives]] with a script. {{Version|0.19}}

{{Code|code=
import parttests.part_test_objects as pto
pto.create_test_file("example_file")
}}

This script is located in the installation directory of the program, and can be examined to see how the basic primitives are built.
{{Code|code=
$INSTALL_DIR/Mod/Part/parttests/part_test_objects.py
}}


=== Ejemplos ===
=== Ejemplos ===


Para crear un elemento ''línea'' pasa a la consola de Python y escribe:
Para crear un elemento ''línea'' pasa a la consola de Python y escribe:

{{Code|code=
{{Code|code=
import Part,PartGui
import Part,PartGui
Line 168: Line 216:
doc.recompute()
doc.recompute()
}}
}}

Vamos a ver paso a paso el anterior ejemplo en Python:
Vamos a ver paso a paso el anterior ejemplo en Python:

{{Code|code=
{{Code|code=
import Part,PartGui
import Part,PartGui
doc=App.newDocument()
doc=App.newDocument()
}}
}}

Carga el módulo de piezas y crea un nuevo documento
Carga el módulo de piezas y crea un nuevo documento

{{Code|code=
{{Code|code=
l=Part.LineSegment()
l=Part.LineSegment()
Line 179: Line 231:
l.EndPoint=(1.0,1.0,1.0)
l.EndPoint=(1.0,1.0,1.0)
}}
}}

Line es, de hecho, un segmento de recta, por ello la asignación de los puntos de inicio y fin.
Line es, de hecho, un segmento de recta, por ello la asignación de los puntos de inicio y fin.

{{Code|code=
{{Code|code=
doc.addObject("Part::Feature","Line").Shape=l.toShape()
doc.addObject("Part::Feature","Line").Shape=l.toShape()
}}
}}

<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Esto añade un objeto del tipo pieza al documento y le asigna la forma de representación del segmento de línea a la propiedad 'Forma' del objeto agregado. Es importante entender aquí que se utilizó una primitiva geométrica (el ''Part.line'') para crear un ''TopoShape'' a partir de la misma (el método ''toShape ()'' ). En el documento sólo se pueden añadir ''formas''. En FreeCAD, las primitivas geométricas se utilizan como "estructuras de soporte" para las ''formas''.
Esto añade un objeto del tipo pieza al documento y le asigna la forma de representación del segmento de línea a la propiedad 'Forma' del objeto agregado. Es importante entender aquí que se utilizó una primitiva geométrica (el ''Part.line'') para crear un ''TopoShape'' a partir de la misma (el método ''toShape ()'' ). En el documento sólo se pueden añadir ''formas''. En FreeCAD, las primitivas geométricas se utilizan como "estructuras de soporte" para las ''formas''.
</div>
</div>

{{Code|code=
{{Code|code=
doc.recompute()
doc.recompute()
}}
}}

Actualiza el documento. Esto también prepara la representación visual del nuevo objeto Parte.
Actualiza el documento. Esto también prepara la representación visual del nuevo objeto Parte.


Line 194: Line 251:
Ten en cuenta que una línea se pueden crear especificando sus puntos de inicio y final directamente en el constructor, por ejemplo . Part.Line (punto1, punto2) o podemos crear una línea predeterminada y establecer sus propiedades después, como lo hicimos aquí.
Ten en cuenta que una línea se pueden crear especificando sus puntos de inicio y final directamente en el constructor, por ejemplo . Part.Line (punto1, punto2) o podemos crear una línea predeterminada y establecer sus propiedades después, como lo hicimos aquí.
</div>
</div>

A Line can be created also using:

{{Code|code=
import FreeCAD
import Part
DOC = FreeCAD.newDocument()

def mycreateLine(pt1, pt2, objName):
obj = DOC.addObject("Part::Line", objName)
obj.X1 = pt1[0]
obj.Y1 = pt1[2]
obj.Z1 = pt1[2]

obj.X2 = pt2[0]
obj.Y2 = pt2[1]
obj.Z2 = pt2[2]

DOC.recompute()
return obj

line = mycreateLine((0,0,0), (0,10,0), "LineName")

}}




Podemos crear un círculo de modo similar:
Podemos crear un círculo de modo similar:

{{Code|code=
{{Code|code=
import Part
import Part
Line 205: Line 289:
doc.recompute()
doc.recompute()
}}
}}

or using:

{{Code|code=
import FreeCAD
import Part
DOC = FreeCAD.newDocument()

def mycreateCircle(rad, objName):
obj = DOC.addObject("Part::Circle", objName)
obj.Radius = rad

DOC.recompute()
return obj

circle = mycreateCircle(5.0, "CircleName")

}}


Observa de nuevo: Se utilizó el círculo (''primitiva'' geométrica) para construir una ''forma'' a partir de él. Por supuesto, después podemos seguir teniendo acceso a la geometría de nuestra construcción, haciendo:
Observa de nuevo: Se utilizó el círculo (''primitiva'' geométrica) para construir una ''forma'' a partir de él. Por supuesto, después podemos seguir teniendo acceso a la geometría de nuestra construcción, haciendo:

{{Code|code=
{{Code|code=
s = f.Shape
s = f.Shape
Line 211: Line 316:
c = e.Curve
c = e.Curve
}}
}}

Aquí tomamos la forma de nuestro objeto f, después tomamos la lista de los bordes, en este caso sólo habrá uno porque hemos hecho toda la forma a partir de un solo círculo, así que tomamos sólo el primer elemento de la lista de bordes, y tomamos su curva. Cada borde tiene una curva, que es la primitiva geométrica en la que se sustenta.
Aquí tomamos la forma de nuestro objeto f, después tomamos la lista de los bordes, en este caso sólo habrá uno porque hemos hecho toda la forma a partir de un solo círculo, así que tomamos sólo el primer elemento de la lista de bordes, y tomamos su curva. Cada borde tiene una curva, que es la primitiva geométrica en la que se sustenta.


Line 228: Line 334:
</div>
</div>


{{Part Tools navi{{#translation:}}}}
{{Userdocnavi}}
{{Userdocnavi{{#translation:}}}}
[[Category:Part]]
[[Category:Workbenches]]
[[Category:Workbenches{{#translation:}}]]

Revision as of 09:44, 28 May 2020

Part workbench icon

Las capacidades CAD de FreeCAD se basan en el núcleo de OpenCasCade. El módulo de Piezas permite a FreeCAD utilizar y acceder a los objetos y funciones de OpenCascade. OpenCascade es un núcleo de CAD de nivel profesional, que cuenta con avanzadas capacidades de manipulación de geometría 3D y objetos. Los objetos Pieza, en contraste con los objetos Malla, son mucho más complejos y, por tanto, permiten operaciones mucho más avanzadas, como operaciones booleanas coherentes, historial de modificaciones y comportamiento paramétrico.

The objects created with the Part Workbench are relatively simple; they are intended to be used with boolean operations (unions and cuts) in order to build more complex shapes. This modeling paradigm is known as the constructive solid geometry (CSG) workflow, and it was the traditional methodology used in early CAD systems. On the other hand, the PartDesign Workbench provides a more modern workflow to constructing shapes: it uses a parametrically defined sketch, that is extruded to form a basic solid body, which is then modified by parametric transformations (feature editing), until the final object is obtained.

Part objects are more complex than mesh objects created with the Mesh Workbench, as they permit more advanced operations like coherent boolean operations, modifications history, and parametric behaviour.

The Part Workbench is the basic layer that exposes the OCCT drawing functions to all workbenches in FreeCAD

Las herramientas

Las herramientas del módulo Pieza están todas situadas en el menú Pieza, que aparece cuando se carga el módulo Piezas.

Primitivas

Estas son las herramientas para crear primitivas de objetos.

  • Caja: Dibuja una caja especificando sus dimensiones
  • Cilindro: Dibuja un cilindro especificando sus dimensiones
  • Esfera: Dibuja una esfera especificando sus dimensiones
  • Cono: Dibuja un cono especificando sus dimensiones
  • Toro: Dibuja un toro (anillo) especificando sus dimensiones
  • CreatePrimitives: Una herramienta para crear diversas primitivas geométricas paramétricas.
  • Shapebuilder: Una herramienta para crear formas más complejas a partir de diversas primitiv geométricas paramétricas

Modificando objetos

Estas son las herramientas para modificar los objetos existentes. Permiten seleccionar los objetos a modificar.

  • Extrusión: Extruye caras planas de un objeto
  • Revolución: Crea un objeto haciendo que gire otro objeto alrededor de un eje
  • Simetría: Crea una simetría de los objetos seleccionados alrededor de un plano de simetría dado
  • Redondear: Redondea las aristas de un objeto
  • Chaflán: Crea un chaflán en las aristas de un objeto
  • Ruled Surface:
  • Loft: Lofts de un perfil a otro.
  • Sweep: Barre uno o más perfiles a lo largo de un camino
  • Thickness: Hollows out a solid, leaving openings next to select faces.

Measure

File:Std Measure Menu.png Measure: Allows linear and angular measurement between points, edges, and faces.

Otras herramientas

Preferencias

Explicando conceptos

En la terminología OpenCascade, distinguimos entre primitivas geométricas y formas (topológicas). Una primitiva geométrica puede ser un punto, una línea, un círculo, un plano, etc, o incluso algunos tipos más complejos como una superficie o una curva B-Spline. Una forma puede ser un vértice, un borde, un alambre, una cara, un sólido o un compuesto de otras formas. Las primitivas geométricas no están hechas para ser visualizadas directamente en la escena 3D, sino que se utilizarán para la construcción de la geometría de las formas. Por ejemplo, un borde (forma, shape) puede construirse a partir de una línea o de un arco de círculo (primitivas).

Podríamos decir, para resumir, que las primitivas geométricas son bloques de construcción "inmateriales" (abstractos, "sin forma"), y las formas son la verdadera geometría espacial ("materializada") construida sobre ellas.

Para obtener una lista completa de todos ellos puedes ir a OCC documentation (Alternativa: sourcearchive.com) y búscar Geom_* (para la geometría) yTopoDS_* (para las formas). Allí también se puede leer más acerca de las diferencias entre las formas y los objetos geométricos. Ten en cuenta que, lamentablemente, la documentación oficial de OCC no está disponible en línea (se debe descargar un archivo) y está dirigida básicamente a los programadores, no a los usuarios finales. Pero posiblemente puedas encontrar allí información suficiente para iniciarse en esto.

At a very high level, topology tells what pieces an object is made of, and the logical relationships between them. A shape is made of a certain set of faces. A face is bounded by a certain set of edges. Two faces are adjacent if they share a common edge.

Topology alone does not tell you the size, curvature, or 3D locations of any of those pieces. However, each piece of topology does knows about it's underlying geometry. A face knows what surface it lies on. An edge knows what curve it lies on. The geometry knows about curvature and location in space. - Source


Thus, Topology defines the relationship between simple geometric entities, which can be linked together to represent complex shapes. - Modeling Data User's Guide

Los tipos geométricos en realidad se puede dividir en dos grandes grupos: las curvas y superficies. A partir de las curvas (líneas, círculos, ...) se puede construir un borde, a partir de las superficies (plano, cilindro, ...) se puede construir una cara. Por ejemplo, la primitiva geométrica línea es ilimitada, es decir, se define por un vector de base y un vector de dirección, mientras que su representación como forma será algo limitado por un punto de inicio y otro de fin. Y, de modo similar, una caja - un sólido - puede ser creada con seis planos limitados.

Desde un borde o cara también puede volver a su contraparte geométrica primitiva.

Así, a partir de las formas se pueden crear piezas muy complejas o, al revés, se pueden extraer todas las sub-formas de las que está hecha otra forma más compleja.


Thus, out of shapes you can build very complex parts or, the other way round, extract all sub-shapes a more complex shape is made of.

The Part::TopoShape class is the geometrical object that is seen on screen. Essentially all workbenches use these TopoShapes internally to build and display edges, faces, and solids.

Archivos de guión

See also: Part scripting

La estructura de datos más utilizada en el módulo de Piezas es el Tipo BRep de OpenCascade. Prácticamente todos los contenidos y los tipos de objeto del módulo de Piezas ya están disponibles para los archivos de guión con Python . Esto incluye primitivas geométricas, tales como la Línea y el Círculo (o arco), y toda la gama de TopoShapes, como vértices, bordes, alambres, caras, sólidos y compuestos. Cada uno de esos objetos puede ser creado de varios modos, y para algunos de tales objetos, especialmente los TopoShapes, también son posibles operaciones avanzadas, como la unión/diferencia/intersección booleana. Explore el contenido del módulo de Piezas, como se describe en la página Conceptos básicos de archivos de guión en FreeCAD, para saber más.

The most basic object that can be created is a Part Feature, which has a simple DatosPlacement property, and basic properties to define its color and appearance.

Another simple object used in 2D geometrical objects is Part Part2DObject, which is the base of Sketcher SketchObject (Sketcher), and most Draft elements.

Test script

Test the creation of Part Primitives with a script. introduced in version 0.19

import parttests.part_test_objects as pto
pto.create_test_file("example_file")

This script is located in the installation directory of the program, and can be examined to see how the basic primitives are built.

$INSTALL_DIR/Mod/Part/parttests/part_test_objects.py

Ejemplos

Para crear un elemento línea pasa a la consola de Python y escribe:

import Part,PartGui 
doc=App.newDocument()  
l=Part.LineSegment()
l.StartPoint=(0.0,0.0,0.0)
l.EndPoint=(1.0,1.0,1.0)
doc.addObject("Part::Feature","Line").Shape=l.toShape() 
doc.recompute()

Vamos a ver paso a paso el anterior ejemplo en Python:

import Part,PartGui
doc=App.newDocument()

Carga el módulo de piezas y crea un nuevo documento

l=Part.LineSegment()
l.StartPoint=(0.0,0.0,0.0)
l.EndPoint=(1.0,1.0,1.0)

Line es, de hecho, un segmento de recta, por ello la asignación de los puntos de inicio y fin.

doc.addObject("Part::Feature","Line").Shape=l.toShape()

Esto añade un objeto del tipo pieza al documento y le asigna la forma de representación del segmento de línea a la propiedad 'Forma' del objeto agregado. Es importante entender aquí que se utilizó una primitiva geométrica (el Part.line) para crear un TopoShape a partir de la misma (el método toShape () ). En el documento sólo se pueden añadir formas. En FreeCAD, las primitivas geométricas se utilizan como "estructuras de soporte" para las formas.

doc.recompute()

Actualiza el documento. Esto también prepara la representación visual del nuevo objeto Parte.

Ten en cuenta que una línea se pueden crear especificando sus puntos de inicio y final directamente en el constructor, por ejemplo . Part.Line (punto1, punto2) o podemos crear una línea predeterminada y establecer sus propiedades después, como lo hicimos aquí.

A Line can be created also using:

import FreeCAD
import Part
DOC = FreeCAD.newDocument()

def mycreateLine(pt1, pt2, objName):
    obj = DOC.addObject("Part::Line", objName)
    obj.X1 = pt1[0]
    obj.Y1 = pt1[2]
    obj.Z1 = pt1[2]

    obj.X2 = pt2[0]
    obj.Y2 = pt2[1]
    obj.Z2 = pt2[2]

    DOC.recompute()
    return obj

line = mycreateLine((0,0,0), (0,10,0), "LineName")


Podemos crear un círculo de modo similar:

import Part
doc = App.activeDocument()
c = Part.Circle() 
c.Radius=10.0  
f = doc.addObject("Part::Feature", "Circle")
f.Shape = c.toShape()
doc.recompute()

or using:

import FreeCAD
import Part
DOC = FreeCAD.newDocument()

def mycreateCircle(rad, objName):
    obj = DOC.addObject("Part::Circle", objName)
    obj.Radius = rad

    DOC.recompute()
    return obj

circle = mycreateCircle(5.0, "CircleName")


Observa de nuevo: Se utilizó el círculo (primitiva geométrica) para construir una forma a partir de él. Por supuesto, después podemos seguir teniendo acceso a la geometría de nuestra construcción, haciendo:

s = f.Shape
e = s.Edges[0]
c = e.Curve

Aquí tomamos la forma de nuestro objeto f, después tomamos la lista de los bordes, en este caso sólo habrá uno porque hemos hecho toda la forma a partir de un solo círculo, así que tomamos sólo el primer elemento de la lista de bordes, y tomamos su curva. Cada borde tiene una curva, que es la primitiva geométrica en la que se sustenta.

Diríjete a la página Archivos de guión de topología de datos si quieres saber más.

Tutoriales

OpenSCAD Module/es
Drawing Module/es