Draft API

From FreeCAD Documentation
Revision as of 05:58, 20 August 2011 by Splineman (talk | contribs)

Estas funciones son parte del módulo de Draft (Borrador) y pueden utilizarse en archivos de guión y macros o desde el interprete de Python, una vez se halla importado el módulo Draft.

Ejemplo:

import FreeCAD
from Draft import *
myrect = makeRectangle(4,3)
mydistance = FreeCAD.Vector(2,2,0)
move(myrect,mydistance)


cut(FreeCAD.Object, FreeCAD.Object)

Description: Devuelve un objeto cut creado a partir de la diferencia de 2 objetos dados. Los objetos originales se ocultan.

Returns: El nuevo objeto creado

extrude(FreeCAD.Object, Vector)

Description: Extruye el objeto dado en la dirección indicada por el vector. El objeto original se oculta.

Returns: El nuevo objeto creado

formatObject(FreeCAD.Object, [FreeCAD.Object])

Description: Esta función aplica al objeto de objetivo indicado las propiedades actuales establecidas en la barra del entorno Borrador (línea, color y ancho de línea), o copia las propiedades a un segundo objeto si se indica. También pone el objeto en el grupo "En construcción" si el botón "Construcción" está presionado.

Returns: Nada

fuse(FreeCAD.Object, FreeCAD.Object)

Description: Devuelve un objeto creado a partir de la unión de dos objetos dados. Si los objetos son coplanares, se utiliza una polilínea de borrador especial, en otro caso el objeto final es una fusión de piezas estándar.

Returns: El nuevo objeto creado

getDraftPath([string])

Description: Devuelve la ruta del usuario o sistema desde donde se está ejecutando el módulo Draft. Si se suministra una sub-ruta o un nombre de archivo, devuelve la ruta completa a la sub-ruta dentro del módulo Draft.

Returns: Una ruta de archivo

getGroupContents(list)

Description: Escanea recursivamente por la lista de grupos indicada. Si se encuentran los grupos, su contenido es añadido a la lista.

Returns: Una lista de objetos de FreeCAD

getRealName(string)

Description: Quita los números de rastreo a partir de un nombre de objeto.

Returns: El nombre del objeto desnudado

getSelection( )

Description: Devuelve la selección actual de FreeCAD.

Returns: La selección actual de FreeCAD.

makeCircle(radius, [placement], [facemode], [startangle], [endangle])

Description: Crea un objeto circunferencia con un radio dado. Si se indica una ubicación, se utiliza. Si facemode es False, la circunferencia se muestra como una polilínea, en otro caso como una cara. Si startangle y endangle se indicad (in grados), se utilizan y el objeto aparece como un arco.

Returns: El nuevo objeto creado.

makeDimension(Vector, Vector, [Vector] or FreeCAD.Object, int, int, [Vector])

Description: Creates a Dimension object measuring distance between first and second vectors, with the dimension line passign through the third vector if provided. The current line width and color from the Draft toolbar will be used. Instead of 2 vectors, you can also pass a FreeCAD object, and two integers (and optionally a vector where the dimension line must pass). In that case, the dimension will be associated with the object, and measure two of its vertices, indicated by the two given indice numbers.

Returns: The newly created object.

makeLine(Vector, Vector)

Description: Creates a line between the two given vectors. The current line width and color from the Draft toolbar will be used.

Returns: The newly created object.

makeRectangle(length, width, [placement], [facemode])

Description: Creates a Rectangle object with length in X direction and height in Y direction. If a placement is given, it is used. If facemode is False, the rectangle is shown as a wireframe, otherwise as a face. The current line width and color from the Draft toolbar will be used.

Returns: The newly created object.

makeText(string or list, [Vector], [screenmode]))

Description: Creates a Text object, at the given point if a vector is provided, containing the string or the strings given in the list, one string by line. The current color from the Draft toolbar and the text height and font specified in preferences are used. If screenmode is True, the text always faces the view direction, otherwise it lies on the XY plane.

Returns: The newly created object.

makeWire(list or Part.Wire, [closed], [placement], [facemode])

Description: Creates a Wire object from the given list of vectors or from the given Wire. If closed is True or if first and last points are identical, the wire is closed. If facemode is True (and wire is closed), the wire will appear filled. The current line width and color from the Draft toolbar will be used.

Returns: The newly created object.

move(FreeCAD.Object or list, Vector, [copymode]))

Description: Moves the given object or the objects contained in the given list in the direction and distance indicated by the given vector. If copymode is True, the actual objects are not moved, but copies are created instead.

Returns: The object(s) (or their copies if copymode was True).

precision( )

Description: Returns the precision value from Draft user settings.

Returns: An integer.

rotate(FreeCAD.Object or list, angle, [center], [axis] ,[copymode])

Description: Rotates the given object or the objects contained in the given list with the given angle around the given center if provided, using axis as a rotation axis. If axis is omitted, the rotation will be around the vertical Z axis. If copymode is True, the actual objects are not moved, but copies are created instead.

Returns: The objects (or their copies).

scale(FreeCAD.Object or list, vector, [center], [copymode])

Description: Scales the given object or the objects contained in the given list with a scale factors defined by the given vector (in X, Y and Z directions) around the given center if provided. If copymode is True, the actual objects are not moved, but copies are created instead.

Returns: The objects (or their copies).

select(FreeCAD.Object)

Description: Deselects everything and selects only the passed object

Returns: Nothing.

shapify(FreeCAD.Object)

Description: Transforms a parametric shape object into non-parametric.

Returns: The new object.

draftify(FreeCAD.Object or list)

Description: Turns the given object or each object of the given list into Draft parametric wires.

Returns: Nothing.

getSVG(FreeCAD.Object, [linemodifier], [textmodifier], [(u,v)])

Description: Creates a SVG representation of the given object. The linemodifier attribute is a scale factor (in percents) for line width, and textmodifier for text size. You can also optionally provide a tuple of vectors to define a projection plane, otherwise the geometry will be projected on the XY plane.

Returns: a string containing a SVG representation of the given object.

Available translations of this page: Template:Se