283 lines
11 KiB
HTML
283 lines
11 KiB
HTML
<html><head><title>Macro Geneva Wheel GUI/fr</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type='text/css' href='wiki.css' rel='stylesheet'></head><body><h1>Macro Geneva Wheel GUI/fr</h1></div>
|
|
|
|
<div id="mw-content-text" lang="fr" dir="ltr" class="mw-content-ltr"><hr/><div class="mw-parser-output"><table class="fcinfobox wikitable ct" width="100%" style="float: right; width: 230px; margin-left: 10px;">
|
|
<tr>
|
|
<td class="ctTitle">
|
|
<h3><span class="mw-headline" id="Geneva_Wheel_GUI"><a href="https://www.freecadweb.org/wiki/index.php?title=File:GW_Dim.png" class="image"><img alt="GW Dim.png" src="32px-GW_Dim.png" width="32" height="21" srcset="/wiki/images/thumb/8/8d/GW_Dim.png/48px-GW_Dim.png 1.5x, /wiki/images/thumb/8/8d/GW_Dim.png/64px-GW_Dim.png 2x" /></a> Geneva Wheel GUI</span></h3>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Description
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven left">Macro avec interface graphique qui permet à l'utilisateur de créer un mécanisme de roue de Genève à partir de zéro. Cette macro est basée sur la macro de <a href="https://www.freecadweb.org/wiki/index.php?title=User:Drei" title="User:Drei">Drei</a> <a href="https://www.freecadweb.org/wiki/index.php?title=Macro_Geneva_Wheel/fr" title="Macro Geneva Wheel/fr">Macro Geneva Wheel</a>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Auteur
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=User:Quick61" title="User:Quick61">quick61</a>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Liens
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=Macros_recipes/fr" title="Macros recipes/fr">Recettes macros</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/fr" title="How to install macros/fr">Comment installer une macro</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=Customize_Toolbars/fr" title="Customize Toolbars/fr">Comment ajouter une barre d'outils</a>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Version
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven macro-version">1.0
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Date dernière modification
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven macro-date">2014-09-21
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctToc"><br /><div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
|
|
<ul>
|
|
<li class="toclevel-1"><a href="#Geneva_Wheel_GUI"><span class="tocnumber">1</span> <span class="toctext">Geneva Wheel GUI</span></a></li>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Description"><span class="tocnumber">2</span> <span class="toctext">Description</span></a></li>
|
|
<li class="toclevel-1 tocsection-2"><a href="#Utilisation"><span class="tocnumber">3</span> <span class="toctext">Utilisation</span></a></li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#Prise_d.27.C3.A9cran"><span class="tocnumber">4</span> <span class="toctext">Prise d'écran</span></a></li>
|
|
<li class="toclevel-1 tocsection-4"><a href="#Script"><span class="tocnumber">5</span> <span class="toctext">Script</span></a></li>
|
|
<li class="toclevel-1 tocsection-5"><a href="#Liens"><span class="tocnumber">6</span> <span class="toctext">Liens</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
</td></tr>
|
|
</table>
|
|
<p><br />
|
|
</p>
|
|
<h2><span class="mw-headline" id="Description">Description</span></h2>
|
|
<p>Macro avec interface graphique qui permet à l'utilisateur de créer un mécanisme de roue de Genève à partir de zéro
|
|
</p>
|
|
<h2><span class="mw-headline" id="Utilisation">Utilisation</span></h2>
|
|
<p>Pour utiliser cette macro, la copier dans votre répertoire Macro de FreeCAD et inclure l'image <a rel="nofollow" class="external text" href="http://www.freecadweb.orgGW_Dim.png">GW_Dim.png</a> ci-dessous dans le même répertoire que le macro.
|
|
</p><p><br />
|
|
</p>
|
|
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:GW_Dim.png" class="image" title="Copier et inclure dans la même répertoire que la macro."><img alt="Copier et inclure dans la même répertoire que la macro." src="GW_Dim.png" width="251" height="161" /></a></div></div>
|
|
<h2><span class="mw-headline" id="Prise_d.27.C3.A9cran">Prise d'écran</span></h2>
|
|
<p><a href="https://www.freecadweb.org/wiki/index.php?title=File:New_GW_GUI.png" class="image" title="Exemple de réalisation."><img alt="Exemple de réalisation." src="New_GW_GUI.png" width="827" height="513" /></a>
|
|
</p>
|
|
<h2><span class="mw-headline" id="Script">Script</span></h2>
|
|
<p><b>Macro Geneva Wheel GUI.FCMacro</b>
|
|
</p>
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>#Creation of a Geneva Wheel with Parametric values By: Isaac Ayala (drei) & Mark Stephen (quick61)
|
|
#This Macro creates the main parts of a Geneva Wheel Mechanism
|
|
|
|
#It depends on six values that must be altered in the following code
|
|
#The variables are a, b, n, p, t and h.
|
|
|
|
#Definition for each variable
|
|
# Input
|
|
#a = Drive Crank Radius
|
|
#b = Geneva Wheel Radius
|
|
#p = Drive Pin Radius
|
|
#t = Geneva Wheel Tolerance
|
|
#h = Geneva Wheel Height
|
|
#n = Driven Slot Quantity
|
|
# Output
|
|
#c = Distance Between Centers
|
|
#s = Slot Center Width
|
|
#w = Slot Width
|
|
#y = Stop Arc Radius
|
|
#z = Stop Disc Radius
|
|
#v = Clearance Arc
|
|
|
|
#Please note that you can alter the code so it depends on five values exclusively
|
|
#Just replace c, and either a or b with the following
|
|
# Keep value for a
|
|
#c = a/math.sin(math.pi/n)
|
|
#b = math.sqrt((math.pow(c,2))-(math.pow(a,2)))
|
|
# Keep value for b
|
|
#c = b/math.cos(math.pi/n)
|
|
#a = math.sqrt((math.pow(c,2))-(math.pow(b,2)))
|
|
|
|
from __future__ import division
|
|
import math
|
|
from FreeCAD import Base
|
|
from PySide import QtGui, QtCore
|
|
from PySide.QtGui import QApplication, QDialog, QMainWindow
|
|
import Part
|
|
import Draft
|
|
class p():
|
|
|
|
|
|
def Ggear(self):
|
|
|
|
try:
|
|
#Inputs
|
|
a = float(self.dCr.text())
|
|
#b = float(self.gWr.text())
|
|
p = float(self.dPd.text())
|
|
t = float(self.gWt.text())
|
|
h = float(self.gWh.text())
|
|
n = float(self.gWn.text())
|
|
|
|
#Outputs
|
|
#c = math.sqrt(pow(a,2) + pow(b,2))
|
|
c = a/math.sin(math.pi/n)
|
|
b = math.sqrt((math.pow(c,2))-(math.pow(a,2)))
|
|
s = a + b - c
|
|
w = p + t
|
|
y = a - (3 * p)
|
|
z = y - t
|
|
v = (b * z)/a
|
|
m = math.sqrt((v**2)+(z**2)) # Solves for location of clearance cut axis
|
|
|
|
# Create the Drive Crank (Will be placed on the origin)
|
|
driveCrank = Part.makeCylinder(z, h)
|
|
#driveCrank.translate(Base.Vector(0,0,0))
|
|
|
|
#genevaWheelClearanceCut = Part.makeCylinder(b, h)
|
|
#genevaWheelClearanceCut.translate(Base.Vector(-c,0,0))
|
|
|
|
genevaWheelClearanceCut = Part.makeCylinder(v, h)
|
|
genevaWheelClearanceCut.translate(Base.Vector(-m,0,0))
|
|
|
|
driveCrank = driveCrank.cut(genevaWheelClearanceCut)
|
|
|
|
driveCrankBase = Part.makeCylinder((a+(2*p)), h)
|
|
driveCrankBase.translate(Base.Vector(0,0,-h))
|
|
|
|
driveCrank = driveCrank.fuse(driveCrankBase)
|
|
|
|
drivePin = Part.makeCylinder(p,h)
|
|
drivePin.translate(Base.Vector(-a,0,0))
|
|
|
|
driveCrank = driveCrank.fuse(drivePin)
|
|
|
|
# Create the Geneva Wheel (Will be placed on the x-axis on the left side)
|
|
genevaWheel = Part.makeCylinder(b,h)
|
|
genevaWheel.translate(Base.Vector(-c,0,0))
|
|
|
|
stopArc = Part.makeCylinder(y, h)
|
|
stopArc.rotate(Base.Vector(-c,0,0),Base.Vector(0,0,1),(180/n))
|
|
|
|
for i in range(int(n)):
|
|
stopArc.rotate(Base.Vector(-c,0,0),Base.Vector(0,0,1),(360/n))
|
|
genevaWheel = genevaWheel.cut(stopArc)
|
|
|
|
slotLength = Part.makeBox(s,(2*w),h)
|
|
slotLength.translate(Base.Vector(-a,-w,0))
|
|
|
|
slotRadius = Part.makeCylinder(w,h)
|
|
slotRadius.translate(Base.Vector(-a,0,0))
|
|
|
|
slot=slotLength.fuse(slotRadius)
|
|
|
|
for i in range(int(n)):
|
|
slot.rotate(Base.Vector(-c,0,0),Base.Vector(0,0,1),(360/n))
|
|
genevaWheel = genevaWheel.cut(slot)
|
|
|
|
# Display Result
|
|
|
|
Part.show(driveCrank)
|
|
Part.show(genevaWheel)
|
|
|
|
except:
|
|
FreeCAD.Console.PrintError("Unable to complete task. Please recheck your data entries.")
|
|
|
|
self.close()
|
|
|
|
def close(self):
|
|
self.dialog.hide()
|
|
|
|
def __init__(self):
|
|
self.dialog = None
|
|
|
|
self.dialog = QtGui.QDialog()
|
|
self.dialog.resize(240,100)
|
|
|
|
self.dialog.setWindowTitle("Geneva Wheel Macro")
|
|
la = QtGui.QVBoxLayout(self.dialog)
|
|
|
|
DCR = QtGui.QLabel("Drive Crank Radius ( A )")
|
|
la.addWidget(DCR)
|
|
self.dCr = QtGui.QLineEdit()
|
|
la.addWidget(self.dCr)
|
|
|
|
#GWR = QtGui.QLabel("Geneva Wheel Radius ( B )")
|
|
#la.addWidget(GWR)
|
|
#self.gWr = QtGui.QLineEdit()
|
|
#la.addWidget(self.gWr)
|
|
|
|
DPD = QtGui.QLabel("Drive Pin Radius ( C )")
|
|
la.addWidget(DPD)
|
|
self.dPd = QtGui.QLineEdit()
|
|
la.addWidget(self.dPd)
|
|
|
|
GWT = QtGui.QLabel("Geneva Wheel Tolerance ( D )")
|
|
la.addWidget(GWT)
|
|
self.gWt = QtGui.QLineEdit()
|
|
la.addWidget(self.gWt)
|
|
|
|
GWH = QtGui.QLabel("Geneva Wheel Height")
|
|
la.addWidget(GWH)
|
|
self.gWh = QtGui.QLineEdit()
|
|
la.addWidget(self.gWh)
|
|
|
|
GWN = QtGui.QLabel("Driven Slot Quantity")
|
|
la.addWidget(GWN)
|
|
self.gWn = QtGui.QLineEdit()
|
|
la.addWidget(self.gWn)
|
|
|
|
#
|
|
# - Include graphic image in dialog window -
|
|
#
|
|
# Insure that image is in the same directory as this Macro.
|
|
# Image should be available from same source as Macro.
|
|
#
|
|
|
|
import os
|
|
macro_dir = os.path.dirname(__file__)
|
|
self.PiX = QtGui.QLabel()
|
|
self.PiX.setPixmap(os.path.join(macro_dir, "GW_Dim.png"))
|
|
|
|
hbox = QtGui.QHBoxLayout()
|
|
hbox.addStretch()
|
|
hbox.addWidget(self.PiX)
|
|
hbox.addStretch()
|
|
|
|
la.addSpacing(15)
|
|
la.addLayout(hbox)
|
|
la.addSpacing(15)
|
|
|
|
# - End Image layout -
|
|
|
|
okbox = QtGui.QDialogButtonBox(self.dialog)
|
|
okbox.setOrientation(QtCore.Qt.Horizontal)
|
|
okbox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
|
la.addWidget(okbox)
|
|
QtCore.QObject.connect(okbox, QtCore.SIGNAL("accepted()"), self.Ggear)
|
|
QtCore.QObject.connect(okbox, QtCore.SIGNAL("rejected()"), self.close)
|
|
QtCore.QMetaObject.connectSlotsByName(self.dialog)
|
|
self.dialog.show()
|
|
self.dialog.exec_()
|
|
|
|
p()</pre></div>
|
|
<h2><span class="mw-headline" id="Liens">Liens</span></h2>
|
|
<p>Cette macro est la version graphique de l'original <a href="https://www.freecadweb.org/wiki/index.php?title=Macro_Geneva_Wheel/fr" title="Macro Geneva Wheel/fr">Macro Geneva Wheel</a> créé par <a href="https://www.freecadweb.org/wiki/index.php?title=User:Drei" title="User:Drei">Drei</a>
|
|
</p>
|
|
<div style="clear:both"></div>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div><div class="printfooter">
|
|
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=Macro_Geneva_Wheel_GUI/fr&oldid=289055">http://www.freecadweb.org/wiki/index.php?title=Macro_Geneva_Wheel_GUI/fr&oldid=289055</a>"</div>
|
|
<div id="catlinks" class="catlinks" data-mw="interface"></div><div class="visualClear"></div>
|
|
</div>
|
|
</div>
|
|
<div id="mw-navigation">
|
|
<h2>Navigation menu</h2>
|
|
|
|
</body></html> |