blender + reprap March 14, 2011 09:19AM |
Registered: 14 years ago Posts: 40 |
Re: blender + reprap March 14, 2011 11:19AM |
Registered: 14 years ago Posts: 40 |
Re: blender + reprap March 14, 2011 01:59PM |
Registered: 13 years ago Posts: 69 |
Re: blender + reprap March 14, 2011 02:11PM |
Registered: 14 years ago Posts: 40 |
Re: blender + reprap March 14, 2011 02:29PM |
Registered: 13 years ago Posts: 69 |
Re: blender + reprap March 14, 2011 02:46PM |
Registered: 14 years ago Posts: 40 |
Re: blender + reprap March 15, 2011 04:05PM |
Registered: 13 years ago Posts: 65 |
Re: blender + reprap March 15, 2011 05:44PM |
Registered: 14 years ago Posts: 40 |
Re: blender + reprap March 18, 2011 01:51AM |
Registered: 13 years ago Posts: 69 |
Re: blender + reprap March 27, 2011 09:00AM |
Registered: 14 years ago Posts: 40 |
Re: blender + reprap February 20, 2013 04:48AM |
Re: blender + reprap February 20, 2013 05:14AM |
Registered: 14 years ago Posts: 40 |
Re: blender + reprap May 12, 2013 03:49PM |
Registered: 13 years ago Posts: 69 |
Re: blender + reprap May 13, 2013 02:59PM |
Registered: 14 years ago Posts: 40 |
Re: blender + reprap May 28, 2013 02:24PM |
Registered: 14 years ago Posts: 40 |
# ##### BEGIN GPL LICENSE BLOCK ##### # # 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. # # ##### END GPL LICENSE BLOCK ##### bl_info = { 'name': 'GRBL', 'author': 'Russia_RepRap_User_Group [forums.reprap.org]', "version": (0, 0, 1), "blender": (2, 6, 7), "location": "Properties > render", "description": "GRBL g-code sender", "warning": "there is no warranty .. by now", "wiki_url": "http://forums.reprap.org/read.php?54,76841", "tracker_url": "", "category": "Scene"} if "bpy" in locals(): import imp imp.reload(serial) else: from . import serial import bpy #import math #import time #import sys from bpy.props import * ser = serial.Serial() # Definitions bpy.types.Scene.serial_lmc = StringProperty( name="Serial Port", description="Serial port connection", default="/dev/ttyACM0", maxlen=20) bpy.types.Scene.connected = BoolProperty( name="Connected", description="Connected to Serial", options = {'SKIP_SAVE'}, default=False) bpy.types.Scene.s_baud = EnumProperty( items = [('9600', '9600', '9600'), ('19200', '19200', '19200'), ('38400', '38400', '38400'), ('57600', '57600', '57600'), ('115200', '115200', '115200')], name = "Baudrate") bpy.types.Scene.XY_go = FloatProperty( name = "XY", default = 5, min = 0, max = 10) bpy.types.Scene.Z_go = FloatProperty( name = "Z", default = 5, min = 0, max = 10) bpy.types.Scene.sendtoser = StringProperty( name="Send To Port", description="Send string to port", default="", maxlen=20) # GUI class OBJECT_OT_grblPanel(bpy.types.Panel): bl_label = "grbl g-code sender" bl_idname = "grbl" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "render" def draw(self, context): layout = self.layout col = layout.column() #col.label(text="g-code sender") col.prop(context.scene, "serial_lmc") layout.prop(context.scene, "s_baud") row = layout.row() row.operator("connect.grbl") row.operator("disconnect.grbl") supercolumn = col.column() if (not bpy.context.scene.connected): supercolumn.enabled=False layout.label("JOG") row = layout.row() row.prop(context.scene, "sendtoser") row.operator("my.button", text="Send").number=13 row = layout.row() row.prop(context.scene, "XY_go") row.prop(context.scene, "Z_go") #row = layout.row() #box = row.box() #box.label("JOG") #box.operator("my.button", text="1").number=1 #box.operator("my.button", text="2").number=2 #box.operator("my.button", text="3").number=3 row = layout.row() split = row.split() col = split.column() col.operator("my.button", text="1").number=1 col.operator("my.button", text="X-").number=2 col.operator("my.button", text="3").number=3 #split = split.split(percentage=0.18) col = split.column() col.operator("my.button", text="+Y").number=4 col.operator("my.button", text="home").number=5 col.operator("my.button", text="-Y").number=6 #split = split.split(percentage=0.24) col = split.column() col.operator("my.button", text="7").number=7 col.operator("my.button", text="+X").number=8 col.operator("my.button", text="9").number=9 #split = split.split(percentage=0.28) col = split.column() col.operator("my.button", text="+Z").number=10 col.operator("my.button", text="0Z").number=11 col.operator("my.button", text="-Z").number=12 class OBJECT_OT_connectgrbl(bpy.types.Operator): # connect serial bl_idname = "connect.grbl" #name used to refer to this operator bl_label = "Connect" #operator's label bl_description = "Connect with the rig via Serial" #tooltip def invoke(self, context, event): import bpy if (ser.isOpen()): self.report({'INFO'}, "Connection alrady open, nothing to do") return {"FINISHED"} #ser.baudrate = 115200 ser.baudrate = bpy.context.scene.s_baud ser.port = 0 ser.portstr = bpy.context.scene.serial_lmc ser.timeout = 0 ser.writeTimeout = 1 try: ser.open() except: pass if (ser.isOpen()): bpy.context.scene.connected=True self.report({'INFO'}, "Connected") print(ser.baudrate) else: bpy.context.scene.connected=False self.report({'WARNING'}, "Connection fail") return{"FINISHED"} class OBJECT_OT_disconnectgrbl(bpy.types.Operator): bl_idname = "disconnect.grbl" #name used to refer to this operator bl_label = "Disconnect" #operator's label bl_description = "Disconnect Serial" #tooltip def invoke(self, context, event): import bpy ser.close() if (not ser.isOpen()): bpy.context.scene.connected=False self.report({'INFO'}, "Connection terminated") else: bpy.context.scene.connected=True self.report({'WARNING'}, "The connection is still open!! :O") return{"FINISHED"} class OBJECT_OT_Button(bpy.types.Operator): bl_idname = "my.button" bl_label = "Button" number = bpy.props.IntProperty() row = bpy.props.IntProperty() loc = bpy.props.StringProperty() def execute(self, context): if self.loc: words = self.loc.split() self.row = int(words[0]) self.number = int(words[1]) print("Row %d button %d" % (self.row, self.number)) return{'FINISHED'} def register(): bpy.utils.register_module(__name__) try: bpy.utils.unregister_class(bpy.types.RENDER_PT_render) bpy.utils.unregister_class(bpy.types.RENDER_PT_dimensions) bpy.utils.unregister_class(bpy.types.RENDER_PT_antialiasing) bpy.utils.unregister_class(bpy.types.RENDER_PT_motion_blur) bpy.utils.unregister_class(bpy.types.RENDER_PT_shading) bpy.utils.unregister_class(bpy.types.RENDER_PT_performance) bpy.utils.unregister_class(bpy.types.RENDER_PT_post_processing) bpy.utils.unregister_class(bpy.types.RENDER_PT_stamp) bpy.utils.unregister_class(bpy.types.RENDER_PT_output) bpy.utils.unregister_class(bpy.types.RENDER_PT_bake) bpy.utils.unregister_class(bpy.types.RENDER_PT_freestyle) except: pass; def unregister(): bpy.utils.unregister_module(__name__) pass if __name__ == "__main__": register()
Re: blender + reprap April 16, 2015 06:03PM |
Registered: 14 years ago Posts: 40 |
Re: blender + reprap April 19, 2015 03:21AM |
Registered: 14 years ago Posts: 40 |