Solidworks CAM 2.5 Axis Milling Export

I’ve been trying to make this flange (for an exhaust system, 1018 steel)
I use Solidworks for my CAD, and I have Solidworks CAM; Using the 2.5 Axis Milling it seems to work well
Solidworks Step Through Toolpath


Looks good so far, right ! (I’m still trying to figure out how to do the perimeter of the flange, but that’s regardless of the point)

Then, when I export as .nc or .txt and convert to .gcode


It shows in repetier-host like this, and when I just put the .gcode on the machine, it does that toolpath; nothing like the one in the Solidworks CAM preview.

Any help is greatly appreciated, thank you very much !!

What are you using for a post processor? The Camworks post processor puts out all kinds of code that is foreign for Marlin (assuming you are using Marlin) and Repetier may also not like it. I re-worked a post processor I found on here to clean it up. Marlin doesn’t support much of what Camworks will use (like drilling) since it is meant for more advanced machines but for pockets and 3axis it seems like it will work. I can share what I have so far but it is it un-tested to a large degree. My tool change script will likely not work for you so you would have to edit it manually or modify the post processor (or don’t change tools :wink: )

For perimeter you will need to use contour milling. If you need tabs that is the only place they can be defined. Select the bottom face to define a boss type part perimeter feature.

Thank you for the reply !
I honestly couldn’t figure it out, so I just decided to take the part and put it into Estlcam. Seemed to work fine, but I’d still be interested Solidworks CAM with my marlin setup.

I too am struggling to get SW to do some of the more simple things that Estlcam does very well. Likely because I am not a machinist, just a dumb engineer. lol. One of the challenges I have is figuring out how to “layer” the operations in SW to be able to use things like support tabs, that are only available in a 2D contour cut. i.e. machine everything except where the tabs are, then machine that area. Otherwise it just machines away the tabs. I had same trouble learning F360 as well. In Estlcam this is pretty easy even for 3D carves.

Anyway, attached is my source for the SW post processor. You can use it directly as is and the output is pretty Marlin friendly. NOTE. You cannot use any drilling features in SW CAM. It outputs codes that Marlin does not know. Also, my tool change is specific to how I do it, but it is editable (either after post or you can relatively easily edit the post processor code and recompile it with your own). Finally it relies on Marlin for rapids (G00) speed. I guess most CNCs assume this is controller based. I reset mine in the firmware (discussed here):

To use as is:

  1. Unzip to a local folder the you will use to work on the post processor.

  2. Copy the following files to C:\ProgramData\SOLIDWORKS\SOLIDWORKS CAM 2020\Posts (or equivalent for your install):
    MPCNC.ctl
    MPCNC.lng
    MPCNC.pinf (defines the output file extension)
    MPCNC_S.rtf (short description in SW CAM)
    MPCNC_L.rtf (more or long description in SW CAM)

  3. Restart SW, and in SW CAM select the post processor in the Machine Setup (note it must be a Mill-Metric and SW units have to be in mm).

Here is a sample of the output:

;
;O0001
;
; ( PART NAME=Alternate9l4_NoMag_SnapIn-LockRing )
;
G17 G21 G80
G54
G92 X0 Y0
S5000 M03
G90 G00 X46.059 Y52.946
Z28.424
G01 X46.075 Y52.985 Z25.572 F560.
X46.136 Y53.132 Z25.174
X46.237 Y53.377 Z24.837
X46.364 Y53.686 Z24.597
X46.631 Y54.333 Z24.424
X48.803 Y59.598 F700.
X50.358 Y58.982
X57.838 Y57.046
X67.33 Y54.888
X79.391 Y52.888
X93.344 Y51.523
X105.251 Y51.064
X117.138 Y51.291
X128.18 Y52.093
X134.757 Y52.962
X135.723 Y53.428
X136.471 Y54.155
X136.969 Y55.106
X137.185 Y56.442
X137.096 Y122.169
X136.976 Y122.535
X136.855 Y122.9

If you want to change anything in the post, it is best to edit it in the source file (MPCNC.src) using EC-EDIT-2 and not in UPG-2. The latter will muck around with the code layout and makes it harder to track your changes. UPG-2 can be downloaded from here: https://camworks.com/universal-post-generator/. It comes with EC-EDIT-2.

Before recompiling, make sure you set the output of UPG-2 to your chosen folder for editing the post. In UPG-2, use File-Preferences and change the CTL Path to your local folder:

and make sure you have it pointing to the Master ATR Path in your install folder:

Finally, open the MPCNC source file in EC-EDIT and verify the Library section points to the install MILL.LIB file (the one included in the zip file is a reference only) :

The only files that need to be updated after recompiling are the .ctl & .lng files. Copy those two into the SW CAM posts folder above (overwriting the previous ones). You have to restart SW to recognize the new files, or in Machine Setup dialog, select a different post (any one on list), then re-select MPCNC, then hit the Select button before closing the dialog. Big PIA.

As mentioned my tool change script is specific for me. You can edit it in the section called SUB_TOOL_CHANGE_MILL and SUB_PRELOAD_TOOL_CHANGE_MILL (I believe both need to be populated and for some reason I think it is only the latter that is called, though it shouldn’t be by definition of PRELOAD). This is what mine looks like:

:SECTION=SUB_TOOL_CHANGE_MILL
:T:<N>;=====start tool change<EOL>
:T:<N><G!:53>                             ;change to machine coordinates<EOL>
:T:<N><G:00>X25 Y25                         ;move to tool change position<EOL>
:T:<N><M:00> turn off router             ;confirm router off<EOL>
:T:<N><M:18> Z                           ;release z<EOL>
:T:<N><M:00> tool: <TOOL_COMMENT> ;confirm tool installed<EOL>
:T:<N><M:00> z-probe                     ;confirm probe is installed<EOL>
:T:<N><G:28> Z                           ;probing<EOL>
:T:<N><G:00>Z30                             ;raise off bed<EOL>
:T:<N><M:00> turn on router              ;confirm router is back on<EOL>
:T:<N><G!:work_coord>                             ;change to workpiece coordinates<EOL>

*
:SECTION=SUB_PRELOAD_TOOL_CHANGE_MILL
:T:<N>;=====start tool change<EOL>
:T:<N><G!:53>                             ;change to machine coordinates<EOL>
:T:<N><G:00>X25 Y25                         ;move to tool change position<EOL>
:T:<N><M:00> turn off router             ;confirm router off<EOL>
:T:<N><M:18> Z                           ;release z<EOL>
:T:<N><M:00> tool: <TOOL_COMMENT> ;confirm tool installed<EOL>
:T:<N><M:00> z-probe                     ;confirm probe is installed<EOL>
:T:<N><G:28> Z                           ;probing<EOL>
:T:<N><G:00>Z30                             ;raise off bed<EOL>
:T:<N><M:00> turn on router              ;confirm router is back on<EOL>
:T:<N><G!:work_coord>                             ;change to workpiece coordinates<EOL>

NOTE: Syntax matters heavily in the code. All the :T:'s,bracketed EOL’s, etc. mean something and must be correct or the post will crash. If you make changes to the file in EC-EDIT, use UPG-2 to compile only. Do not open the file in UPG-2. Under file, use the Compile Source option. Not file open (at least not until you become familiar with what UPG-2 will do to your code sections).

MPCNC_Post_230221.zip (98.4 KB)