注释
合作者作者
您好,感谢您的关注,我希望您能够改进目前缺乏的文档 |
合作者作者
不幸的是,除了你可以在 github 上找到的信息,我不知道任何其他信息源。但是有一些 youtube 视频,只需在 youtube 上搜索 bCNC。我个人有计划制作关于最近添加的功能的 YouTube 视频,但我有点忙,希望我能做到。 |
嗨, |
合作者作者
这是目前bCNC项目唯一的官方沟通渠道。 |
你好, #!/usr/bin/python
# -*- coding: ascii -*-
# $Id$
from __future__ import absolute_import
from __future__ import print_function
__author__ = "JCF"
__email__ = "jean-claude.feltes@education.lu"
from math import sin, cos, pi
from CNC import CW,CNC,Block
from ToolsPage import Plugin
#==============================================================================
#
#==============================================================================
def calculate_coordinates(wrenchsize):
'''return array of (x,y) tuples for hexagon'''
a = wrenchsize/2
r = a / (cos(pi/6))
points = []
for i in range(0,7):
phi = i * pi /3
x = r * cos(phi)
y = r * sin(phi)
x= round(x, 3)
y= round(y, 3)
points.append((x, y))
return points
#==============================================================================
# Create a simple nut
#==============================================================================
class Tool(Plugin):
__doc__ = _("Generate a simple nut with given wrench size")
def __init__(self, master):
Plugin.__init__(self, master, "simpleNut")
self.icon = "lamp"
self.group = "Generator"
self.variables = [ ("name", "db", "Nut", _("Name")),
("wrench_size", "float", 10, _("wrench size in mm")),]
self.buttons.append("exe")
# ----------------------------------------------------------------------
def execute(self, app):
# get user input and calculate points for hexagon:
name = self["name"]
if not name or name =="default":
name = "Nut"
wrenchsize = self["wrench_size"]
points = calculate_coordinates(wrenchsize)
# init blocks of gcode:
blocks = []
block = Block(name)
# go G0 to first point at safe height:
block.append(CNC.zsafe())
x1, y1 = points[0]
block.append(CNC.grapid(x1, y1))
block.append("(entered)")
# go G1 for the other points
for p in points[1:]:
x, y = p
block.append(CNC.gline(x, y))
block.append("(exiting)")
# append this block of gcode
blocks.append(block)
active = app.activeBlock()
if active==0:
active=1
app.gcode.insBlocks(active, blocks, "SimpleNut")
app.refresh()
app.setStatus(_("Generated: Nut"))
它工作正常,但有一个错误:我无法为块输入名称。对我来说这不是很重要,但也许有人可以告诉我我做错了什么。 |
Dne 2020-10-14 22:10, Erik Hjertholm napsal: