How selection planes work ?

Here's the place for discussion related to CAM/CNC and the development of the Path module.
gdo35
Posts: 189
Joined: Wed Jan 25, 2012 7:25 pm

Re: How selection planes work ?

Post by gdo35 »

We absolutely need to build a rotation/translation tool to establish a 'work coordinate system' for the job but the operations will still operate in the XY plane with Z+ as 'up'.
That's what make sense to me.
Joneb
Posts: 42
Joined: Tue Aug 11, 2020 10:35 am

Re: How selection planes work ?

Post by Joneb »

Hi All
I am using a hot wire cutter on my cnc mill and would like to produce gcode in the YZ plane using G19 can it be done, the method I have been using is to change all the X to Ys and Y to Zs which is a bit cumbersome is there a easier way.

https://youtu.be/UIS5F95u8u4

OS: Windows 10 (10.0)
Word size of FreeCAD: 64-bit
Version: 0.20.25844 (Git)
Build type: Release
Branch: master
Hash: 1b20118dfa3fb9f127f0e4fb122701f7fcdaa9fc
Python version: 3.8.12
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: English/United Kingdom (en_GB)
User avatar
sliptonic
Veteran
Posts: 2966
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: How selection planes work ?

Post by sliptonic »

If you really want to work that way, it should be pretty easy to write a custom postprocessor to do the axis substitution for you. It won't be ideal.

Path really can't do this kind of toolpath yet. You might go looking for dedicated 4 axis foam cutting software. This is one. https://www.jedicut.com/en/
Joneb
Posts: 42
Joined: Tue Aug 11, 2020 10:35 am

Re: How selection planes work ?

Post by Joneb »

Thankyou Sliptonic for your reply, I didn't really want to learn another program I've been using freecad since .14 and only use foam cutting very occasionally.
I looked at writing a new post processor but couldn't really understand how to go about it, so with the help of python tutorials on youtube and google I wrote a script to do the job. I must say mainly out of interest.
If it is of any use to anyone its at https://github.com/joneb1/GCode-Axis-changer-XY-to-YZ
This is my first time writing a python script and using Git hub so bare with me any coments gratefully received
Regards
John
User avatar
sliptonic
Veteran
Posts: 2966
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: How selection planes work ?

Post by sliptonic »

Joneb wrote: Sun Jul 10, 2022 9:39 am I looked at writing a new post processor but couldn't really understand how to go about it, so with the help of python tutorials on youtube and google I wrote a script to do the job. I must say mainly out of interest.
If it is of any use to anyone its at https://github.com/joneb1/GCode-Axis-changer-XY-to-YZ
This is my first time writing a python script and using Git hub so bare with me any coments gratefully received
Awesome! There's no better way to learn than to jump in.

I haven't done a thorough review of the script but I can offer a couple comments:

Rather than explicitly opening and closing files, use the 'with' context manager.
As you have it written, there's logic between when the file is opened and when it's explicitly closed. If something unexpected happens, the file will be left open. Also, if someone works on the code later, they could change the flow and cause the same problem. Using the 'with' means the file is automatically closed when it goes out of scope.

You're doing a lot of work to read and write to disk. Probably not necessary. Reading/writing to disk is orders of magnitude slower than RAM and RAM is slower than cache. Unless you KNOW you're going to be processing really big files, I would error on the side of working in memory. By 'big' I mean more than one million lines.

I see this pattern in a few places

Code: Select all

file = ["preamble.txt", "gcode_mod.txt","postamble.txt"]

for index in file:
Usually an index refers to the position in the array. For clarity, I'd use the same pattern but change the naming like

Code: Select all

files = ["preamble.txt", "gcode_mod.txt","postamble.txt"]

for file in files:
If you ever need the item and its index, you can do

Code: Select all

files = ["preamble.txt", "gcode_mod.txt","postamble.txt"]

for index, file in enumerate(files):
   print( f"the index is {index} and the file is {file}")
 
>>>the index is 0 and the file is preamble.txt
>>>the index is 1 and the file is gcode_mod.txt
>>>the index is 2 and the file is postamble.txt
User avatar
sliptonic
Veteran
Posts: 2966
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: How selection planes work ?

Post by sliptonic »

Related to speed, there's this analogy:

L1 cache - There is a sandwich in front of you.
L2 cache - Walk to the kitchen and make a sandwich
RAM - Drive to the store, purchase sandwich fixings, drive home and make sandwich
HD - Drive to the store. Purchase seeds. Grow seeds..... .... ... Harvest lettuce, wheat, etc. Make sandwich.
Post Reply