Macro hinge
File:Text-x-python Hinge Simul |
Description |
---|
Hinge simulation. Macro version: 1.0 Last modified: 2014-09-09 Author: Mario52 |
Author |
Mario52 |
Download |
None |
Links |
Macros recipes How to install macros How to customize toolbars |
Macro Version |
1.0 |
Date last modified |
2014-09-09 |
FreeCAD Version(s) |
None |
Default shortcut |
None |
See also |
None |
Description
Simulates hinge movement
Uses
Open the 2 files (20140908b_Hinge-1.FCMacro and 20140908b_Hinge-1.FCStd) in FreeCAD with 2 screens (Menu: Windows > Tile) and click in the window and the macro and click F6 (debug macro) to run the macro or run the macro with File:Macro-execute.svg
The File
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
Link
The discussion page Struggling with LinearPattern (again)