Macro Assemblage Imprimante 3D/fr: Difference between revisions

From FreeCAD Documentation
(Created page with "Simulation de mouvement d'une imprimante 3D dans l'axe Z.")
(Created page with "==Utilisation== Téléchargez le fichier et ouvrez le dans FreeCAD")
Line 4: Line 4:


[[File:Assemblage Imprimante 3D.gif|left]]{{clear}}
[[File:Assemblage Imprimante 3D.gif|left]]{{clear}}
==Uses==
==Utilisation==
Download the file and open it in FreeCAD
Téléchargez le fichier et ouvrez le dans FreeCAD


Copy the macro and paste in the console Python and anjoy
Copy the macro and paste in the console Python and anjoy

Revision as of 09:21, 26 September 2016

File:Text-x-python Macro_Assemblage_Imprimante_3D

Description
Simulates the motion of a 3D printer in the Z axis..

Version macro : 1.0
Auteur: fran6t
Auteur
fran6t
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 mouvement d'une imprimante 3D dans l'axe Z.

Utilisation

Téléchargez le fichier et ouvrez le dans FreeCAD

Copy the macro and paste in the console Python and anjoy

To stop the animation tip :

animation.stop()

The File

00_assemblage_total.fcstd

Script

The script author is Javier Martínez García (JMG) and has been adapted for this project.

00-assemblage-total.FCMacro

# Mouvement va et vient du chariot et tete selon axe Z
#
# Pour arreter l'animation il faut taper animation.stop() dans la console

__author__ = "Javier Martínez García"

import FreeCAD as App, FreeCADGui as Gui, Part, time, sys, math, Draft, DraftGeomUtils

try:
    from PyQt4 import QtGui,QtCore
except Exception:
    from PySide import QtGui,QtCore

class Animation(object):
   def __init__(self):
      App.Console.PrintMessage('init')
      App.ActiveDocument.recompute()
      self.timer = QtCore.QTimer()
      QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.my_update)
      self.timer.start(50)

      self.an = 0
      self.Tige_Guide_X = 142
      self.X_End_Tendeur = 90
      self.X_Chariot = 102
      self.Nema_17_motor_X = 119
      self.Anti_Backslash_Z_Gauche = 88
      self.Jhead_droite = 126.5
      self.enstopX = 168
      self.sens = 1

   def my_update(self):
      if ( self.an == 0 ) :
         self.sens = 1
      if ( self.an == 245 ) :
         self.sens = -1
      self.an = self.an + self.sens
      self.Tige_Guide_X = self.Tige_Guide_X + self.sens
      self.X_End_Tendeur = self.X_End_Tendeur + self.sens
      self.X_Chariot = self.X_Chariot + self.sens
      self.Nema_17_motor_X = self.Nema_17_motor_X + self.sens
      self.Jhead_droite = self.Jhead_droite + self.sens
      self.Anti_Backslash_Z_Gauche = self.Anti_Backslash_Z_Gauche + self.sens
      self.enstopX = self.enstopX + self.sens

      #12-X-End-Moteur
      #FreeCAD.getDocument("_0_assemblage_total").getObject("Pocket013").Placement = App.Placement(App.Vector(-133,0,self.an),App.Rotation(App.Vector(0,0,1),0))
      FreeCAD.getDocument("_0_assemblage_total").getObject("refine002").Placement = App.Placement(App.Vector(0,0,self.an),App.Rotation(App.Vector(0,0,1),0))      
      #Tige-Guide-X      
      FreeCAD.getDocument("_0_assemblage_total").getObject("Pad025").Placement = App.Placement(App.Vector(-180,13.55,self.Tige_Guide_X),App.Rotation(App.Vector(0.57735,0.57735,0.57735),120))
      #14-X-End-Tendeur      
      FreeCAD.getDocument("_0_assemblage_total").getObject("Pocket011").Placement = App.Placement(App.Vector(236,0,self.X_End_Tendeur),App.Rotation(App.Vector(0,0,1),0))
      #13-X-Chariot
      FreeCAD.getDocument("_0_assemblage_total").getObject("Pocket014").Placement = App.Placement(App.Vector(-18,25,self.X_Chariot),App.Rotation(App.Vector(1,0,0),90))
      #Nema-17-motor-X
      FreeCAD.getDocument("_0_assemblage_total").getObject("Chamfer003").Placement = App.Placement(App.Vector(-205.2,63,self.Nema_17_motor_X),App.Rotation(App.Vector(1,0,0),90))
      #15-Anti-Backslash-Z-x2-1
      FreeCAD.getDocument("_0_assemblage_total").getObject("Pad012").Placement = App.Placement(App.Vector(-156,-15,self.Anti_Backslash_Z_Gauche),App.Rotation(App.Vector(0.999985,0.00555547,0),180))
      #Jhead-Droite
      FreeCAD.getDocument("_0_assemblage_total").getObject("Pocket015").Placement = App.Placement(App.Vector(-50.8,-4.4,self.Jhead_droite),App.Rotation(App.Vector(0,0,1),0))
      #Endstop X
      FreeCAD.getDocument("_0_assemblage_total").getObject("refine003").Placement = App.Placement(App.Vector(-154.2,15,self.enstopX),App.Rotation(App.Vector(0.57735,0.57735,-0.57735),120))
   def stop(self):
      self.timer.stop()     

animation = Animation()

Link

The forum discussion page: Je galere pour tourner une piece

The Youtube channel of the macro author FreeCAD: Gear Animation Tutorial and its blog

Other languages: