#!/usr/bin/python # Copyright 2007 Chris Radek # Derived from a work by John Kasunich and Jeff Epler # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. from vismach import * import hal import math import sys c = hal.component("5stefgui") c.newpin("jointx", hal.HAL_FLOAT, hal.HAL_IN) c.newpin("jointy", hal.HAL_FLOAT, hal.HAL_IN) c.newpin("jointz", hal.HAL_FLOAT, hal.HAL_IN) c.newpin("jointa", hal.HAL_FLOAT, hal.HAL_IN) c.newpin("jointb", hal.HAL_FLOAT, hal.HAL_IN) c.ready() work = Capture() tooltip = Capture() part1 = CylinderZ(0,10, 100,30) part2 = Box (-50,-50,100,50,50,400) combinedpart = Collection ([part1,part2]) part = Collection([tooltip,combinedpart]) part = Color([0.5,0.5,0.5,1],[part]) part = Translate ([part], 0,0,-180) part = HalRotate([part],c,"jointa",1,0,-1,0) Zaxis = AsciiSTL(filename="Zaxisassembly.stl") Zaxis = Color([0.5,0.5,0.5,1],[Zaxis]) Zaxis = Rotate ([Zaxis],180, 0,1,0) Zaxis = Rotate ([Zaxis],90, 1,0,0) Zaxis = Translate ([Zaxis],177,-300,-120) Zaxis = Collection([Zaxis,part]) Zaxis = HalTranslate ([Zaxis],c,"jointz",0,0,1) Xaxis = AsciiSTL(filename="xaxisassembly.stl") Xaxis = Color([0.5,0.5,0.5,1],[Xaxis]) Xaxis = Rotate ([Xaxis],90, 1,0,0) Xaxis = Rotate ([Xaxis],180, 0,1,0) Xaxis = Translate ([Xaxis],377.5,1085,830) Xaxis = Collection([Xaxis,Zaxis]) Xaxis = HalTranslate ([Xaxis],c,"jointx",1,0,0) Yaxis = AsciiSTL(filename="yaxisassembly.stl") Yaxis = Color([0.5,0.5,0.5,1],[Yaxis]) Yaxis = Rotate ([Yaxis],-90, 0,1,0) Yaxis = Rotate ([Yaxis],-90, 1,0,0) Yaxis = Translate ([Yaxis],2250,-191,1014) Yaxis = Collection([Yaxis,Xaxis]) Yaxis = HalTranslate ([Yaxis],c,"jointy",0,1,0) Base = AsciiSTL(filename="machinebase.stl") Base = Color([0.8,0.8,0.8,2],[Base]) Base = Rotate ([Base],-90, 0,1,0) #Base = Rotate ([Base],-90, 1,0,0) Base = Translate ([Base],1601.5,200,-1268) Base = Collection([Base,Yaxis]) #Base = HalTranslate ([Yaxis],c,"jointy",0,1,0) #tool = Collection([tooltip, CylinderY(-100,75, -10,75)]) #tool = HalTranslate([tool],c,"jointx",1,0,0) table = Collection([work,Box(0,0,0, 1410,2660,30)]) table = Translate ([table],30,255,-580) Baxis = AsciiSTL(filename="BAxisForCamworks.STL") Baxis = Color([0.5,0.5,0.5,1],[Baxis]) Baxis = Rotate ([Baxis],-90, 0,1,0) Baxis = Translate ([Baxis],1500,0,-1270) Baxis = Collection([Baxis,Base]) Rotating1 = CylinderY(200,30,350,30) Rotating2 = Box(-50,350,-50,50,450,50) RotatingB = Collection ([Rotating1,Rotating2]) RotatingB = HalRotate([RotatingB],c,"jointb",1,0,1,0) RotatingB = Translate ([RotatingB], 570,300,-390) RotatingB = Color([1,1,1,1],[RotatingB]) RotatingB = Collection([RotatingB,Baxis]) #model() and main() have a certain structure you always have to use model = Collection([tooltip, RotatingB, table, work]) main(model, tooltip, work, 1500)