Translate

docs/0.4/freecad/basefunction
docs/0.3/freecad/basefunction
It is necessary to write the function such that it is a function of two
parameters, a dict of parameter names and values, and a FreeCAD document. The
keys of this dict will be the names of the parameters of the part, as described
in the blt file. There is an additional parameter `name` that holds the name of
the part.
SourceTranslationState
44
As an example we use the follwing function to create washers:
On utilise la fonction suivant de création d'un boulon comme exemple :
45
import Part
import Part
46
def washer1(params,document):
key = params['key']
d1 = params['d1']
d2 = params['d2']
s = params['s']
name = params['name']
def washer1(params,document):
key = params['key']
d1 = params['d1']
d2 = params['d2']
s = params['s']
name = params['name']
47
part = document.addObject("Part::Feature",name)
outer = Part.makeCylinder(d2,s)
inner = Part.makeCylinder(d1,s)
part.Shape = outer.cut(inner).removeSplitter()
part = document.addObject("Part::Feature",name)
outer = Part.makeCylinder(d2,s)
inner = Part.makeCylinder(d1,s)
part.Shape = outer.cut(inner).removeSplitter()
48
This function uses the CSG facilities of FreeCAD, but it is equally possible to
use BRep scripting.
Cette fonction utilise les capacités CSG de FreeCAD, mais il est également possible
d’utiliser un script BRep.
49
It is necessary to write the function such that it is a function of two
parameters, a dict of parameter names and values, and a FreeCAD document. The
keys of this dict will be the names of the parameters of the part, as described
in the blt file. There is an additional parameter `name` that holds the name of
the part.
50
In the first part of the function, we are assigning local variables with the
parameter values as a shortcut. In the second part of the function, we add a
new object to the document, create the geometry and assign it to the part.
`removeSplitter` cleans up artifacts resulting from CSG operation under certain
circumstances.
51
### Put it to the right place
52
This function should reside in a file (in this case called `washer.py`) with
extension `.py` in a subdirectory of the freecad directory which is named after
the collection to which the part belongs (in this case `washer`). This
directory must contain a empty file called `__init__.py` and the base file for
this collection (in this case `washer.base`).
53
### Write the base file
54
The base file provides BOLTS with all the informations it needs to know about
the files in a collection directory, it is a kind of manifest file. It contains
a list of sections (more precisely
[base file elements]({{ spec(base-file-element) }}))
, each describing one file:
4 months ago Anonymous user has suggested
Il est nécessaire d'écrire la fonction de manière à ce qu'elle soit défini par deux paramètres, une liste de paramètres de noms et valeurs, et un Document FreeCAD.
Les paramètres de cette liste seront les noms des paramètres de la pièce, tel que décrit
dans le fichier blt. Il y a un paramètre `name` supplémentaire qui contient le nom de
la pièce.

Suggested change:

Il est nécessaire d'écrire la fonction de manière à ce qu'elle soit défini par deux paramètres, une liste de paramètres de noms et valeurs, et un Document FreeCAD.
Les paramètres de cette liste seront les noms des paramètres de la pièce, tel que décrit
dans le fichier blt. Il y a un paramètre `name` supplémentaire qui contient le nom de
la pièce.

Loading…

Things to check

Glossary

Source Translation
No related strings were found in the glossary.

Source information

Comments
docs/0.4/freecad/basefunction docs/0.3/freecad/basefunction
Source string age
3 years ago
Translation file
translations/fr/LC_MESSAGES/docs.po, translation unit 49
String priority
Medium