Welcome! Log In Create A New Profile

Advanced

Creating a new workspace plane

Posted by hajiarab 
Creating a new workspace plane
January 13, 2024 06:44PM
How can I create a workspace plane named YU, and use stepper motors Y and U to draw a circle on this workspace?

Edited 1 time(s). Last edit at 01/13/2024 06:53PM by hajiarab.
Re: Creating a new workspace plane
January 14, 2024 12:50AM
Marlin does as it is told via gcodes

You would need to write a program to generate the required sequence of gcodes

Edited 1 time(s). Last edit at 01/14/2024 01:30AM by Dust.
Re: Creating a new workspace plane
January 14, 2024 02:06AM
I kindly request your guidance on how to accomplish this task. I am very grateful for your assistance and guidance.
Re: Creating a new workspace plane
January 15, 2024 09:50AM
My goal is to use the I_AXIS motor instead of the X_AXIS motor in some cases for drawing a circle. To achieve this, I decided to create a new workspace and generate new G-code. Then, by changing the workspace, I determine which motor plays a role in drawing the circle. For this purpose, I edited the following files.

--------***G17-G19.cpp***------------

inline void report_workspace_plane() {
  SERIAL_ECHO_START();
  SERIAL_ECHOPGM("Workspace Plane ");
  SERIAL_ECHOF(
      gcode.workspace_plane == GcodeSuite:: PLANE_UY ? F("UY\n") //add
    : gcode.workspace_plane == GcodeSuite:: PLANE_YZ ? F("YZ\n")
    : gcode.workspace_plane == GcodeSuite:: PLANE_ZX ? F("ZX\n")
                                                    : F("XY\n")
  );
}
...
/**
 * G17: Select Plane XY
 * G18: Select Plane ZX
 * G19: Select Plane YZ
 */
void GcodeSuite::G17() { set_workspace_plane(PLANE_XY); }
void GcodeSuite::G18() { set_workspace_plane(PLANE_ZX); }
void GcodeSuite::G19() { set_workspace_plane(PLANE_YZ); }
void GcodeSuite::G1700() { set_workspace_plane(PLANE_UY); } //add

#endif // CNC_WORKSPACE_PLANES


You've named the new workspace "UY"
-----------------

--------***G17-G19.cpp***------------

#if ENABLED(CNC_WORKSPACE_PLANES)
        case 17: G17(); break;                                    // G17: Select Plane XY
        case 1700: G1700(); break;                                // G1700: Select Plane UY //add
        case 18: G18(); break;                                    // G18: Select Plane ZX
        case 19: G19(); break;                                    // G19: Select Plane YZ
      #endif


You've named the new G code "G1700"
--------------------------------------

--------***G17-G19.h***------------

#if ENABLED(CNC_WORKSPACE_PLANES)
    static void G17();
    static void G1700();	//add
    static void G18();
    static void G19();
#endif


--------------------------------------
--------***G2-G3.cpp***------------

...
  #if ENABLED(CNC_WORKSPACE_PLANES)
    AxisEnum axis_p, axis_q, axis_l;
    switch (gcode.workspace_plane) {
      default:
      case GcodeSuite:: PLANE_XY: axis_p = X_AXIS; axis_q = Y_AXIS; axis_l = Z_AXIS; break;
      case GcodeSuite:: PLANE_YZ: axis_p = Y_AXIS; axis_q = Z_AXIS; axis_l = X_AXIS; break;
      case GcodeSuite:: PLANE_ZX: axis_p = Z_AXIS; axis_q = X_AXIS; axis_l = Y_AXIS; break;
      case GcodeSuite:: PLANE_UY: axis_p = I_AXIS; axis_q = Y_AXIS; axis_l = Z_AXIS; break; //add
    }
  #else
...
      #if ENABLED(CNC_WORKSPACE_PLANES)
        char achar, bchar;
        switch (workspace_plane) {
          default:
          case GcodeSuite:: PLANE_XY: achar = 'I'; bchar = 'J'; break;
          case GcodeSuite:: PLANE_YZ: achar = 'J'; bchar = 'K'; break;
          case GcodeSuite:: PLANE_ZX: achar = 'K'; bchar = 'I'; break;
          case GcodeSuite:: PLANE_UY: achar = 'i'; bchar = 'J'; break; 	//add
        }
      #else


********************
However, I encountered the following issue:
When I execute the following code:


G28
G1 Y0 X50 Z50 U50
G91
G1700
G2 I10 J10 P3



Where U represents the I_AXIS,
Initially, the X-axis moves involuntarily and returns to home, then goes to point 50, after which the Y and U axes start drawing a circle.
How can I prevent the unwanted movement of the X-axis? I've created a new workspace and replaced the X-axis motor with a new one so that by selecting this workspace, the new motor moves instead of the X-axis.
Sorry, only registered users may post in this forum.

Click here to login