Macro hinge: Difference between revisions

From FreeCAD Documentation
m ({{Code|code=)
(Use {{MacroCode}})
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<translate>
<translate>
<!--T:1-->
<!--T:1-->
{{Macro
{{Macro|Icon=Text-x-python|Name=Hinge Simul|Description=Hinge simulation.|Author=Mario52|Version=1.0}}
|Name=Simulates hinge movement
|Icon=Macro hinge.png
|Description=Hinge simulation.
|Author=Mario52
|Version=1.0
|Date=2014-09-09
|FCVersion=All
|Download=The File [http://forum.freecadweb.org/download/file.php?id=7628 20140908b_Hinge-1.fcstd]<br />[https://www.freecadweb.org/wiki/images/a/a8/Macro_hinge.png ToolBar Icon]
}}


<!--T:2-->
==Description== <!--T:2-->
Simulates hinge movement
Simulates hinge movement


<!--T:3-->
<!--T:3-->
[[File:Hing_00.gif|left]]{{clear}}
[[File:Hing_00.gif]]


===Uses=== <!--T:4-->
==Uses== <!--T:4-->


<!--T:5-->
<!--T:5-->
Line 17: Line 27:
[[File:Hing_01.png|left|300px]]{{clear}}
[[File:Hing_01.png|left|300px]]{{clear}}


===The File=== <!--T:7-->
==The File== <!--T:7-->
</translate>
</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>
<translate>
===Script=== <!--T:8-->
==Script== <!--T:8-->
</translate>
</translate>
ToolBar Icon [[Image:Macro_hinge.png]]
20140908b_Hinge-1.FCMacro


'''20140908b_Hinge-1.FCMacro'''
{{Code|code=

{{MacroCode|code=
import FreeCAD, FreeCADGui, Draft, Part
import FreeCAD, FreeCADGui, Draft, Part
from FreeCAD import Base
from FreeCAD import Base
Line 48: Line 60:


}}
}}

<translate>
<translate>

===Link=== <!--T:9-->
==Link== <!--T:9-->
The discussion page [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>
</translate>
{{clear}}
{{clear}}
<languages/>

Revision as of 23:15, 7 May 2020

Other languages:

Simulates hinge movement

Description
Hinge simulation.

Macro version: 1.0
Last modified: 2014-09-09
FreeCAD version: All
Download: The File 20140908b_Hinge-1.fcstd
ToolBar Icon
Author: Mario52
Author
Mario52
Download
The File 20140908b_Hinge-1.fcstd
ToolBar Icon
Links
Macro Version
1.0
Date last modified
2014-09-09
FreeCAD Version(s)
All
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

20140908b_Hinge-1.fcstd

Script

ToolBar Icon

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)