API de l'atelier Part

From FreeCAD Documentation
Revision as of 21:53, 5 December 2014 by Renatorivo (talk | contribs) (Created page with "Le module '''Part''' 16px, est un lien direct, entre '''FreeCAD''', et ,le noyau '''OpenCasCade'''. Il fournit principalement des [[TopoShape_API/...")

Le module Part , est un lien direct, entre FreeCAD, et ,le noyau OpenCasCade. Il fournit principalement des TopoShapes qui sont les types d'objets principaux utilisés par OpenCascade. Le module Part contient également une variété de fonctions utiles, pour créer, et, manipuler des topoShapes. Exemple :

 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: