Contact me: hankecnc@gmail.com

这在gcode中正常吗?请帮忙 #72

推推 grbl 3年前 (2023-02-09) 290次浏览
关闭
oraherb 打开了这个问题 2019 年 10 月 7 日 · 26条评论
关闭

这在gcode中正常吗?请帮忙#72

oraherb 打开了这个问题 2019 年 10 月 7 日 · 26条评论

评论

这在gcode中正常吗?请帮忙 #72

为什么我创建的 gcode 是这样的,我做错了什么吗?

这在gcode中正常吗?请帮忙 #72
作者

这个 gcode 是否正确我看不到图像我只能看到绿线??这在gcode中正常吗?请帮忙 #72

这在gcode中正常吗?请帮忙 #72
所有者

您可以单击折叠代码“+”,例如第 12 行以查看真正的 gcode。
把你的图片或图形发给我,然后我可以检查。

这在gcode中正常吗?请帮忙 #72
作者

@svenhb嘿兄弟什么都没有发生仍然像这样我的硬件没有创建那个图像它只是遵循所有那条线没有创建 fry 图像有什么问题?这在gcode中正常吗?请帮忙 #72

这在gcode中正常吗?请帮忙 #72
所有者

请截图设置-图形-导入选项卡

这在gcode中正常吗?请帮忙 #72
所有者

我没有时间看视频…
在图像窗口中,选择用例绘图仪,然后在设置图形导入中恢复您的伺服脉宽调制设置。
您在图像校正中选择的尺寸和分辨率是多少?

这在gcode中正常吗?请帮忙 #72
作者

这是路径导入这在gcode中正常吗?请帮忙 #72

这在gcode中正常吗?请帮忙 #72
作者

继承人g代码生成
这在gcode中正常吗?请帮忙 #72

这在gcode中正常吗?请帮忙 #72
作者

这里g代码修改
这在gcode中正常吗?请帮忙 #72

这在gcode中正常吗?请帮忙 #72
作者

用例
这在gcode中正常吗?请帮忙 #72

这在gcode中正常吗?请帮忙 #72
所有者

您应该关闭所有复选框,但至少要关闭标记的:
这在gcode中正常吗?请帮忙 #72

这在gcode中正常吗?请帮忙 #72
所有者

我会使用这个设置:
这在gcode中正常吗?请帮忙 #72

这在gcode中正常吗?请帮忙 #72
作者

@svenhb兄弟,你知道我可以阅读和理解 gbrl 绘图仪程序的所有设置和值的网站吗?

这在gcode中正常吗?请帮忙 #72
所有者

我认为大多数复选框都是不言自明的……
也许我可以根据您的问题制作一本手册……
您不了解哪个设置?

这在gcode中正常吗?请帮忙 #72
作者
草药 评论了 2019 年 10 月 8 日  

@svenhb兄弟,它可以工作,但我使用修改过的 grbl,我用 L293D IC 替换了 drv8825 我不满意,因为我没有学习如何使 gbrl 绘图仪工作良好,我必须学习它才能满意
这在gcode中正常吗?请帮忙 #72

这在gcode中正常吗?请帮忙 #72
所有者

这个图是用grbl-plotter画的吗?所以最后你让它工作 – 非常好!
是的,硬件可能很棘手,也许驱动程序的电源太弱了?也许“step/mm”的错误计算和微步的错误计算,在驱动程序中设置……
它也应该与 drv8825 一起工作。

这在gcode中正常吗?请帮忙 #72 svenhb 添加了 问题 标签 2019 年 10 月 9 日
这在gcode中正常吗?请帮忙 #72
作者

@svenhb 嘿,兄弟,是的,是我的绘图员在上面的图片中画了那幅画,但我必须使用这个修改过的 gbrl 来让它工作并处理 t3 来发送 gcode

#include <伺服.h>
#include <步进器.h>

#define LINE_BUFFER_LENGTH 512

const int penZUp = 80;
const int penZDown = 40;

const int penServoPin = 6;

const int stepsPerRevolution = 20;

伺服笔伺服;

步进器 myStepperY(stepsPerRevolution, 2,3,4,5);
步进器 myStepperX(stepsPerRevolution, 8,9,10,11);

结构点 {
浮动 x;
浮动y;
浮动z;
};

结构点 actuatorPos;

浮动 StepInc = 1;
int 步延迟 = 0;
int 线延迟 = 50;
int penDelay = 50;

浮动 StepsPerMillimeterX = 6.0;
浮动 StepsPerMillimeterY = 6.0;

浮动 Xmin = 0;
浮动 Xmax = 40;
浮动 Ymin = 0;
浮动 Ymax = 40;
浮动 Zmin = 0;
浮动 Zmax = 1;

浮动 Xpos = Xmin;
浮动 Ypos = Ymin;
浮动 Zpos = Zmax;

布尔详细=假;

void setup() {
Serial.begin( 9600 );

penServo.attach(penServoPin);
penServo.write(penZUp);
延迟(200);

myStepperX.setSpeed(250);
myStepperY.setSpeed(250);

Serial.println(“迷你 CNC 绘图仪活灵活现!”);
Serial.print(“X范围来自”);
串行打印(Xmin);
Serial.print(” 到 “);
串行打印(Xmax);
Serial.println(” mm.”);
Serial.print(“Y范围从”);
串行打印(Ymin);
Serial.print(” 到 “);
串行打印(Ymax);
Serial.println(” mm.”);
}

void loop()
{
延迟(200);
字符行[ LINE_BUFFER_LENGTH ];
字符 c;
int 行索引;
bool lineIsComment, lineSemiColon;

行索引 = 0;
lineSemiColon = false;
lineIsComment = false;

而 (1) {

while ( Serial.available()>0 ) {
  c = Serial.read();
  if (( c == '\n') || (c == '\r') ) {             
    if ( lineIndex > 0 ) {                        
      line[ lineIndex ] = '\0';                   
      if (verbose) { 
        Serial.print( "Received : "); 
        Serial.println( line ); 
      }
      processIncomingLine( line, lineIndex );
      lineIndex = 0;
    } 
    else { 
      
    }
    lineIsComment = false;
    lineSemiColon = false;
    Serial.println("ok");    
  } 
  else {
    if ( (lineIsComment) || (lineSemiColon) ) {   // Throw away all comment characters
      if ( c == ')' )  lineIsComment = false;     // End of comment. Resume line.
    } 
    else {
      if ( c <= ' ' ) {                           // Throw away whitepace and control characters
      } 
      else if ( c == '/' ) {                    // Block delete not supported. Ignore character.
      } 
      else if ( c == '(' ) {                    // Enable comments flag and ignore all characters until ')' or EOL.
        lineIsComment = true;
      } 
      else if ( c == ';' ) {
        lineSemiColon = true;
      } 
      else if ( lineIndex >= LINE_BUFFER_LENGTH-1 ) {
        Serial.println( "ERROR - lineBuffer overflow" );
        lineIsComment = false;
        lineSemiColon = false;
      } 
      else if ( c >= 'a' && c <= 'z' ) {        // Upcase lowercase
        line[ lineIndex++ ] = c-'a'+'A';
      } 
      else {
        line[ lineIndex++ ] = c;
      }
    }
  }
}

}
}

void processIncomingLine( char* line, int charNB ) {
int currentIndex = 0;
字符缓冲区[ 64 ];// 希望 64 够 1 个参数
struct point newPos;

newPos.x = 0.0;
newPos.y = 0.0;

// 需要解释
// G1 用于移动
// G4 P300(等待 150 毫秒)
// G1 X60 Y30
// G1 X30 Y50
// M300 S30(下笔)
// M300 S50(上笔)
// 丢弃带有 a 的任何内容(
// 丢弃任何其他命令!

while( currentIndex < charNB ) {
switch ( line[ currentIndex++ ] ) { // 选择命令,如果有
‘U’:
penUp();
休息;
案例’D’:
penDown();
休息;
case ‘G’:
buffer[0] = line[ currentIndex++ ]; // /!\ Dirty – 仅适用于 2 位数字命令
// buffer[1] = line[ currentIndex++ ];
// 缓冲区[2] = ‘\0’;
缓冲区[1] = ‘\0’;

  switch ( atoi( buffer ) ){                   // Select G command
  case 0:                                   // G00 & G01 - Movement or fast movement. Same here
  case 1:
    // /!\ Dirty - Suppose that X is before Y
    char* indexX = strchr( line+currentIndex, 'X' );  // Get X/Y position in the string (if any)
    char* indexY = strchr( line+currentIndex, 'Y' );
    if ( indexY <= 0 ) {
      newPos.x = atof( indexX + 1); 
      newPos.y = actuatorPos.y;
    } 
    else if ( indexX <= 0 ) {
      newPos.y = atof( indexY + 1);
      newPos.x = actuatorPos.x;
    } 
    else {
      newPos.y = atof( indexY + 1);
      indexY = '\0';
      newPos.x = atof( indexX + 1);
    }
    drawLine(newPos.x, newPos.y );
    //        Serial.println("ok");
    actuatorPos.x = newPos.x;
    actuatorPos.y = newPos.y;
    break;
  }
  break;
case 'M':
  buffer[0] = line[ currentIndex++ ];        // /!\ Dirty - Only works with 3 digit commands
  buffer[1] = line[ currentIndex++ ];
  buffer[2] = line[ currentIndex++ ];
  buffer[3] = '\0';
  switch ( atoi( buffer ) ){
  case 300:
    {
      char* indexS = strchr( line+currentIndex, 'S' );
      float Spos = atof( indexS + 1);
      //          Serial.println("ok");
      if (Spos == 30) { 
        penDown(); 
      }
      if (Spos == 50) { 
        penUp(); 
      }
      break;
    }
  case 114:                                // M114 - Repport position
    Serial.print( "Absolute position : X = " );
    Serial.print( actuatorPos.x );
    Serial.print( "  -  Y = " );
    Serial.println( actuatorPos.y );
    break;
  default:
    Serial.print( "Command not recognized : M");
    Serial.println( buffer );
  }
}

}

}

void drawLine(float x1, float y1) {

如果(详细)
{
Serial.print(“fx1,fy1:”);
串行打印(x1);
序列号.print(“,”);
串行打印(y1);
序列号.println(“”);
}

如果 (x1 >= Xmax) {
x1 = Xmax;
}
如果 (x1 <= Xmin) {
x1 = Xmin;
}
如果 (y1 >= Ymax) {
y1 = Ymax;
}
如果 (y1 <= Ymin) {
y1 = Ymin;
}

如果(详细)
{
Serial.print(“Xpos,Ypos:”);
串行打印(Xpos);
序列号.print(“,”);
串行打印(Ypos);
序列号.println(“”);
}

如果(详细)
{
Serial.print(“x1, y1:”);
串行打印(x1);
序列号.print(“,”);
串行打印(y1);
序列号.println(“”);
}

// 将坐标转换为步
数 x1 = (int)(x1 StepsPerMillimeterX);
y1 = (int)(y1
 StepsPerMillimeterY);
浮动 x0 = Xpos;
浮动 y0 = Ypos;

// 让我们找出坐标的变化
long dx = abs(x1-x0);
长 dy = abs(y1-y0);
int sx = x0<x1 ? 步骤公司:-步骤公司;
int sy = y0<y1 ? 步骤公司:-步骤公司;

长我;
长过= 0;

如果 (dx > dy) {
for (i=0; i<dx; ++i) {
myStepperX.step(sx);
超过+=dy;
if (over>=dx) {
over-=dx;
myStepperY.step(sy);
}
延迟(StepDelay);
}
}
else {
for (i=0; i<dy; ++i) {
myStepperY.step(sy);
超过+=dx;
if (over>=dy) {
over-=dy;
myStepperX.step(sx);
}
延迟(StepDelay);
}
}

如果(详细)
{
Serial.print(“dx, dy:”);
串行打印(dx);
序列号.print(“,”);
串行打印(dy);
序列号.println(“”);
}

如果(详细)
{
Serial.print(“Going to (“);
Serial.print(x0);
Serial.print(“,”);
Serial.print(y0);
Serial.println(“)”);
}

延迟(线延迟);

Xpos = x1;
Ypos = y1;
}

void penUp() {
penServo.write(penZUp);
延迟(线延迟);
Zpos=Zmax;
如果(详细){
Serial.println(“起笔!”);
}
}
void penDown() {
penServo.write(penZDown);
延迟(线延迟);
Zpos=Zmin;
如果(详细){
Serial.println(“落笔。”);
}
}

这在gcode中正常吗?请帮忙 #72
作者
草药 评论了 2019 年 10 月 9 日  

@svenhb 兄弟,你能帮我解决这个问题吗?我怎样才能将这个 gcode 设置为 0 位置,因为我的绘图仪需要运行很远才能开始绘图
这在gcode中正常吗?请帮忙 #72

这在gcode中正常吗?请帮忙 #72
所有者

只需单击此处并应用偏移量
这在gcode中正常吗?请帮忙 #72

这在gcode中正常吗?请帮忙 #72
作者

@svenhb兄弟,除了 inkscape 和 gbrl 绘图仪或画架,我有什么方法可以生成 gcode 我的意思是笔式绘图仪的 gcode 有笔上下

这在gcode中正常吗?请帮忙 #72
所有者

除了 inkscape 和 gbrl plotter 之外,还有什么方法可以生成 gcode
不知道,你问过谷歌了吗?
GRBL-Plotter 可以从 SVG、DXF、图像、钻孔文件生成用于上笔/下笔的 GCode。你还需要什么?
或者您正在寻找模板?您是否检查了设置 – WWW 链接?我列出了一些来源…

这在gcode中正常吗?请帮忙 #72
作者

因为 gbrl 绘图仪不起作用我使用处理 t3 将 gcode 发送到 arduino 我尝试在 gbrl 绘图仪中制作 gcode 然后导出 gcode 并在处理 T3 中打开它但是它不起作用我尝试 inkscape 它也不起作用这就是为什么我试图找到一些东西这将适用于我使用的修改后的 gbrl 兄弟

这在gcode中正常吗?请帮忙 #72
所有者

很复杂…为什么不使用GRBL-Plotter发送代码呢?
使用像https://github.com/svenhb/GRBL-Plotter/blob/master/grbl_v1.1f_Servo.hex
这样的“普通”grbl 固件 我用我的 egg-bot 测试了它 – 它可以工作……

这在gcode中正常吗?请帮忙 #72
作者

@svenhb因为我使用的是 L293D ic,所以我在使用 L293D 的设置中尝试了普通的 grbl 固件,但它不起作用,没有来自我的 x 和 y 的反馈,这就是为什么我使用修改过的 grbl 所以是的

这在gcode中正常吗?请帮忙 #72
作者
草药 评论了 2019 年 10 月 11 日  

@svenhb兄弟,我可以在这个 grbl 固件中问(https://github.com/svenhb/GRBL-Plotter/blob/master/grbl_v1.1f_Servo.hex )arduino 和伺服脉冲中 X 轴和 Y 轴的数字输入引脚是什么, ,……因为在L293D ic im中使用4个数字引脚输入x轴的2,3,4,5和8,9,10,11数字引脚Y轴并使用数字引脚6进行伺服脉冲触发.. 如果我知道 x 和 y 的正确引脚是什么,我可以将 adruino 数字引脚重新连接到 L293D ic,以便对我的 x 和 y 进行反馈“我不是专家,我还在学习兄弟”

这在gcode中正常吗?请帮忙 #72
所有者

我提到的 grbl 版本对 A4988(或类似)驱动程序使用 step 和 dir 信号。
为什么要使用 L293(它不是很过时吗?),当您可以以 10 欧元的价格获得 µC 和驱动程序时 – 只需在 ebay 上查看“Uno-R3 CNC-V3-0-shield-4x-A4988”

这在gcode中正常吗?请帮忙 #72
所有者

我认为问题得到了回答。