Macro hinge/fr: Difference between revisions

From FreeCAD Documentation
mNo edit summary
(Updating to match new version of source page)
Line 16: Line 16:
20140908b_Hinge-1.FCMacro
20140908b_Hinge-1.FCMacro


{{Code|code=
<syntaxhighlight>
import FreeCAD, FreeCADGui, Draft, Part
import FreeCAD, FreeCADGui, Draft, Part
from FreeCAD import Base
from FreeCAD import Base
Line 38: Line 38:
time.sleep(0) #modify the time here
time.sleep(0) #modify the time here


}}
</syntaxhighlight>
==Liens==
==Liens==
La page de discussion sur le forum [http://forum.freecadweb.org/viewtopic.php?f=3&t=7606&p=62086#p62086 Struggling with LinearPattern (again)]
La page de discussion sur le forum [http://forum.freecadweb.org/viewtopic.php?f=3&t=7606&p=62086#p62086 Struggling with LinearPattern (again)]

Revision as of 09:07, 26 September 2016

File:Text-x-python Hinge Simul

Description
Simulation de mouvement d'une charnière.

Auteur: Mario52
Auteur
Mario52
Téléchargement
None
Liens
Version Macro
1.0
Dernière modification
None
Version(s) FreeCAD
None
Raccourci clavier
None
Voir aussi
None

Simulation de pivotement d'une charnière

Utilisation

Ouvrez les deux fichiers (20140908b_Hinge-1.FCMacro and 20140908b_Hinge-1.FCStd) dans FreeCAD avec 2 écrans Menu: Fenêtre > Mosaïque et lancez la macro ou lancez la macro avec le bouton File:Macro-execute.svg

Charnière
Charnière

Les Fichiers

20140908b_Hinge-1.fcstd

Script

20140908b_Hinge-1.FCMacro

import FreeCAD, FreeCADGui, Draft, Part
from FreeCAD import Base
import time

ii = 0
pas = 0
for ii2 in range(180):
    if pas == 0:
        if ii > 90:
            pas = 1
        ii += 5
    else:
        if ii < 1:
            pas = 0
        ii -= 5
   
    App.getDocument("_0140908b_Hinge_1").Fusion.Placement=App.Placement(App.Vector(0,0,0), App.Rotation(App.Vector(0,0,1),ii), App.Vector(44.4,6.9,0))
    App.Console.PrintMessage(str(ii2)+"  " + str(ii)+"  " + str(pas) +"\n")
    Gui.updateGui()
    time.sleep(0) #modify the time here

Liens

La page de discussion sur le forum Struggling with LinearPattern (again)

Other languages: