Part API/es: Difference between revisions

From FreeCAD Documentation
m (upgrade "makeLoft")
(Updating to match new version of source page)
Line 1: Line 1:
El módulo Pieza es la conexión directa entre FreeCAD y el kernel de OpenCasCade. Proporciona principalmente [[TopoShape_API/es|TopoShapes]] el cual es el principal tipo de objeto utilizado por OpenCascade. El módulo de Pieza también contiene una variedad de funciones convenientes para crear y manipular topoShapes. Ejemplo:
The Part module is the direct connection between FreeCAD and the OpenCasCade kernel. It provides mainly [[TopoShape_API|TopoShapes]] which is the main object type used by OpenCascade. The Part module also contains a variety of convenience functions to create and manipulate topoShapes. Example:
<syntaxhighlight>

import Part
import Part
mycube = Part.makeBox(2,2,2)
mycube = Part.makeBox(2,2,2)
Part.show(mycube)
Part.show(mycube)
</syntaxhighlight>


{{APIFunction/es|__fromPythonOCC__|OCC.Object|Método de ayuda para convertir una forma pythonocc en una forma interna|Una forma de Pieza Part.Form}}

{{APIFunction/es|__sortEdges__|list of edges|Método de ayuda para ordenar y desordenar listas de aristas para que después dos aristas adyacentes compartan un vértice en común|Una lista de aristas}}

{{APIFunction/es|__toPythonOCC__|Part.Shape|Método de ayuda para convertir una forma interna a una forma pythonocc|Una forma OCC OCC.Shape}}

{{APIFunction/es|cast_to_shape|Part.Shape|Vaciado del tipo de forma actual| }}

{{APIFunction/es|export|list,string|Exportar una lista de objetos en un archivo individual.| }}

{{APIFunction/es|getSortedClusters|list of edges|Método de ayuda para ordenar y agrupar una variedad de aristas| }}

{{APIFunction/es|insert|string,string|Inserta el archivo (cuya ruta es dada como primer argumento) en el documento indicado (como segundo argumento).| }}

{{APIFunction/es|makeBox|length,width,height,[pnt,dir]|Crea un cubo ubicado en el punto pnt con las dimensiones (length,width,height). Por defecto el vector pnt es (0,0,0) y el vector dir es (0,0,1)|La forma creada}}

{{APIFunction/es|makeCircle|radius,[pnt,dir,angle1,angle2]|Crea una circunferencia con un radio dado. Por defecto el vector pnt es Vector(0,0,0), el vector dir es (0,0,1), angle1 es 0 y angle2 es 360|La forma creada}}

{{APIFunction/es|makeCompound|list|Crea un compuesto de una lista de formas.|La forma creada}}

{{APIFunction/es|makeCone|radius1,radius2,height,[pnt,dir,angle]|Crea un cono con un radio dado y una altura. Por defecto el vector pnt es (0,0,0), el vector dir es (0,0,1) y angle es 360|La forma creada}}

{{APIFunction/es|makeCylinder|radius,height,[pnt,dir,angle]|Crea un cilindro con un radio y altura dados. Por defecto el vector pnt es (0,0,0), el vector dir es (0,0,1) y angle es 360|La forma creada}}

{{APIFunction/es|makeHelix|pitch,height,radius,[angle]|Crea una hélice con un paso, altura y radio dados. Por defecto se utiliza una superficie cilindrica para crear la hélice. Si el cuarto parámetro está definido se utiliza en su lugar una superficie cónica|La forma creada}}

{{APIFunction/es|makeLine|(x1,y1,z1),(x2,y2,z2)|Crea una línea de dos puntos|La forma creada}}

{{APIFunction/es|makeLoft| shapelist<profiles>,[boolean<solid>,boolean<ruled>]|Crea una forma recubrimiento (Loft).|La forma creada}}

{{APIFunction/es|makePlane|length,width,[pnt,dir]|Crea un plano. Por defecto el vector pnt es (0,0,0) y el vector dir es (0,0,1)|La forma creada}}

{{APIFunction/es|makePolygon|list|Crea un polígono de una lista de vectores|La forma creada}}

{{APIFunction/es|makeRevolution|Curve,[vmin,vmax,angle,pnt,dir]|Crea una forma de revolución (revolved) rotando la curva o una porción de ella alrededor de un eje dado por (pnt,dir). Por defecto vmin/vmax se establecen para limitar la curva, angle es 360, el vector pnt es (0,0,0) y el vector dir es (0,0,1)|La forma creada}}

{{APIFunction/es|makeRuledSurface|Edge or Wire,Edge or Wire|Crea una superficie reglada a partir de dos aristas o contornos. Si se utilizan contornos estos deben tener el mismo número de aristas.|La forma creada}}

{{APIFunction/es|makeShell|list|Crea una cáscara a partir de una lista de caras.|La forma creada}}

{{APIFunction/es|makeSolid|Part.Shape|Crea un sólido a partir de las cáscaras dentro de una forma.|La forma creada}}

{{APIFunction/es|makeSphere|radius,[pnt, dir, angle1,angle2,angle3]|Crea una esfera con un radio dado. Por defecto el vector pnt es (0,0,0), el vector dir es (0,0,1), angle1 es 0, angle2 es 90 y angle3 es 360|La forma creada}}

{{APIFunction/es|makeTorus|radius1,radius2,[pnt,dir,angle1,angle2,angle]|Crea un toto con un radio y ángulos dados. Por defecto el vector pnt es (0,0,0), el vector dir es (0,0,1), angle1 es 0, angle2 es 360 y angle es 360|La forma creada}}

{{APIFunction/es|makeTube|edge,float|Crea un tubo.|the created shape}}


{{APIFunction/es|open|string|Crea un nuevo documento y carga el archivo en el documento.| }}


{{APIFunction|__fromPythonOCC__|OCC.Object|Helper method to convert a pythonocc shape to an internal shape|A Part.Shape}}
{{APIFunction/es|read|string|Carga el archivo y devuelve la forma.|Una forma}}
{{APIFunction|__sortEdges__|list of edges|Helper method to sort an unsorted list of edges so that afterwards two adjacent edges share a common vertex|a list of edges}}
{{APIFunction|__toPythonOCC__|Part.Shape|Helper method to convert an internal shape to pythonocc shape|an OCC.Shape}}
{{APIFunction|cast_to_shape|Part.Shape|Cast to the actual shape type| }}
{{APIFunction|export|list,string|Export a list of objects into a single file.| }}
{{APIFunction|getSortedClusters|list of edges|Helper method to sort and cluster a variety of edges| }}
{{APIFunction|insert|string,string|Insert the file (path given as first argument) into the given document (second argument).| }}
{{APIFunction|makeBox|length,width,height,[pnt,dir]|Makes a box located at pnt with the dimensions (length,width,height). By default pnt is Vector(0,0,0) and dir is Vector(0,0,1)|the created shape}}
{{APIFunction|makeCircle|radius,[pnt,dir,angle1,angle2]|Makes a circle with a given radius. By default pnt is Vector(0,0,0), dir is Vector(0,0,1), angle1 is 0 and angle2 is 360|the created shape}}
{{APIFunction|makeCompound|list|Creates a compound out of a list of shapes.|the created shape}}
{{APIFunction|makeCone|radius1,radius2,height,[pnt,dir,angle]|Makes a cone with given radii and height. By default pnt is Vector(0,0,0), dir is Vector(0,0,1) and angle is 360|the created shape}}
{{APIFunction|makeCylinder|radius,height,[pnt,dir,angle]|Makes a cylinder with a given radius and height. By default pnt is Vector(0,0,0),dir is Vector(0,0,1) and angle is 360|the created shape}}
{{APIFunction|makeHelix|pitch,height,radius,[angle,lefthand,heightstyle]|Makes a helix shape with a given pitch, height and radius. Defaults to right-handed cylindrical helix. Non-zero angle parameter produces a conical helix. Lefthand True produces left handed helix. Heightstyle applies only to conical helices. Heightstyle False (default) will cause the height parameter to be interpreted as the length of the side of the underlying frustum. Heightstyle True will cause the height parameter to be interpreted as the vertical height of the helix. Pitch is "metric pitch" (advance/revolution). For conical helix, radius is the minor radius.|the created shape}}
{{APIFunction|makeLine|(x1,y1,z1),(x2,y2,z2)|Makes a line of two points|the created shape}}
{{APIFunction|makeLoft|shapelist<profiles>,[boolean<solid>,boolean<ruled>]|Creates a loft shape using the list of profiles. Optionally make result a solid (vs surface/shell) or make result a ruled surface.|the created shape}}
{{APIFunction|makePlane|length,width,[pnt,dir]|Makes a plane. By default pnt is Vector(0,0,0) and dir is Vector(0,0,1)|the created shape}}
{{APIFunction|makePolygon|list|Makes a polygon of a list of Vectors|the created shape}}
{{APIFunction|makeRevolution|Curve,[vmin,vmax,angle,pnt,dir]|Makes a revolved shape by rotating the curve or a portion of it around an axis given by (pnt,dir). By default vmin/vmax are set to bounds of the curve,angle is 360,pnt is Vector(0,0,0) and dir is Vector(0,0,1)|the created shape}}
{{APIFunction|makeRuledSurface|Edge or Wire,Edge or Wire|Creates a ruled surface out of two edges or wires. If wires are used then these must have the same number of edges.|the created shape}}
{{APIFunction|makeShell|list|Creates a shell out of a list of faces.|the created shape}}
{{APIFunction|makeSolid|Part.Shape|Creates a solid out of the shells inside a shape.|the created shape}}
{{APIFunction|makeSphere|radius,[pnt, dir, angle1,angle2,angle3]|Makes a sphere with a given radius. By default pnt is Vector(0,0,0), dir is Vector(0,0,1), angle1 is 0, angle2 is 90 and angle3 is 360|the created shape}}
{{APIFunction|makeTorus|radius1,radius2,[pnt,dir,angle1,angle2,angle]|Makes a torus with a given radii and angles. By default pnt is Vector(0,0,0),dir is Vector(0,0,1),angle1 is 0,angle2 is 360 and angle is 360|the created shape}}
{{APIFunction|makeTube|edge,float|Creates a tube.|the created shape}}
{{APIFunction|open|string|Creates a new document and load the file into the document.| }}
{{APIFunction|read|string|Loads the file and return the shape.|a shape}}
{{APIFunction|show|shape|Adds the shape to the active document or create one if no document exists.| }}


{{APIFunction/es|show|shape|Añade la forma al documento activo o crea uno si el documento no existe.| }}


[[Category:API]]
{{languages/es| {{en|Part_API}} {{fr|Part_API/fr}} }}


{{clear}}
[[Category:API/es]]
<languages/>

Revision as of 21:47, 5 December 2014

The Part module is the direct connection between FreeCAD and the OpenCasCade kernel. It provides mainly TopoShapes which is the main object type used by OpenCascade. The Part module also contains a variety of convenience functions to create and manipulate topoShapes. Example:

 import Part
 mycube = Part.makeBox(2,2,2)
 Part.show(mycube)


__fromPythonOCC__(OCC.Object)

Description: Helper method to convert a pythonocc shape to an internal shape

Returns: A Part.Shape

__sortEdges__(list of edges)

Description: Helper method to sort an unsorted list of edges so that afterwards two adjacent edges share a common vertex

Returns: a list of edges

__toPythonOCC__(Part.Shape)

Description: Helper method to convert an internal shape to pythonocc shape

Returns: an OCC.Shape

cast_to_shape(Part.Shape)

Description: Cast to the actual shape type

Returns:

export(list,string)

Description: Export a list of objects into a single file.

Returns:

getSortedClusters(list of edges)

Description: Helper method to sort and cluster a variety of edges

Returns:

insert(string,string)

Description: Insert the file (path given as first argument) into the given document (second argument).

Returns:

makeBox(length,width,height,[pnt,dir])

Description: Makes a box located at pnt with the dimensions (length,width,height). By default pnt is Vector(0,0,0) and dir is Vector(0,0,1)

Returns: the created shape

makeCircle(radius,[pnt,dir,angle1,angle2])

Description: Makes a circle with a given radius. By default pnt is Vector(0,0,0), dir is Vector(0,0,1), angle1 is 0 and angle2 is 360

Returns: the created shape

makeCompound(list)

Description: Creates a compound out of a list of shapes.

Returns: the created shape

makeCone(radius1,radius2,height,[pnt,dir,angle])

Description: Makes a cone with given radii and height. By default pnt is Vector(0,0,0), dir is Vector(0,0,1) and angle is 360

Returns: the created shape

makeCylinder(radius,height,[pnt,dir,angle])

Description: Makes a cylinder with a given radius and height. By default pnt is Vector(0,0,0),dir is Vector(0,0,1) and angle is 360

Returns: the created shape

makeHelix(pitch,height,radius,[angle,lefthand,heightstyle])

Description: Makes a helix shape with a given pitch, height and radius. Defaults to right-handed cylindrical helix. Non-zero angle parameter produces a conical helix. Lefthand True produces left handed helix. Heightstyle applies only to conical helices. Heightstyle False (default) will cause the height parameter to be interpreted as the length of the side of the underlying frustum. Heightstyle True will cause the height parameter to be interpreted as the vertical height of the helix. Pitch is "metric pitch" (advance/revolution). For conical helix, radius is the minor radius.

Returns: the created shape

makeLine((x1,y1,z1),(x2,y2,z2))

Description: Makes a line of two points

Returns: the created shape

makeLoft(shapelist<profiles>,[boolean<solid>,boolean<ruled>])

Description: Creates a loft shape using the list of profiles. Optionally make result a solid (vs surface/shell) or make result a ruled surface.

Returns: the created shape

makePlane(length,width,[pnt,dir])

Description: Makes a plane. By default pnt is Vector(0,0,0) and dir is Vector(0,0,1)

Returns: the created shape

makePolygon(list)

Description: Makes a polygon of a list of Vectors

Returns: the created shape

makeRevolution(Curve,[vmin,vmax,angle,pnt,dir])

Description: Makes a revolved shape by rotating the curve or a portion of it around an axis given by (pnt,dir). By default vmin/vmax are set to bounds of the curve,angle is 360,pnt is Vector(0,0,0) and dir is Vector(0,0,1)

Returns: the created shape

makeRuledSurface(Edge or Wire,Edge or Wire)

Description: Creates a ruled surface out of two edges or wires. If wires are used then these must have the same number of edges.

Returns: the created shape

makeShell(list)

Description: Creates a shell out of a list of faces.

Returns: the created shape

makeSolid(Part.Shape)

Description: Creates a solid out of the shells inside a shape.

Returns: the created shape

makeSphere(radius,[pnt, dir, angle1,angle2,angle3])

Description: Makes a sphere with a given radius. By default pnt is Vector(0,0,0), dir is Vector(0,0,1), angle1 is 0, angle2 is 90 and angle3 is 360

Returns: the created shape

makeTorus(radius1,radius2,[pnt,dir,angle1,angle2,angle])

Description: Makes a torus with a given radii and angles. By default pnt is Vector(0,0,0),dir is Vector(0,0,1),angle1 is 0,angle2 is 360 and angle is 360

Returns: the created shape

makeTube(edge,float)

Description: Creates a tube.

Returns: the created shape

open(string)

Description: Creates a new document and load the file into the document.

Returns:

read(string)

Description: Loads the file and return the shape.

Returns: a shape

show(shape)

Description: Adds the shape to the active document or create one if no document exists.

Returns: