CollinsCNC

Qualifiable Scripting Language


I received a CNC machine for my birthday. No software... G-Code is unreadable, so I will use Cg2 formatted graphics and have a button to take the Cg2 to G-Code for transport to a remote machine as an option, or to sent it directly to the CNC machine.

  1. CAD 2D and 3D design (lines, circles, polygons, arcs, symbols, text, fillets, splines)
  2. Tool path, using multiple bits (2D at first then if I have time 3D)
  3. Cg2 output
  4. Cg2 to G-Code
  5. G-Code to USB

The actual cutting instructions are one line commands per polygon. I am looking at this as dynamic external qualified cutting instructions. The qualifiers in this example are the pattern, material, tool, depth, and size.  An example of Jane to G-Code command.

Cut a 4" Square with 4 12mm fillets, .25" deep in wood, using a 1/4" end mill.

 

Cg2 Example  (Rough Draft of CNC Cg2 structure, just an Idea right now)

Cg2 format is defined to be readable, editable, and resilient.  Resilient means that CG2 is Version independent. The *cg2 statement defines this as a cg2 file. The *define statement defines a record structure. The exclamation point is a comment. I will get the Cg2 to G-Code working then add the graphic creation and editing buttons.

!==================================================================================
!			CNC Milling Instructions by Name
!		(Jane will create a library of all cut patterns)
!==================================================================================
*cg2;

*define:scale,		xscale:default=1, yscale:default=1, zscale:default=1;
*define:Units,		name:units:default=inches;
*define:Position,	point:(X,Y,Z);
*define:Tool,		material, name, diameter, travel speed, rpm, cut increment;

*define:Arc,		style(*):names=(tilt,depth,fill,line-width),	
			Center:(X,Y,Z),Radius, Sweep;
					
*define:Circle,		style(*):names=(tilt,depth,fill,line-width,
					just:default=BL:one of=(BL,BC,BR,CL,CC,CR,TR,TC,TR,
					bottom left, bottom center, bottom right,
					center left, center center, center right,
					top left, top center, top right)),
			Point:(X,Y,Z),Radius,Sides;
					
*define:Ellipse,	style(*):names=(tilt,depth,fill,line-width),
			Center_1:(X,Y,Z),Center_2:(X,Y,Z),Radius;
					
*define:Symbol,		style(*):names=(tilt,depth,fill,line-width,
					just:default=BL:one of=(BL,BC,BR,CL,CC,CR,TR,TC,TR,
					bottom left, bottom center, bottom right,
					center left, center center, center right,
					top left, top center, top right)),
			Name,Insert:(X,Y,Z);
					
*define:Point,		style(*):names=(tilt,depth,fill,line-width),
			Point:(X,Y,Z);
					
*define:Text,		style(*):names=(tilt,depth,max-width,text-size,slant,spacing,
					bold,italic,underline,overline,path,font,
					just:default=BL:one of=(BL,BC,BR,CL,CC,CR,TR,TC,TR,
					bottom left, bottom center, bottom right,
					center left, center center, center right,
					top left, top center, top right)),
			Text,Insert:(X,Y,Z);
					
*define:Polygon,	style(*):names=(tilt,depth,fillet,fill,line-width,line style),
					points(*):(X,Y,Z,mode);
					
*define:Line,		style(*):names=(tilt,depth,fillet,fill,line-width,line style,
					mode:default=stroke:one of=(stroke, fill)),
			points(*):(X,Y,Z,mode);
					
*define:Rectangle,	style(*):names=(tilt,depth,fillet,line-width,line style,solid,
					cut line:default=centered:one of=(centered, outside, inside),
					cut interior:default=false:one of=(true,false),
					just:default=BL:one of=(BL,BC,BR,CL,CC,CR,TR,TC,TR,
					bottom left, bottom center, bottom right,
					center left, center center, center right,
					top left, top center, top right)),
			Point(X,Y,Z),Width,Height;

!-----------------------------------------------------------------------------------
!						point modes
!	Bulge: between previous point to next point
!	Fillet:	at this point's intersection of two lines
!	Center:	Arc Center Point from previous point to next point
!	Spline:	Thru the point curves, from first non-spline point to last non-spline point
!	parabolic: Parabolic Curve at this point's intersection of two lines
!-----------------------------------------------------------------------------------
units, inches;
position,5:6;

tool,wood, end mill, 1/4 inch, 1 inch per .5 seconds per 1 mm of cut, 16K, 2mm;
tool,wood, end mill, 1/16 inch, 1 inch per .8 seconds per 1 mm of cut, 10K, 1mm;

!===================================================================================
!					Square with 4 Fillets
!===================================================================================
*entry:Square with 4 fillets:(scale:default=1.0,fillet size:default=2mm,depth:default=0);
*script,~~ ~~;
polygon,(scale=scale, depth=depth,fillets=fillet size),(0:0,0:1,1:1,1:0);

!===================================================================================
!					Square with 2 Fillets
!===================================================================================
*entry:Square with 2 fillets:(scale:default=1.0,fillet size:default=2mm,depth:default=0);
*script,~~ ~~;
polygon,(scale=scale,depth=depth),(0:0:0:fillet=fillet size, 0:1, 1:1:0:fillet=fillet Size,1:0);

!===================================================================================
!					Square with Spline
!===================================================================================
*entry:Square with Spline:(scale:default=1, depth:default=1);
*script,~~ ~~;
polygon,(depth=depth),(0:0,-.25:1/3::spline,0.25:2/3::spline,0:1,1:1,1:0);