Draw a circle from inside repetier

I want to draw a circle directly from repetier.
Ideal would be a command like:
moveToCircle(x,y,Radius,speed);
similiar to
moveToReal(x, y, IGNORE_COORDINATE, IGNORE_COORDINATE, Speed);

What  is the best way to make a circle??
Thanks for help!

Comments

  • Use G2/G3 commands for this.
  • Thanks for the hint, but could start the GCode in the programme.

    My first idea was: for a full circle start and endpoint is identical,
    so I have not define the points.
    I tried:
    GCode::executeFString(PSTR("G3 R5"))
    but thst one is not working.

    new idea: make 2 180deg arcs:
    eg center should be x10 Y20 Radius 3
    x=10;y=20;
    Printer::moveToReal(x-3, y, IGNORE_COORDINATE, IGNORE_COORDINATE, 500);
    GCode::executeFString(PSTR("G3 X13 Y20 R3"));
    GCode::executeFString(PSTR("G3 X7 Y20 R3"));
    //new problem how to create the PSTR with float x,y values?
    // how can I create the string??
    //does this makes sense?








  • Ok you can not create PSTR at runtime, so that is a problem. Check in commands.cpp the G2/G3 implementation. You will see that it calls the draw arc function, so in that case call it with right parameters computed.
  • Is that the right line:
    processArc(com);
    is com the Gcode string?
    eg:
    float x=10;float y=20;
    - the float to string conversion seems to be an issue as well.
    - In the forums I have seen some discussions about that....
    - besides the conversion, is that ok?
    string bef = "G3 X" + convertFloat2String(x) + " Y" + convertFloat2String(x) + " R3";
    processArc(bef);
    - is the R option enough, or do I need 2 180degrees arcs?
    Thanks for your help!



  • X,Y are target points so for 360° it is ambigous so split. 
    Parameter must be a GCode structure. Then you can set it with

    bool GCode::parseAscii(char *line,bool fromSerial)

    Do not use string! that uses dynamic memory which is very bad here as it can fragment the few remaining bytes. Use sprinf on a char array to create a string to add to gcode.


  • Thanks for your mail.
    I am not sure, if your answer does help me.
    My project is a plotter controlled by repetier.
    I want to draw randomly circles.
    So I added a function to customEventsImpl.h.
    I can create x,y positions per random function.
    Crosses are no problem with the moveToReal-function around x,y.

    bool GCode::parseAscii(char *line,bool fromSerial)
    that sounds for me as input from Serial?


     



  • parseAscii is in deed one way to parse the input but you can use it yourselg

    GCode gc;
    gc.parseAscii(yourchararray);
    processArc(gc);

    that simple.
Sign In or Register to comment.