Parametric G code generator for CNC router- Doors and Cabinets

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Inventthis
Posts: 23
Joined: Tue Mar 17, 2020 8:11 pm
Location: USA

Parametric G code generator for CNC router- Doors and Cabinets

Post by Inventthis »

Please I need help in designing a custom module for generating G code for wooden doors on a CNC router.
I would like to select images of doors and have the custom module generate G code just by entering the width (X) and the height (Y) of the door.
I want to be able to manufacture different door sizes without the need to redesign the model.
In fact I need a parametric G code generator that will have a library of different door design G code where X and Y parameters will change the G Code to account for a new door' size.
Any help would be greatly appreciated.
Thanks in advance
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Re: Parametric G code generator for CNC router- Doors and Cabinets

Post by chrisb »

FreeCAD is a very well suited program for this. Start learning how to create a 3D model, e.g. by working through the PartDesign Tutorials. (And I mean really working, not only watching).
Have a look at this page, especially the paragraph about creating stable models and create a parametric design of your doors.

Finally you create a Job in the Path workbench, and if it is all parametric the Gcode will follow your X-Y changes.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
herbk
Veteran
Posts: 2655
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Parametric G code generator for CNC router- Doors and Cabinets

Post by herbk »

Hi,
may be you should take a look at LinuxCNC, it can produce Gcode by pictures. I don't use it, so i cant say how it works exactly, - here a link to the explanation:

http://linuxcnc.org/docs/2.7/html/gui/i ... gcode.html
Gruß Herbert
User avatar
sliptonic
Veteran
Posts: 3453
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Parametric G code generator for CNC router- Doors and Cabinets

Post by sliptonic »

Generating gcode directly from an image really isn't possible. LinuxCNC has a tool to do something like this but it's really just using the greyscale of the image to control Z depth. It isn't what you're looking for. Going off of your title, there's a lot of different ways to interpret what you're asking for.

For example; do you want to generate gcode which is parametric? Simple Gcode routines can be written to use variables rather than hard coded values. I don't think that's what you want and FreeCAD isn't well suited to doing it anyway.

So I assume you mean you want to parametrically generate regular gcode.

Maybe you want to have parametric models of doors and cabinets that you can adjust and which can be used as the base objects for FreeCAD Path Jobs. No problem here. I think this is what ChrisB had in mind. It doesn't have much to do with Path. Rather, you need to design the models right in the first place so they are parametric and stable. It would be especially useful to link your parameters into a spreadsheet.

Maybe you want parametric models as described above, but you want them linked to a stable Path Job. That way you could just adjust the parameters of the model and then post-process the job again. Here too, no problem. But the path job won't make more efficient use of material if you cut two small doors instead of one big one. That kind of optimization will still require intervention.

Maybe you want to write your own python scripts that can be executed from the command line to update models and generate gcode. It's entirely possible to script FreeCAD and Path this way but it's going to take more programming skills.

Can you explain your desired workflow in a bit more detail?
User avatar
Inventthis
Posts: 23
Joined: Tue Mar 17, 2020 8:11 pm
Location: USA

Re: Parametric G code generator for CNC router- Doors and Cabinets

Post by Inventthis »

Thank you all for replying, I really appreciate your help and input as I am new to Freecad but I have years of experience with Solidworks.

I am a thinker and maker and I am building a homemade CNC router mostly to make wooden doors and cabinet.

I have a library of simple 2D doors design that I made in Artcam but each time I have to change the size of the doors, I need to scale it in Artcam and run the path again.

I am contemplating a custom interface written in Python which can call macros in Freecad to automate the creation of G-code

I understand this might be a little complicated but I will appreciate any help, you can also send me a PM for an offer to help.
Attachments
GUI presentation.png
GUI presentation.png (522.77 KiB) Viewed 2779 times
herbk
Veteran
Posts: 2655
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Parametric G code generator for CNC router- Doors and Cabinets

Post by herbk »

Hi,
how you want to make the profiled pokets? with an shaped endmill or a kind of standard endmill (e.g. a ballnose)?

Edit:
An other question: are you a joiner and do you have some experience in crating doors?
It's because i'm wondering how you want to produce it... just putting a peace of wood at the router and cut out the shape and size?
Gruß Herbert
routalot
Posts: 69
Joined: Sun Sep 23, 2018 11:40 am

Re: Parametric G code generator for CNC router- Doors and Cabinets

Post by routalot »

Wouldn't this be an ideal use for the spreadsheet function?I have experimented with a couple of shapes and after changing the dimensions in the body of the spreadsheet and using the re-compute icon,the toolpaths updated automatically.I admit I was just using basic shapes,but feel confident the principle would apply to more complex objects.To my way of thinking this would be a case of using the contents of the spreadsheet cells to input the parameters and allowing the tool controller to use it's job parameters to create the toolpaths.
User avatar
Inventthis
Posts: 23
Joined: Tue Mar 17, 2020 8:11 pm
Location: USA

Re: Parametric G code generator for CNC router- Doors and Cabinets

Post by Inventthis »

herbk wrote: Thu Mar 26, 2020 8:09 am Hi,
how you want to make the profiled pokets? with an shaped endmill or a kind of standard endmill (e.g. a ballnose)?

I will make the profile with a shape endmil

Edit:
An other question: are you a joiner and do you have some experience in crating doors?
It's because i'm wondering how you want to produce it... just putting a peace of wood at the router and cut out the shape and size?
The way this is done is exactly similar to using MDF board for cabinet production. A large board is routed on the CNC machine.
User avatar
Inventthis
Posts: 23
Joined: Tue Mar 17, 2020 8:11 pm
Location: USA

Re: Parametric G code generator for CNC router- Doors and Cabinets

Post by Inventthis »

routalot wrote: Thu Mar 26, 2020 10:35 am Wouldn't this be an ideal use for the spreadsheet function?I have experimented with a couple of shapes and after changing the dimensions in the body of the spreadsheet and using the re-compute icon,the toolpaths updated automatically.I admit I was just using basic shapes,but feel confident the principle would apply to more complex objects.To my way of thinking this would be a case of using the contents of the spreadsheet cells to input the parameters and allowing the tool controller to use it's job parameters to create the toolpaths.
Thank you for the feedback, once I get proficient with Freecad, I will experiment with the spreasheet function.
memfis
Posts: 585
Joined: Tue Nov 15, 2016 7:58 pm

Re: Parametric G code generator for CNC router- Doors and Cabinets

Post by memfis »

You plan to solve problems that do not require the creation of 3-d models. They are solved by processing with several tools consistently, end and shaped milling cutters.
FC itself can create control programs not only on volume models, but also on contours, sketches without creation of 3-d models.
In the work I use for management of machine LinuxCNC and in it (as incorrect and in most other decisions) it is possible to use modules, subroutines. From the picture, you will be concerned about the running time of the program and the code that FC creates in this part is far from perfect (but safe in terms of protection against tool breakage).
The task that I would solve by your picture is as follows -
(a) There is a code block responsible for rectangular contours - one block per contour, = subroutine P1
b) code block responsible for curved contours - S1
c) the code block responsible for the burial algorithm A1 (different algorithms for different milling cutters, for example, a chamfering cutter - its processing zone increases squarely at burial = depth step and feed rate change)

In these code blocks you can do the math of scaling and even mirroring . It is especially easy to do it in cases when as a postprocessor to choose something absolutely primitive, not knowing codes g2 & g3 (then all trajectories will be rectilinear pieces which are easily mirrored and scaled).

The fragment looks like this -

Code: Select all

o<op5> if [#<OP> eq 4] (ЛИЦО, отрез, фреза 6 компрессионная)
	G0 Z[#<_bzz>]
	G10 L2 P0 R-90 X[#<r_x> - 30]  y[#<r_y> + 30] 
	#<_pb> = 6000
	#<_pm> = 1000
	o<start> call [18000]
	
	   
	
	(отрез)
		o<otrez> call [-3.5]
		o<otrez> call [-6.5]
		o<otrez> call [-9.5]
		o<otrez> call [-11]
		o<otrez> call [0.05 - #<_tf> ]
		G0 Z[#<_bzz>]
	    
		o<d5> if [#<dubl> eq 2]
			G10 L2 P0 R-90 X[#<r_x> - 30]  y[#<r_y> + 30 - #<_dy>] 
			(отрез)
		    o<otrez> call [-3.5]
		    o<otrez> call [-6.5]
		    o<otrez> call [-9.5]
		    o<otrez> call [-11]
		    o<otrez> call [0.05 - #<_tf> ]
		    G0 Z[#<_bzz>]
			o<d5> endif
	o<op5> endif 
Actually now I use FC only to create curved contours, for one pass and do it by subroutinear. For example, during the final cut I don't make any technological jumper, but I use a compression cutter and finishing passes, leaving 0.2, 0.1, 0.02-0.05 mm thick at the end - the compression cutter leaves a compacted chip that keeps the workpiece from displacement, the displacement force at the last pass (removing 0.0X mm) is very small. Accordingly, I do not need to process these same process jumpers later on.

sooner or later you will come to the manufacturing of grooves and spikes, landing sizes and suddenly it turns out that due to the elasticity of the material and the cutter rectangles X+/-x1 and Y+/-y1 are cut out instead of a square and you will need to make small corrections in the code to fit the grooves to the spikes based on the thickness of the workpiece (probably a furniture board) and do it easier and faster directly in the code of the program (t). i.e. right on the machine - performed slot = measured = entered correction = performed = checked = went further) than to change something in the Table in FC, etc.

I can send you an example program by e-mail.
Attachments
Снимок экрана от 2020-03-28 12-17-35.png
Снимок экрана от 2020-03-28 12-17-35.png (41.16 KiB) Viewed 2673 times
Post Reply