Macro hinge: Difference between revisions

From FreeCAD Documentation
(create page)
 
(translate)
Line 1: Line 1:
<translate>
{{Macro|Icon=Text-x-python|Name=Hing simul|Description=Hing simulation.|Author=Mario52}}
{{Macro|Icon=Text-x-python|Name=Hinge Simul|Description=Hinge simulation.|Author=Mario52}}


Simulates hinge movement
Simulate hing.

[[File:Hing_00.gif|left]]{{clear}}


[[File:Hing_00.gif|left]]
{{clear}}
===Uses===
===Uses===


Open the 2 files (20140908b_Hinge-1.FCMacro and 20140908b_Hinge-1.FCStd) in FreeCAD with 2 screens, then (Menu > Windows > tile menu) and click in the window and the macro and click F6 (debug macro) to run the macro
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

[[File:Hing_01.png|left|300px]]{{clear}}


[[File:Hing_01.png|left|300px]]
{{clear}}
===The File===
===The File===
</translate>

[http://forum.freecadweb.org/download/file.php?id=7628 20140908b_Hinge-1.fcstd]
[http://forum.freecadweb.org/download/file.php?id=7628 20140908b_Hinge-1.fcstd]
<translate>

===Script=== <!--T:3-->
===Script===
</translate>
20140908b_Hinge-1.FCMacro
20140908b_Hinge-1.FCMacro


Line 40: Line 42:


</syntaxhighlight>
</syntaxhighlight>
<translate>
===Link===
===Link===
The page discussion [http://forum.freecadweb.org/viewtopic.php?f=3&t=7606&p=62086#p62086 Struggling with LinearPattern (again)]
The discussion page [http://forum.freecadweb.org/viewtopic.php?f=3&t=7606&p=62086#p62086 Struggling with LinearPattern (again)]
</translate>
{{clear}}
<languages/>

Revision as of 21:53, 29 September 2014

File:Text-x-python Hinge Simul

Description
Hinge simulation.

Author: Mario52
Author
Mario52
Download
None
Links
Macro Version
1.0
Date last modified
None
FreeCAD Version(s)
None
Default shortcut
None
See also
None

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

The File

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")
    time.sleep(0) #modify the time here

Link

The discussion page Struggling with LinearPattern (again)

Other languages: