Macro Assemblage Imprimante 3D/it


Text-x-python.png Macro_Assemblage_Imprimante_3D

Descrizione
Simula il movimento di una stampante 3D sull'asse Z.
Autore
fran6t
Link
Esempi di macro
Come installare le Macro
Personalizzare la barra degli strumenti
Versione
1.0
Data ultima modifica
2015-07-13


Simula il movimento di una stampante 3D sull'asse Z

Assemblage Imprimante 3D.gif

Uso

Scaricare il file e aprirlo in FreeCAD

Copiare la macro e incollarla nella console Python

Per interrompere l'animazione digitare:

animation.stop() 

Il File

00_assemblage_total.fcstd

Script

L'autore dello script che è stato adottato per questo progetto è Javier Martínez García (JMG).

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

La pagina della discussione nel forum: Je galere pour tourner une piece

Il canale Youtube dell'autore della macro FreeCAD: Gear Animation Tutorial e il suo blog

Online version: "http://www.freecadweb.org/wiki/index.php?title=Macro_Assemblage_Imprimante_3D/it&oldid=240005"

Navigation menu