Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.


edward_petrilloedward_petrillo Member Posts: 78 EDU

 I would like to create a feature for generating GCode for CNC drilling a hole pattern on a part face directly from a Part Studio without the use of a conventional CAM program.
Our specific application involves fabricating frames for FIRST Robotics Competition robots and related structures from T-Slot extrusion (8020 10 series).  The frame members are joined by bolted connections that require through- or counterbored holes on one or more faces.  A typical robot assembly may include 50 or more frame member instances drawn from 20 or more unique parts.
Our current fabrication workflow involves cutting extrusion stock to length and manually drilling the holes on a DRO-equipped mill, guided by an ordinate-dimensioned Onshape part drawing of the relevant part faces. This workflow involves several wasteful steps and multiple opportunities for human error.
Migrating to a CNC fabrication method offers only limited advantages over the manual workflow.  The Onshape-connected desktop CAM programs that will accept an exported part file impose a considerable burden of learning and effort for this simple task. A DXF or other 2D image of the part face must be exported from Onshape to a CAM program, vectors or points describing the hole positions must be mapped to a toolpath for calculation, and the Gcode output saved to a file for use by the CNC. 
Most CNC controllers enable the use of “canned”  drilling methods.   The GCode block for a typical extrusion hole pattern requires only a dozen or so lines of header information specifying tool information and depth of cut and a single line for the XY coordinates of each hole.  Given the limited information needed to complete the task, using a CAM program that is equipped for a wide range of toolpath options adds considerable overhead to this simple task.
I envision a feature that would allow the Onshape user to specify an extrusion face and select the type of hole (simple, counterbore). The method would perceive the hole locations and write the Gcode header and hole positions to a text file that could be exported directly to the CNC. A useful adjunct to the hole pattern feature would be to export a Gcode block that would score the beginning and ending edges of the extrusion face as a guide to sawing the part to length.
Full disclosure:  I have extremely limited coding experience and have never attempted FeatureScript.  I would appreciate any input or critique regarding the feasibility of the above scheme and advice on the best path to follow to make it happen.


  • ShapenShapen Member Posts: 13 ✭✭
    There was an incredible proof of concept done by @Toshimichi_Oda regarding GCode being generated through FeatureScript. I don't think it will solve your specific problem, but I think it could be helpful.

  • antlu65antlu65 Member Posts: 55 EDU
    edited August 2022
    I am looking for projects to work on to improve my FeatureScript knowledge - would you be interested if I try to implement this for you at no cost?
    Admittedly, my only exposure to GCODE is through my consumer-level 3d printer. I think all I would need are a few examples of the relevant GCODE sections that typically describe your hole patterns and score marks.

    The custom feature would:
    1. Allow user to select a planar face - the reference plane for the holes
    2. Allow user to specify locations of holes (for example by selecting sketch vertices) and relevant details (counterbore, diameter, depth, etc)
    3. Allow user to specify extents of extrusion face that will receive the score marks
    3. Convert to relevant gcode for holes and score marks

    Please let me know if you might be interested.
  • edward_petrilloedward_petrillo Member Posts: 78 EDU
    @antlu65:  Your efforts would be very welcome!   In our hands the variety of hole options is extremely limited, and the drilling  cycles are therefore quite simple.  We would couple use of the proposed feature with a CNC equipped with a tool changer.  The GCode would specify the tool number, and the relevant tool parameters would be stored in the CNC controller.  Likewise, the optimum parameters for the scoring cuts, and the tool for the cuts, would be driven by the choice of 8020 profile.

    Here is a description of Gcode Drilling Cycles and here is a code block template;

    Z1.0 (Initial Z)

         X10Y12 (XY for first hole)

         G99 G81 R0.2 Z-0.7

         X10Y14 (XY for second hole)

         X10Y16 (XY for third hole)

         G80 (Cancel canned cycle)

    To run properly this block would be embedded between a boilerplate header and footer that initializes and terminate the machine.

    Finally, here is a public document that shows a typical robot frame



    Looking forward to a fruitful collaboration!

  • antlu65antlu65 Member Posts: 55 EDU
    Great, I'll send you a private message. Thanks!
Sign In or Register to comment.