PDA

View Full Version : G-Code to DXF



WayneHill
03-01-2005, 11:09 AM
This program will convert a standard line-arc gcode file to a DXF file.

It is written in PowerBASIC and is released to the public doman.

http://www.cnczone.com/modules/Downloads/userfile.php?id=22




#PBFORMS CREATED V1.50
'------------------------------------------------------------------------------
' The first line in this file is a PB/Forms metastatement.
' It should ALWAYS be the first line of the file. Other
' PB/Forms metastatements are placed at the beginning and
' end of "Named Blocks" of code that should be edited
' with PBForms only. Do not manually edit or delete these
' metastatements or PB/Forms will not be able to reread
' the file correctly. See the PB/Forms documentation for
' more information.
' Named blocks begin like this: #PBFORMS BEGIN ...
' Named blocks end like this: #PBFORMS END ...
' Other PB/Forms metastatements such as:
' #PBFORMS DECLARATIONS
' are used by PB/Forms to insert additional code.
' Feel free to make changes anywhere else in the file.
'------------------------------------------------------------------------------
#COMPILE EXE "G-Code to DXF"
#DIM ALL
'------------------------------------------------------------------------------
' ** Includes **
'------------------------------------------------------------------------------
#PBFORMS BEGIN INCLUDES
#IF NOT %DEF(%WINAPI)
#INCLUDE "WIN32API.INC"
#ENDIF
#PBFORMS END INCLUDES
'------------------------------------------------------------------------------
#INCLUDE "COMDLG32.INC"

#INCLUDE "C:\QVCS LIB\Workfile\PowerBasic\Common\URL\url.inc" ' Add Urls
'------------------------------------------------------------------------------
' ** Constants **
'------------------------------------------------------------------------------
#PBFORMS BEGIN CONSTANTS
%IDD_DIALOG1 = 101
%IDC_BUTTON1 = 1001
%IDC_BUTTON2 = 1002
%IDC_LABEL1 = 1003
%IDC_LABEL2 = 1004 '*
%IDC_LABEL3 = 1005
%IDC_LABEL4 = 1006
%IDC_BUTTON3 = 1007
%IDC_LABEL5 = 1008
#PBFORMS END CONSTANTS
'------------------------------------------------------------------------------
MACRO Pi = 3.141592653589793##
TYPE TypPoints
X AS SINGLE ' Center of first circle or first point of intersection
Y AS SINGLE
Z AS SINGLE
I AS SINGLE
J AS SINGLE
X1 AS SINGLE ' Center of first circle or first point of intersection
Y1 AS SINGLE
X2 AS SINGLE ' Point on diameter of circle or second point of intersection
Y2 AS SINGLE
R AS SINGLE ' Common Radius
Ang AS SINGLE ' Angle of Radius Point on Circomference.
END TYPE
GLOBAL TypOld AS TypPoints ' Hold Values of Geometry
DECLARE SUB CalcCenters( BYREF Centers AS TypPoints )
DECLARE SUB CalcAngle( BYREF tPoints AS TypPoints )
DECLARE SUB PARSEFILE( hWnd AS LONG,SMYSOURCEFILE AS STRING )

$ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
$DP = "#.0###" ' FORMAT OF XYZ - CODE

'------------------------------------------------------------------------------
' ** Declarations **
'------------------------------------------------------------------------------
DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG

#PBFORMS DECLARATIONS
'------------------------------------------------------------------------------
DECLARE FUNCTION ExeName(Op AS LONG) AS STRING
'------------------------------------------------------------------------------
' ** Main Application Entry Point **
'------------------------------------------------------------------------------
FUNCTION PBMAIN()
ShowDIALOG1 %HWND_DESKTOP
END FUNCTION
'------------------------------------------------------------------------------

'------------------------------------------------------------------------------
' ** CallBacks **
'------------------------------------------------------------------------------
CALLBACK FUNCTION ShowDIALOG1Proc()

SELECT CASE AS LONG CBMSG
CASE %WM_INITDIALOG
' Initialization handler

CASE %WM_NCACTIVATE
STATIC hWndSaveFocus AS DWORD
IF ISFALSE CBWPARAM THEN
' Save control focus
hWndSaveFocus = GetFocus()
ELSEIF hWndSaveFocus THEN
' Restore control focus
SetFocus(hWndSaveFocus)
hWndSaveFocus = 0
END IF

CASE %WM_COMMAND
' Process control notifications
SELECT CASE AS LONG CBCTL
' /* Inserted by PB/Forms 10-11-2004 00:36:51
CASE %IDC_LABEL5
' */

' /* Inserted by PB/Forms 09-11-2004 15:16:59
CASE %IDC_BUTTON3
IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
DIALOG END CBHNDL 'Exit
END IF
' */

CASE %IDC_BUTTON1
IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN

DIM InputFile AS STRING

Inputfile = "*.cnc;*.txt;*.dnc"
IF OpenFileDialog(0, _
"Open PowerBasic Source File", _
InputFile, _
CURDIR$, _
"CNC Files (*.cnc;*.txt;*.dnc)|*.cnc,*.txt,*.dnc", _
"cnc", _
%OFN_FILEMUSTEXIST OR %OFN_HIDEREADONLY) THEN
END IF
IF Inputfile = "*.cnc;*.txt;*.dnc" THEN Inputfile = "None"
CONTROL SET TEXT CBHNDL , %IDC_LABEL1, InputFile

END IF

CASE %IDC_BUTTON2
IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN

CONTROL GET TEXT CBHNDL , %IDC_LABEL1 TO InputFile
IF Inputfile = "None" THEN EXIT FUNCTION

' Disable system menu's close item
MENU SET STATE GetSystemMenu(CBHNDL, 0), %SC_CLOSE, %MF_GRAYED

' Disable other controls
CONTROL DISABLE CBHNDL, %IDC_BUTTON1
CONTROL DISABLE CBHNDL, %IDC_BUTTON2
CONTROL DISABLE CBHNDL, %IDC_BUTTON3
PARSEFILE(CBHNDL,InputFile)
MSGBOX "Finished"

CONTROL ENABLE CBHNDL, %IDC_BUTTON1
CONTROL ENABLE CBHNDL, %IDC_BUTTON2
CONTROL ENABLE CBHNDL, %IDC_BUTTON3

END IF

CASE %IDC_LABEL1

CASE %IDC_LABEL3

CASE %IDC_LABEL4

END SELECT
END SELECT
END FUNCTION
'------------------------------------------------------------------------------

'------------------------------------------------------------------------------
' ** Dialogs **
'------------------------------------------------------------------------------
FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
LOCAL lRslt AS LONG

#PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
LOCAL hDlg AS DWORD

DIALOG NEW hParent, "G-Code to DXF", 73, 156, 274, 94, %WS_POPUP OR _
%WS_BORDER OR %WS_DLGFRAME OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR _
%DS_MODALFRAME OR %DS_CENTER OR %DS_3DLOOK OR %DS_NOFAILCREATE OR _
%DS_SETFONT, %WS_EX_WINDOWEDGE OR %WS_EX_CONTROLPARENT OR _
%WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
CONTROL ADD BUTTON, hDlg, %IDC_BUTTON1, "Import G-Code", 5, 10, 65, 15
CONTROL ADD BUTTON, hDlg, %IDC_BUTTON2, "Convert to DXF", 5, 45, 65, 15
CONTROL ADD LABEL, hDlg, %IDC_LABEL1, "None", 10, 30, 255, 10
CONTROL ADD LABEL, hDlg, %IDC_LABEL3, "Line : ", 80, 50, 25, 10
CONTROL ADD LABEL, hDlg, %IDC_LABEL4, "", 110, 50, 155, 10
CONTROL ADD BUTTON, hDlg, %IDC_BUTTON3, "Exit", 205, 70, 50, 15
#PBFORMS END DIALOG
InitUrlCtrl ' INI for URL's
CONTROL ADD "PBURL32", hDlg, 106, "By Wayne Hill;mailto:wayne_j_hill@yahoo.com", _
10, 70, 80, 14, %WS_VISIBLE OR %WS_CHILD

DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt

#PBFORMS BEGIN CLEANUP %IDD_DIALOG1
#PBFORMS END CLEANUP

FUNCTION = lRslt
END FUNCTION
'------------------------------------------------------------------------------
FUNCTION ExeName(Op AS LONG) AS STRING
LOCAL TmpAsciiz AS ASCIIZ * 256
GetModuleFileName GetModuleHandle(BYVAL 0&), TmpAsciiz, 255
IF Op = 1 THEN
FUNCTION = TmpAsciiz
ELSE
LOCAL i AS LONG, j AS LONG
DO
j = INSTR(i + 1, TmpAsciiz, "\")
IF j = 0 THEN EXIT DO ELSE i = j
LOOP
IF Op = 2 THEN FUNCTION = LEFT$(TmpAsciiz$, i) ELSE _ ' With final \
FUNCTION = MID$(TmpAsciiz$, i + 1)
END IF
END FUNCTION

SUB PARSEFILE( hWnd AS LONG,SMYSOURCEFILE AS STRING )


DIM TypNew AS TypPoints

DIM MyResults AS TypPoints
DIM lNumberOfLines AS LONG
DIM lNumberofAlpha_Codes AS LONG
DIM lLineCount AS LONG
DIM lAlphaCode_Count AS LONG
DIM lAlphaCodePos AS LONG
DIM lAlphaValue AS LONG
DIM sLine AS STRING
DIM sLineParsed AS STRING
DIM sAlphaCode AS STRING
DIM sGMode AS STRING
LOCAL ArcCenterX AS SINGLE
LOCAL ArcCenterY AS SINGLE
LOCAL SideXs AS SINGLE
LOCAL SideYs AS SINGLE
LOCAL Radius AS SINGLE
LOCAL AngleEnd AS SINGLE
LOCAL AngleStart AS SINGLE
LOCAL LineCounter AS LONG
LineCounter = 48 ' Start at 48 for AutoCAD Line Number Entity
DIM HFILE AS LONG
DIM sBUFFER AS STRING
DIM sTemp AS STRING

TypOld = TypNew ' Clear


HFILE = FREEFILE
OPEN SMYSOURCEFILE FOR INPUT AS HFILE
WHILE ISFALSE EOF( HFILE )
LINE INPUT# HFILE, sTemp
CONTROL SET TEXT hWnd , %IDC_LABEL4, sTemp
sBUFFER = sBUFFER + sTemp + $CRLF
DIALOG DOEVENTS
WEND
CLOSE HFILE

HFILE = FREEFILE
OPEN "Data.DXF" FOR OUTPUT AS HFILE 'DXF FILE.
PRINT #HFILE, " 0"
PRINT #HFILE, "SECTION"
PRINT #HFILE, " 2"
PRINT #HFILE, "ENTITIES"

lNumberOfLines = TALLY( sBUFFER, $CRLF )
FOR lLineCount = 1 TO lNumberOfLines
DIALOG DOEVENTS
CONTROL SET TEXT hWnd , %IDC_LABEL4, STR$(lLineCount)
sLine = PARSE$( sBUFFER, $CRLF, lLineCount )
sLine = PARSE$( sLine, "(", 1 ) ' REMOVE COMMENT LINE
sLine = UCASE$( sLine ) ' CHANGE TO UPPERCASE
sLine = REMOVE$( sLine, " " ) ' REMOVE SPACES
lNumberofAlpha_Codes = TALLY( sLine, ANY $ALPHA )
FOR lAlphaCode_Count = 1 TO lNumberofAlpha_Codes
lAlphaCodePos = INSTR( - 1, sLine, ANY $ALPHA ) ' FIND THE RIGHTMOST LETTER
sLineParsed = MID$( sLine, lAlphaCodePos, LEN( sLine )) ' GET THE CODE AND THE VALUE
sLine = EXTRACT$( sLine, sLineParsed ) ' REMOVE IT FROM THE MAIN STRING
sAlphaCode = LEFT$( sLineParsed, 1 )
SELECT CASE sAlphaCode
CASE "X"
TypNew.X = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "Y"
TypNew.Y = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "Z"
TypNew.Z = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "R"
TypNew.R = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "I"
TypNew.I = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "J"
TypNew.J = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "G"
lAlphaValue = VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 ))
SELECT CASE lAlphaValue
CASE 0
sGMode = "0" ' Group 1 G Codes
CASE 1
sGMode = "1"
CASE 2
sGMode = "2"
CASE 3
sGMode = "3"
END SELECT
END SELECT
NEXT ALPHACODECOUNT

IF sGMode = "3" OR sGMode = "2" THEN

IF TypNew.R <> 0 THEN
MyResults.X1 = TypOld.X
MyResults.Y1 = TypOld.Y
MyResults.X2 = TypNew.X
MyResults.Y2 = TypNew.Y
Radius = TypNew.R
MyResults.R = ABS( Radius )
CalcCenters MyResults

IF ( sGMode = "2" ) AND ( SGN( Radius ) = - 1 ) THEN
ArcCenterX = MyResults.X2
ArcCenterY = MyResults.Y2
END IF
IF ( sGMode = "2" ) AND ( SGN( Radius ) = 1 ) THEN
ArcCenterX = MyResults.X1
ArcCenterY = MyResults.Y1
END IF
IF ( sGMode = "3" ) AND ( SGN( Radius ) = - 1 ) THEN
ArcCenterX = MyResults.X1
ArcCenterY = MyResults.Y1
END IF
IF ( sGMode = "3" ) AND ( SGN( Radius ) = 1 ) THEN
ArcCenterX = MyResults.X2
ArcCenterY = MyResults.Y2
END IF
GOTO PlotPoint
END IF

IF ( TypNew.I <> 0 ) OR ( TypNew.J <> 0 ) THEN
ArcCenterX = TypOld.X + TypNew.I
ArcCenterY = TypOld.Y + TypNew.J
END IF

PlotPoint:
MyResults.X1 = ArcCenterX ' Center of Circle
MyResults.Y1 = ArcCenterY
MyResults.X2 = TypOld.X ' Point in Radius
MyResults.Y2 = TypOld.Y

CalcAngle MyResults
AngleStart = MyResults.ang
MyResults.X1 = ArcCenterX ' Center of Circle
MyResults.Y1 = ArcCenterY
MyResults.X2 = TypNew.X ' Point in Radius
MyResults.Y2 = TypNew.Y

CalcAngle MyResults
AngleEnd = MyResults.ang
TypNew.R = MyResults.r
IF sGMode = "3" THEN
IF AngleStart = > AngleEnd THEN AngleEnd = AngleEnd + 360
END IF
IF sGMode = "2" THEN
IF AngleStart < = AngleEnd THEN AngleEnd = AngleEnd - 360
END IF
PRINT #HFILE, " 0"
PRINT #HFILE, "ARC"
PRINT #HFILE, " 5"
PRINT #HFILE, HEX$( LineCounter )
PRINT #HFILE, "100"
PRINT #HFILE, "AcDbEntity"
PRINT #HFILE, " 8"
PRINT #HFILE, "0"
PRINT #HFILE, " 62" ' Line Color Format
PRINT #HFILE, " " + STR$( 45 ) ' Line Color
PRINT #HFILE, "100"
PRINT #HFILE, "AcDbCircle"
PRINT #HFILE, " 10"
PRINT #HFILE, ArcCenterX
PRINT #HFILE, " 20"
PRINT #HFILE, ArcCenterY
PRINT #HFILE, " 30"
PRINT #HFILE, TypOld.Z
PRINT #HFILE, " 40"
PRINT #HFILE, TypNew.R
PRINT #HFILE, "100"
PRINT #HFILE, "AcDbArc"
PRINT #HFILE, " 50"
IF sGMode = "2" THEN PRINT #HFILE, AngleEnd
IF sGMode = "3" THEN PRINT #HFILE, AngleStart
PRINT #HFILE, " 51"
IF sGMode = "2" THEN PRINT #HFILE, AngleStart
IF sGMode = "3" THEN PRINT #HFILE, AngleEnd
INCR LineCounter
TypOld.X = TypNew.X
TypOld.Y = TypNew.Y
TypOld.Z = TypNew.Z
TypNew.R=0
TypNew.I=0
TypNew.J=0


ITERATE FOR
END IF

PRINT #HFILE, " 0"
PRINT #HFILE, "LINE"
PRINT #HFILE, " 5"
PRINT #HFILE, HEX$( LineCounter )
PRINT #HFILE, "100"
PRINT #HFILE, "AcDbEntity"
PRINT #HFILE, " 8"
PRINT #HFILE, "0"
PRINT #HFILE, " 62" ' Line Color Format
PRINT #HFILE, " " + STR$( 45 ) ' Line Color
PRINT #HFILE, "100"
PRINT #HFILE, "AcDbLine"
PRINT #HFILE, " 10"
PRINT #HFILE, TypOld.X
PRINT #HFILE, " 20"
PRINT #HFILE, TypOld.Y
PRINT #HFILE, " 30"
PRINT #HFILE, TypOld.Z
PRINT #HFILE, " 11"
PRINT #HFILE, TypNew.X
PRINT #HFILE, " 21"
PRINT #HFILE, TypNew.Y
PRINT #HFILE, " 31"
PRINT #HFILE, TypNew.Z
INCR LineCounter
TypOld.X = TypNew.X
TypOld.Y = TypNew.Y
TypOld.Z = TypNew.Z
NEXT lLineCount
PRINT #HFILE, " 0"
PRINT #HFILE, "ENDSEC"
PRINT #HFILE, " 0"
PRINT #HFILE, "EOF"
CLOSE HFILE
END SUB
' ================================================================================
'
' CalcCenters calculates the centers of two circles given their points
' of intersection and common radius.
'
' ================================================================================
'
SUB CalcCenters( BYREF Centers AS TypPoints )
LOCAL c AS TypPoints ' Points of intersection
LOCAL H1!, H2!, K1!, K2!, X!, Y!, D!, D2!
c = Centers
X = c.x1 - c.x2
Y = c.y1 - c.y2
D2 = X^2 + Y^2
D = SQR( D2 )
IF 2 * c.r < D, THEN ' values of H and K are not real
c.x1 = 0! ' and there is no solution.
c.x2 = 0!
c.y1 = 0!
c.y2 = 0!
c.r = 0!
Centers = c
EXIT SUB
END IF
K1 = ( Y + X * SQR( 4 * c.r^2 / D^2 - 1 )) / 2
K2 = ( Y - X * SQR( 4 * c.r^2 / D^2 - 1 )) / 2
H1 = ( X^2 - Y * ( 2 * K1 - Y )) / ( 2 * X )
H2 = ( X^2 - Y * ( 2 * K2 - Y )) / ( 2 * X )
h1 = H1 + c.x2
h2 = H2 + c.x2
k1 = K1 + c.y2
k2 = K2 + c.y2
c.x1 = h1
c.x2 = h2
c.y1 = k1
c.y2 = k2
c.r = c.r
Centers = c
END SUB
'
' ================================================================================
'
' CalcAngle calculates the angle of radius given
' center of circle to point on circomeference.
'
' ================================================================================
'
SUB CalcAngle( BYREF tPoints AS TypPoints )
LOCAL c AS TypPoints ' Radius and Angle of circle
LOCAL X!, Y!, R!
c = tPoints
X = c.x2 - c.x1
Y = c.y2 - c.y1
c.r = SQR( X^2 + Y^2 ) ' Hyp of angle (Radius)
IF c.r = 0 THEN ' values are not real
c.x1 = 0! ' and there is no solution.
c.x2 = 0!
c.y1 = 0!
c.y2 = 0!
c.r = 0!
c.ang = 0!
tPoints = c
EXIT SUB
END IF
' Find quadrant of angle in radians
IF x = 0 THEN
IF y > = 0 THEN
c.ang = PI / 2
ELSE ' Y
c.ang = 3 * PI / 2
END IF 'Y
ELSE ' X
c.ang = ATN( Y / X )
END IF 'X
IF X < 0 THEN
c.ang = c.ang + PI
ELSE
IF ( x > 0 ) AND ( y < 0 ) THEN
c.ang = c.ang + 2 * PI
END IF
END IF
c.ang = c.ang * 180 / pi ' Convert to Decimal Degrees
tPoints = c
END SUB

joecnc2006
03-01-2005, 11:27 AM
I tried your prog. out with the cnczone gcode file and it worked good.

here is a pic of the gcode in DXF after the conversion.

Joe

WayneHill
03-02-2005, 12:12 PM
I tried your prog. out with the cnczone gcode file and it worked good.

here is a pic of the gcode in DXF after the conversion.

Joe


Thanks Joe. Now you can rotate or scale the code as you like. :banana:

Wayne

smoregrava
04-04-2006, 02:57 AM
Waynehill you're the king!!
This was just a perfect program have been searching the nett for a program like this. thank you

CLaNZeR
04-04-2006, 01:16 PM
Excellent Waynehill

Works a treat this end!

Regards

Sean.

WayneHill
04-04-2006, 01:58 PM
CLaNZeR (Sean) and Smoregrava,

Thank you for your kind replys.

I could not find a program that would convert G-Code to DXF, so I wrote one :)

Wayne

CJL5585
04-04-2006, 06:11 PM
I could not find a program that would convert G-Code to DXF, so I wrote one :)

Wayne

Wayne,
Is this a new version Upgrade?

I have had a version of G-code to DXF that you wrote over a year ago and love it. I have only used it for code that I knew was not 2 1/2 D. I highly recommend you for the programming, the time, the effort, and releasing it to the Public Domain. Also, one of the best functions of the program is that I have found it to be useful and BUGFREE. Keep up the good work.

Glad to see this though. I downloaded a copy.

Jerry

WayneHill
04-04-2006, 07:09 PM
Wayne,
Is this a new version Upgrade?

Jerry,

Thank you,

No changes have been made to it. It was "rediscovered" while sitting in the CNCZone archive.

Wayne

tekno
04-05-2006, 12:17 AM
never heard of power basic.. that a mac program?

WayneHill
04-05-2006, 12:59 AM
never heard of power basic.. that a mac program?

It's a Windows basic compiler.

www.powerbasic.com

I also program in Delphi.

cheeky
04-09-2006, 01:52 AM
Hi Wayne,
This is what I need but I am 51 old and 2 stupid to use this code.
Now what?
Regards, Peter
cheeky@acenet.co.za

WayneHill
04-09-2006, 11:59 AM
Hi Wayne,
This is what I need but I am 51 old and 2 stupid to use this code.
Now what?
Regards, Peter
cheeky@acenet.co.za

Hi Cheeky,

The source code is used to create the EXE file. You don't need to know how the source code works. It is posted for the geeky ones here.

What you do need is the EXE file. It is located at:

http://www.cnczone.com/modules/Downloads/userfile.php?id=22

It is zipped up using winzip.
www.winzip.com

After you unzip the EXE program, it is ready to use.

Start the program and press the "Import G-Code" button.

Search for the G-Code program you want to convert.

Then press the "Convert to DXF" button.

The program will create a file named "Data.dxf" in the same directory as the source G-code program.

If need any more help, Let me know by posting another message here.

Thanks,

Wayne

cheeky
04-09-2006, 01:17 PM
Wayne, Thanx COOL! :~)
I just now have to save my .tap files as .txt?
Thank you for responding.
Peter Bosch South Africa.
http://www.ulm.co.za

WayneHill
04-09-2006, 01:44 PM
Wayne, Thanx COOL! :~)
I just now have to save my .tap files as .txt?
Thank you for responding.
Peter Bosch South Africa.
http://www.ulm.co.za


It defaults to file extensions *.cnc, *.txt, and *.dnc

I can easily add *.tap files to the defaults.

WayneHill
04-09-2006, 02:03 PM
Wayne, Thanx COOL! :~)
I just now have to save my .tap files as .txt?
Thank you for responding.
Peter Bosch South Africa.
http://www.ulm.co.za

Updated program.

Added '*.tap' file extension to the default files.

mikkojay
08-03-2006, 09:07 PM
Hey Wayne,
I hope ya don't mind, but I hijacked your code and ported it to VB6 so I could watch it run in debug. (also to see how you parsed the gcode). Attached is a zip file that contains the VB6 source and the resulting executable.
I had to shoehorn a few replacement functions in there, but my first test, with linear moves only, seemed to work just fine! I would not be shocked at all if it has a port-induced bug or 2, but it is something for people who have VB6 debuggers to mess around with. Maybe next we can port it to .NET.
I looked around on the web today and found some really cool DXF code written for .NET and C#. I'll post if I assemble anything worth mentioning.
Thanks for the original version- I appreciate when people share cool source like that.
Thanks, Mike

WayneHill
08-05-2006, 01:06 AM
Good going Mike. I put the source code out there for all to use.

Wayne

edavidtucker
10-26-2006, 08:05 PM
I would like to covert g-code files, (made for punching sheet metal), to DXF for import into AutoCAD.

I used both "G-Code to DXF.exe" and "G2DXF.exe". G-Code to DXF.exe runs with out errors and creates a DXF file, but when I open it with AutoCAD, it appears to be a set of random brown lines.
When I use G2DXF.exe, I get several "unrecognized g-code on line..." errors. I continued anyway just to see what happened, and I get the same results as before, random brown lines.

Am I doing something wrong? Any comments would be appreciated.

MetLHead
10-26-2006, 08:40 PM
Can you post a sample G-Code file?

Regards,
Scott

WayneHill
10-26-2006, 09:59 PM
Scott,

Email me a copy of the G-code that you are trying to convert and will look for the problem.

wayne_j_hill at yahoo dot com

Wayne

MetLHead
10-26-2006, 10:12 PM
Scott,

Email me a copy of the G-code that you are trying to convert and will look for the problem.

wayne_j_hill at yahoo dot com

Wayne

Wayne,

Sorry, I was responding to edavidtucker.

Scott

WayneHill
10-27-2006, 03:29 AM
edavidtucker,

Email me a copy of the G-code that you are trying to convert and will look for the problem.

wayne_j_hill at yahoo dot com

Scott - What type of software do you mangle?

MetLHead
10-27-2006, 07:01 AM
Wayne,

I work on a lot of CNC related stuff, NCPlot is my baby.

Scott

edavidtucker
10-27-2006, 12:15 PM
O0009
(1681-31C-55996-9-O0009)
G92X72.000Y50.000
G72X11.883Y13.964
G66I10.802J180.00P-1.984Q-0.200T228 (.200 X 1.984 RT #0)
G72X3.482Y12.232
G66I6.500J360.00P-1.984Q-0.200
X3.582Y10.232T201 (.200 X 4.000 RT #90)
X0.650Y11.732
X4.857Y12.523T219 (CRITICAL ENVIRONMENT LOGO #0)
X4.857Y12.958T255 (TERRA UNIVERSAL LOGO #0)
X2.618Y8.732T107 (.107 RD)
X1.618
Y7.732
X2.618
X11.170Y4.111T208 (.156 RD)
Y5.061
Y11.282
Y12.232
X12.059Y13.888T313 (.312 SQ #0)
X0.905
Y2.576
X12.059
G72X12.214Y13.782
G66I11.100J-90.00P4.000Q0.200T201 (.200 X 4.000 RT #0)
G72X9.982Y4.232
G66I8.000J90.00P4.000Q0.200
X3.582Y6.232
X0.650Y7.732
Y4.682
G72X3.712Y4.232
G66I6.040J-0.00P1.984Q0.200T228 (.200 X 1.984 RT #0)
G72X11.883Y2.500
G66I10.802J180.00P1.984Q0.200
G50

SET-UP SHEET

CUSTOMER NAME : TERRA UNIVERSAL
NC FILE NAME : C:\FabriWIN\NCFiles\1681-31C-55996\1681-31C-55996-09-O0009.gcd
SHEET FILE NAME : 1681-31C-55996-09

PART FILE NAME : 1681-31C-55996-09
PART SIZE : 11.464 X 11.464
OFFSET : 0.750 X 2.500
SPACE BETWEEN : 0 X 0
YIELD PER BLANK : 1 PART

MATERIAL : 18GA 304 SS 2PVC
THICKNESS : 0.048
BLANK SIZE : 13.000 X 15.000
SHEET USAGE : 0.61%

TOOL LIST

STATION TYPE ANGLE SIZE HITS

T107 ROUND 0.125 4
T208 ROUND 0.156 4
T313 SQUARE 0.00 0.312 4
T219 RECTANGLE 0.00 0.125 X 2.750 1
T228 RECTANGLE 0.00 0.200 X 1.984 20
T201 RECTANGLE 90.00 0.200 X 4.000 11
T255 RECTANGLE 0.00 0.625 X 2.750 1

CLAMPS : 3.50 9.13
ESTIMATED TIME : 0 MIN. 27 SEC.
PROGRAMMED BY : ERIC R
DATE : 10-13-2006
TIME : 13:04

COMMENTS

GRAIN IN X DIRECTION

WayneHill
10-27-2006, 01:34 PM
David - G-Code to DXF program was made to convert simple CNC mill code profiles to DXF. There are many G-code applications this program will not handle. Unfortunately a turret press code is one of them. Lathe G-Code is another. You never know until you try. Sorry.

Scott - Your are perty good at that code mangling. I visited your web site. Lots of good things going on there.

Wayne Hill

Exprice
11-11-2006, 06:23 PM
Can anyone port this to a mac program or at least a perl script? (if it's possible...)

WayneHill
11-12-2006, 08:53 PM
Can anyone port this to a mac program or at least a perl script? (if it's possible...)

Exprice.

I know nothing about Mac or Perl , but I am willing to guide you on the logic on how it is comverted.

Wayne

bumper
11-20-2006, 03:39 PM
edavidtucker,

Email me a copy of the G-code that you are trying to convert and will look for the problem.



Scott - What type of software do you mangle?

Wayne your program is what i have been trying to find for a long time, but when i run it and bring the dxf file into autocad it just consist of some circles, and extreme amount of line usually converging into one point, i will email you a sample of the work ok. glenn

WayneHill
11-20-2006, 04:26 PM
bumper (Glenn)

I will take a look at it. My email address:

wayne_j_hill at yahoo dot com

Wayne

WayneHill
11-21-2006, 10:57 AM
Glenn,

The program you sent has I and J values the program was having trouble converting. My program works with I and J values that are the incremental distance from the start point of the circle to the center of the circle. It will also convert G02 and G03 with R values.

Attached are two G02/G03 G-Code programs that work fine with the Gcode2DXF program.



%
N0010 G40 G17 G90 G20
N0020 G43 T02 H02 M06
N0030 G01 X.0037 Y.1633 Z.1 F20. S0 M03
N0040 G01 X0.0 Y.1696 Z.0981 F10.
N0050 G01 X-.0241 Y.128 Z.0852 F10.
N0060 G01 X-.0888 Y.0366 Z.0552 F10.
N0070 G01 X-.12 Y0.0 Z.0423 F10.
N0080 G01 X-.0888 Y-.0366 Z.0294 F10.
N0090 G01 X-.0241 Y-.128 Z-.0006 F10.
N0100 G01 X0.0 Y-.1696 Z-.0135 F10.
N0110 G01 X.0241 Y-.128 Z-.0264 F10.
N0120 G01 X.0888 Y-.0366 Z-.0563 F10.
N0130 G01 X.12 Y0.0 Z-.0692 F10.
N0140 G01 X.0888 Y.0366 Z-.0821 F10.
N0150 G01 X.0241 Y.128 Z-.1121 F10.
N0160 G01 X0.0 Y.1696 Z-.125 F10.
N0170 G17 G02 X-.12 Y0.0 Z-.125 I-1. J.5804 K0.0 F10.
N0180 G17 G02 X0.0 Y-.1696 Z-.125 I-.88 J-.75 K0.0 F10.
N0190 G17 G02 X.12 Y0.0 Z-.125 I1. J-.5804 K0.0 F10.
N0200 G17 G02 X0.0 Y.1696 Z-.125 I.88 J.75 K0.0 F10.
N0210 G01 X.0811 Y.2166 Z-.125 F10.
N0220 G17 G02 X0.0 Y.391 Z-.125 I.9189 J.5334 K0.0 F10.
N0230 G17 G02 X-.2474 Y0.0 Z-.125 I-1. J.359 K0.0 F10.
N0240 G17 G02 X0.0 Y-.391 Z-.125 I-.7526 J-.75 K0.0 F10.
N0250 G17 G02 X.2474 Y0.0 Z-.125 I1. J-.359 K0.0 F10.
N0260 G17 G02 X.0811 Y.2166 Z-.125 I.7526 J.75 K0.0 F10.
N0270 G01 X.1622 Y.2637 Z-.125 F10.
N0280 G17 G02 X.0563 Y.5312 Z-.125 I.8378 J.4863 K0.0 F10.
N0290 G01 X-.0563 Y.5312 Z-.125 F10.
N0300 G17 G02 X-.3868 Y0.0 Z-.125 I-.9437 J.2188 K0.0 F10.
N0310 G17 G02 X-.0882 Y-.4226 Z-.125 I-.6132 J-.75 K0.0 F10.
N0320 G17 G02 X-.0563 Y-.5312 Z-.125 I-.9118 J-.3274 K0.0 F10.
N0330 G01 X.0563 Y-.5312 Z-.125 F10.
N0340 G17 G02 X.0882 Y-.4226 Z-.125 I.9437 J-.2188 K0.0 F10.
N0350 G17 G02 X.3868 Y0.0 Z-.125 I.9118 J-.3274 K0.0 F10.
N0360 G17 G02 X.1622 Y.2637 Z-.125 I.6132 J.75 K0.0 F10.
N0370 G01 X.2432 Y.3107 Z-.125 F10.
N0380 G17 G02 X.134 Y.625 Z-.125 I.7568 J.4393 K0.0 F10.
N0390 G01 X-.134 Y.625 Z-.125 F10.
N0400 G17 G02 X-.5493 Y0.0 Z-.125 I-.866 J.125 K0.0 F10.
N0410 G17 G02 X-.134 Y-.625 Z-.125 I-.4507 J-.75 K0.0 F10.
N0420 G01 X.134 Y-.625 Z-.125 F10.
N0430 G17 G02 X.5493 Y0.0 Z-.125 I.866 J-.125 K0.0 F10.
N0440 G17 G02 X.2432 Y.3107 Z-.125 I.4507 J.75 K0.0 F10.
N0450 G01 X.3243 Y.3578 Z-.125 F10.
N0460 G17 G02 X.2194 Y.7187 Z-.125 I.6757 J.3922 K0.0 F10.
N0470 G01 X-.2194 Y.7187 Z-.125 F10.
N0480 G17 G02 X-.7187 Y.0211 Z-.125 I-.7806 J.0313 K0.0 F10.
N0490 G01 X-.7187 Y-.0211 Z-.125 F10.
N0500 G17 G02 X-.2194 Y-.7187 Z-.125 I-.2813 J-.7289 K0.0 F10.
N0510 G01 X.2194 Y-.7187 Z-.125 F10.
N0520 G17 G02 X.7187 Y-.0211 Z-.125 I.7806 J-.0313 K0.0 F10.
N0530 G01 X.7187 Y.0211 Z-.125 F10.
N0540 G17 G02 X.3243 Y.3578 Z-.125 I.2813 J.7289 K0.0 F10.
N0550 G01 X.4054 Y.4049 Z-.125 F10.
N0560 G17 G02 X.3125 Y.75 Z-.125 I.5946 J.3451 K0.0 F10.
N0570 G01 X.3125 Y.8125 Z-.125 F10.
N0580 G01 X-.3125 Y.8125 Z-.125 F10.
N0590 G01 X-.3125 Y.75 Z-.125 F10.
N0600 G17 G02 X-.8125 Y.0886 Z-.125 I-.6875 J0.0 K0.0 F10.
N0610 G01 X-.8125 Y-.0886 Z-.125 F10.
N0620 G17 G02 X-.3125 Y-.75 Z-.125 I-.1875 J-.6614 K0.0 F10.
N0630 G01 X-.3125 Y-.8125 Z-.125 F10.
N0640 G01 X.3125 Y-.8125 Z-.125 F10.
N0650 G01 X.3125 Y-.75 Z-.125 F10.
N0660 G17 G02 X.8125 Y-.0886 Z-.125 I.6875 J0.0 K0.0 F10.
N0670 G01 X.8125 Y.0886 Z-.125 F10.
N0680 G17 G02 X.4054 Y.4049 Z-.125 I.1875 J.6614 K0.0 F10.
N0690 G01 X.4865 Y.4519 Z-.125 F10.
N0700 G17 G02 X.4062 Y.75 Z-.125 I.5135 J.2981 K0.0 F10.
N0710 G01 X.4062 Y.9062 Z-.125 F10.
N0720 G01 X-.4062 Y.9062 Z-.125 F10.
N0730 G01 X-.4062 Y.75 Z-.125 F10.
N0740 G17 G02 X-.9062 Y.1637 Z-.125 I-.5938 J0.0 K0.0 F10.
N0750 G01 X-.9062 Y-.1637 Z-.125 F10.
N0760 G17 G02 X-.4062 Y-.75 Z-.125 I-.0938 J-.5863 K0.0 F10.
N0770 G01 X-.4062 Y-.9062 Z-.125 F10.
N0780 G01 X.4062 Y-.9062 Z-.125 F10.
N0790 G01 X.4062 Y-.75 Z-.125 F10.
N0800 G17 G02 X.9062 Y-.1637 Z-.125 I.5938 J0.0 K0.0 F10.
N0810 G01 X.9062 Y.1637 Z-.125 F10.
N0820 G17 G02 X.4865 Y.4519 Z-.125 I.0938 J.5863 K0.0 F10.
N0830 G01 X.5676 Y.499 Z-.125 F10.
N0840 G17 G02 X.5 Y.75 Z-.125 I.4324 J.251 K0.0 F10.
N0850 G01 X.5 Y1. Z-.125 F10.
N0860 G01 X-.5 Y1. Z-.125 F10.
N0870 G01 X-.5 Y.75 Z-.125 F10.
N0880 G17 G02 X-1. Y.25 Z-.125 I-.5 J0.0 K0.0 F10.
N0890 G01 X-1. Y-.25 Z-.125 F10.
N0900 G17 G02 X-.5 Y-.75 Z-.125 I0.0 J-.5 K0.0 F10.
N0910 G01 X-.5 Y-1. Z-.125 F10.
N0920 G01 X.5 Y-1. Z-.125 F10.
N0930 G01 X.5 Y-.75 Z-.125 F10.
N0940 G17 G02 X1. Y-.25 Z-.125 I.5 J0.0 K0.0 F10.
N0950 G01 X1. Y.25 Z-.125 F10.
N0960 G17 G02 X.5676 Y.499 Z-.125 I0.0 J.5 K0.0 F10.
N0970 G01 X.6486 Y.5461 Z-.125 F10.
N0980 G17 G02 X.5937 Y.75 Z-.125 I.3514 J.2039 K0.0 F10.
N0990 G01 X.5937 Y1.0937 Z-.125 F10.
N1000 G01 X-.5937 Y1.0937 Z-.125 F10.
N1010 G01 X-.5937 Y.75 Z-.125 F10.
N1020 G17 G02 X-1. Y.3437 Z-.125 I-.4063 J0.0 K0.0 F10.
N1030 G01 X-1.0937 Y.3437 Z-.125 F10.
N1040 G01 X-1.0937 Y-.3437 Z-.125 F10.
N1050 G01 X-1. Y-.3437 Z-.125 F10.
N1060 G17 G02 X-.5937 Y-.75 Z-.125 I0.0 J-.4063 K0.0 F10.
N1070 G01 X-.5937 Y-1.0937 Z-.125 F10.
N1080 G01 X.5937 Y-1.0937 Z-.125 F10.
N1090 G01 X.5937 Y-.75 Z-.125 F10.
N1100 G17 G02 X1. Y-.3437 Z-.125 I.4063 J0.0 K0.0 F10.
N1110 G01 X1.0937 Y-.3437 Z-.125 F10.
N1120 G01 X1.0937 Y.3437 Z-.125 F10.
N1130 G01 X1. Y.3437 Z-.125 F10.
N1140 G17 G02 X.6486 Y.5461 Z-.125 I0.0 J.4063 K0.0 F10.
N1150 G01 X.7297 Y.5931 Z-.125 F10.
N1160 G17 G02 X.6875 Y.75 Z-.125 I.2703 J.1569 K0.0 F10.
N1170 G01 X.6875 Y1.1875 Z-.125 F10.
N1180 G01 X-.6875 Y1.1875 Z-.125 F10.
N1190 G01 X-.6875 Y.75 Z-.125 F10.
N1200 G17 G02 X-1. Y.4375 Z-.125 I-.3125 J0.0 K0.0 F10.
N1210 G01 X-1.1875 Y.4375 Z-.125 F10.
N1220 G01 X-1.1875 Y-.4375 Z-.125 F10.
N1230 G01 X-1. Y-.4375 Z-.125 F10.
N1240 G17 G02 X-.6875 Y-.75 Z-.125 I0.0 J-.3125 K0.0 F10.
N1250 G01 X-.6875 Y-1.1875 Z-.125 F10.
N1260 G01 X.6875 Y-1.1875 Z-.125 F10.
N1270 G01 X.6875 Y-.75 Z-.125 F10.
N1280 G17 G02 X1. Y-.4375 Z-.125 I.3125 J0.0 K0.0 F10.
N1290 G01 X1.1875 Y-.4375 Z-.125 F10.
N1300 G01 X1.1875 Y.4375 Z-.125 F10.
N1310 G01 X1. Y.4375 Z-.125 F10.
N1320 G17 G02 X.7297 Y.5931 Z-.125 I0.0 J.3125 K0.0 F10.
N1330 G01 X.9196 Y.2777 Z-.125 F10.
N1340 G17 G03 X.8587 Y.583 Z-.125 I-.2223 J.1144 K0.0 F10.
N1350 G17 G02 X.8108 Y.6402 Z-.125 I.1413 J.167 K0.0 F10.
N1360 G17 G02 X.7812 Y.75 Z-.125 I.1892 J.1098 K0.0 F10.
N1370 G01 X.7812 Y1.2812 Z-.125 F10.
N1380 G01 X-.7812 Y1.2812 Z-.125 F10.
N1390 G01 X-.7812 Y.75 Z-.125 F10.
N1400 G17 G02 X-1. Y.5312 Z-.125 I-.2188 J0.0 K0.0 F10.
N1410 G01 X-1.2812 Y.5312 Z-.125 F10.
N1420 G01 X-1.2812 Y-.5312 Z-.125 F10.
N1430 G01 X-1. Y-.5312 Z-.125 F10.
N1440 G17 G02 X-.7812 Y-.75 Z-.125 I0.0 J-.2188 K0.0 F10.
N1450 G01 X-.7812 Y-1.2812 Z-.125 F10.
N1460 G01 X.7812 Y-1.2812 Z-.125 F10.
N1470 G01 X.7812 Y-.75 Z-.125 F10.
N1480 G17 G02 X1. Y-.5312 Z-.125 I.2188 J0.0 K0.0 F10.
N1490 G01 X1.2812 Y-.5312 Z-.125 F10.
N1500 G01 X1.2812 Y.5312 Z-.125 F10.
N1510 G01 X1. Y.5312 Z-.125 F10.
N1520 G17 G02 X.7849 Y.7102 Z-.125 I0.0 J.2188 K0.0 F10.
N1530 G17 G03 X.6502 Y.8886 Z-.125 I-.2458 J-.0455 K0.0 F10.
N1540 G01 X1.0827 Y.3574 Z-.125 F10.
N1550 G17 G03 X.9462 Y.6372 Z-.125 I-.2441 J.0541 K0.0 F10.
N1560 G17 G02 X.8919 Y.6872 Z-.125 I.0538 J.1128 K0.0 F10.
N1570 G17 G02 X.875 Y.75 Z-.125 I.1081 J.0628 K0.0 F10.
N1580 G01 X.875 Y1.375 Z-.125 F10.
N1590 G01 X-.875 Y1.375 Z-.125 F10.
N1600 G01 X-.875 Y.75 Z-.125 F10.
N1610 G17 G02 X-1. Y.625 Z-.125 I-.125 J0.0 K0.0 F10.
N1620 G01 X-1.375 Y.625 Z-.125 F10.
N1630 G01 X-1.375 Y-.625 Z-.125 F10.
N1640 G01 X-1. Y-.625 Z-.125 F10.
N1650 G17 G02 X-.875 Y-.75 Z-.125 I0.0 J-.125 K0.0 F10.
N1660 G01 X-.875 Y-1.375 Z-.125 F10.
N1670 G01 X.875 Y-1.375 Z-.125 F10.
N1680 G01 X.875 Y-.75 Z-.125 F10.
N1690 G17 G02 X1. Y-.625 Z-.125 I.125 J0.0 K0.0 F10.
N1700 G01 X1.375 Y-.625 Z-.125 F10.
N1710 G01 X1.375 Y.625 Z-.125 F10.
N1720 G01 X1. Y.625 Z-.125 F10.
N1730 G17 G02 X.875 Y.75 Z-.125 I0.0 J.125 K0.0 F10.
N1740 G01 X.875 Y.7593 Z-.125 F10.
N1750 G17 G03 X.775 Y.9593 Z-.125 I-.25 J0.0 K0.0 F10.
N1760 G01 X.775 Y.9593 Z-.025 F20.
N1770 G01 X.775 Y.9593 Z.2 F20.
N1780 G01 X.0037 Y.1633 Z.2 F20.
N1790 G01 X.0037 Y.1633 Z-.025 F20.
N1800 G01 X0.0 Y.1696 Z-.0269 F10.
N1810 G01 X-.0241 Y.128 Z-.0398 F10.
N1820 G01 X-.0888 Y.0366 Z-.0698 F10.
N1830 G01 X-.12 Y0.0 Z-.0827 F10.
N1840 G01 X-.0888 Y-.0366 Z-.0956 F10.
N1850 G01 X-.0241 Y-.128 Z-.1256 F10.
N1860 G01 X0.0 Y-.1696 Z-.1385 F10.
N1870 G01 X.0241 Y-.128 Z-.1514 F10.
N1880 G01 X.0888 Y-.0366 Z-.1813 F10.
N1890 G01 X.12 Y0.0 Z-.1942 F10.
N1900 G01 X.0888 Y.0366 Z-.2071 F10.
N1910 G01 X.0241 Y.128 Z-.2371 F10.
N1920 G01 X0.0 Y.1696 Z-.25 F10.
N1930 G17 G02 X-.12 Y0.0 Z-.25 I-1. J.5804 K0.0 F10.
N1940 G17 G02 X0.0 Y-.1696 Z-.25 I-.88 J-.75 K0.0 F10.
N1950 G17 G02 X.12 Y0.0 Z-.25 I1. J-.5804 K0.0 F10.
N1960 G17 G02 X0.0 Y.1696 Z-.25 I.88 J.75 K0.0 F10.
N1970 G01 X.0811 Y.2166 Z-.25 F10.
N1980 G17 G02 X0.0 Y.391 Z-.25 I.9189 J.5334 K0.0 F10.
N1990 G17 G02 X-.2474 Y0.0 Z-.25 I-1. J.359 K0.0 F10.
N2000 G17 G02 X0.0 Y-.391 Z-.25 I-.7526 J-.75 K0.0 F10.
N2010 G17 G02 X.2474 Y0.0 Z-.25 I1. J-.359 K0.0 F10.
N2020 G17 G02 X.0811 Y.2166 Z-.25 I.7526 J.75 K0.0 F10.
N2030 G01 X.1622 Y.2637 Z-.25 F10.
N2040 G17 G02 X.0563 Y.5312 Z-.25 I.8378 J.4863 K0.0 F10.
N2050 G01 X-.0563 Y.5312 Z-.25 F10.
N2060 G17 G02 X-.3868 Y0.0 Z-.25 I-.9437 J.2188 K0.0 F10.
N2070 G17 G02 X-.0882 Y-.4226 Z-.25 I-.6132 J-.75 K0.0 F10.
N2080 G17 G02 X-.0563 Y-.5312 Z-.25 I-.9118 J-.3274 K0.0 F10.
N2090 G01 X.0563 Y-.5312 Z-.25 F10.
N2100 G17 G02 X.0882 Y-.4226 Z-.25 I.9437 J-.2188 K0.0 F10.
N2110 G17 G02 X.3868 Y0.0 Z-.25 I.9118 J-.3274 K0.0 F10.
N2120 G17 G02 X.1622 Y.2637 Z-.25 I.6132 J.75 K0.0 F10.
N2130 G01 X.2432 Y.3107 Z-.25 F10.
N2140 G17 G02 X.134 Y.625 Z-.25 I.7568 J.4393 K0.0 F10.
N2150 G01 X-.134 Y.625 Z-.25 F10.
N2160 G17 G02 X-.5493 Y0.0 Z-.25 I-.866 J.125 K0.0 F10.
N2170 G17 G02 X-.134 Y-.625 Z-.25 I-.4507 J-.75 K0.0 F10.
N2180 G01 X.134 Y-.625 Z-.25 F10.
N2190 G17 G02 X.5493 Y0.0 Z-.25 I.866 J-.125 K0.0 F10.
N2200 G17 G02 X.2432 Y.3107 Z-.25 I.4507 J.75 K0.0 F10.
N2210 G01 X.3243 Y.3578 Z-.25 F10.
N2220 G17 G02 X.2194 Y.7187 Z-.25 I.6757 J.3922 K0.0 F10.
N2230 G01 X-.2194 Y.7187 Z-.25 F10.
N2240 G17 G02 X-.7187 Y.0211 Z-.25 I-.7806 J.0313 K0.0 F10.
N2250 G01 X-.7187 Y-.0211 Z-.25 F10.
N2260 G17 G02 X-.2194 Y-.7187 Z-.25 I-.2813 J-.7289 K0.0 F10.
N2270 G01 X.2194 Y-.7187 Z-.25 F10.
N2280 G17 G02 X.7187 Y-.0211 Z-.25 I.7806 J-.0313 K0.0 F10.
N2290 G01 X.7187 Y.0211 Z-.25 F10.
N2300 G17 G02 X.3243 Y.3578 Z-.25 I.2813 J.7289 K0.0 F10.
N2310 G01 X.4054 Y.4049 Z-.25 F10.
N2320 G17 G02 X.3125 Y.75 Z-.25 I.5946 J.3451 K0.0 F10.
N2330 G01 X.3125 Y.8125 Z-.25 F10.
N2340 G01 X-.3125 Y.8125 Z-.25 F10.
N2350 G01 X-.3125 Y.75 Z-.25 F10.
N2360 G17 G02 X-.8125 Y.0886 Z-.25 I-.6875 J0.0 K0.0 F10.
N2370 G01 X-.8125 Y-.0886 Z-.25 F10.
N2380 G17 G02 X-.3125 Y-.75 Z-.25 I-.1875 J-.6614 K0.0 F10.
N2390 G01 X-.3125 Y-.8125 Z-.25 F10.
N2400 G01 X.3125 Y-.8125 Z-.25 F10.
N2410 G01 X.3125 Y-.75 Z-.25 F10.
N2420 G17 G02 X.8125 Y-.0886 Z-.25 I.6875 J0.0 K0.0 F10.
N2430 G01 X.8125 Y.0886 Z-.25 F10.
N2440 G17 G02 X.4054 Y.4049 Z-.25 I.1875 J.6614 K0.0 F10.
N2450 G01 X.4865 Y.4519 Z-.25 F10.
N2460 G17 G02 X.4062 Y.75 Z-.25 I.5135 J.2981 K0.0 F10.
N2470 G01 X.4062 Y.9062 Z-.25 F10.
N2480 G01 X-.4062 Y.9062 Z-.25 F10.
N2490 G01 X-.4062 Y.75 Z-.25 F10.
N2500 G17 G02 X-.9062 Y.1637 Z-.25 I-.5938 J0.0 K0.0 F10.
N2510 G01 X-.9062 Y-.1637 Z-.25 F10.
N2520 G17 G02 X-.4062 Y-.75 Z-.25 I-.0938 J-.5863 K0.0 F10.
N2530 G01 X-.4062 Y-.9062 Z-.25 F10.
N2540 G01 X.4062 Y-.9062 Z-.25 F10.
N2550 G01 X.4062 Y-.75 Z-.25 F10.
N2560 G17 G02 X.9062 Y-.1637 Z-.25 I.5938 J0.0 K0.0 F10.
N2570 G01 X.9062 Y.1637 Z-.25 F10.
N2580 G17 G02 X.4865 Y.4519 Z-.25 I.0938 J.5863 K0.0 F10.
N2590 G01 X.5676 Y.499 Z-.25 F10.
N2600 G17 G02 X.5 Y.75 Z-.25 I.4324 J.251 K0.0 F10.
N2610 G01 X.5 Y1. Z-.25 F10.
N2620 G01 X-.5 Y1. Z-.25 F10.
N2630 G01 X-.5 Y.75 Z-.25 F10.
N2640 G17 G02 X-1. Y.25 Z-.25 I-.5 J0.0 K0.0 F10.
N2650 G01 X-1. Y-.25 Z-.25 F10.
N2660 G17 G02 X-.5 Y-.75 Z-.25 I0.0 J-.5 K0.0 F10.
N2670 G01 X-.5 Y-1. Z-.25 F10.
N2680 G01 X.5 Y-1. Z-.25 F10.
N2690 G01 X.5 Y-.75 Z-.25 F10.
N2700 G17 G02 X1. Y-.25 Z-.25 I.5 J0.0 K0.0 F10.
N2710 G01 X1. Y.25 Z-.25 F10.
N2720 G17 G02 X.5676 Y.499 Z-.25 I0.0 J.5 K0.0 F10.
N2730 G01 X.6486 Y.5461 Z-.25 F10.
N2740 G17 G02 X.5937 Y.75 Z-.25 I.3514 J.2039 K0.0 F10.
N2750 G01 X.5937 Y1.0937 Z-.25 F10.
N2760 G01 X-.5937 Y1.0937 Z-.25 F10.
N2770 G01 X-.5937 Y.75 Z-.25 F10.
N2780 G17 G02 X-1. Y.3437 Z-.25 I-.4063 J0.0 K0.0 F10.
N2790 G01 X-1.0937 Y.3437 Z-.25 F10.
N2800 G01 X-1.0937 Y-.3437 Z-.25 F10.
N2810 G01 X-1. Y-.3437 Z-.25 F10.
N2820 G17 G02 X-.5937 Y-.75 Z-.25 I0.0 J-.4063 K0.0 F10.
N2830 G01 X-.5937 Y-1.0937 Z-.25 F10.
N2840 G01 X.5937 Y-1.0937 Z-.25 F10.
N2850 G01 X.5937 Y-.75 Z-.25 F10.
N2860 G17 G02 X1. Y-.3437 Z-.25 I.4063 J0.0 K0.0 F10.
N2870 G01 X1.0937 Y-.3437 Z-.25 F10.
N2880 G01 X1.0937 Y.3437 Z-.25 F10.
N2890 G01 X1. Y.3437 Z-.25 F10.
N2900 G17 G02 X.6486 Y.5461 Z-.25 I0.0 J.4063 K0.0 F10.
N2910 G01 X.7297 Y.5931 Z-.25 F10.
N2920 G17 G02 X.6875 Y.75 Z-.25 I.2703 J.1569 K0.0 F10.
N2930 G01 X.6875 Y1.1875 Z-.25 F10.
N2940 G01 X-.6875 Y1.1875 Z-.25 F10.
N2950 G01 X-.6875 Y.75 Z-.25 F10.
N2960 G17 G02 X-1. Y.4375 Z-.25 I-.3125 J0.0 K0.0 F10.
N2970 G01 X-1.1875 Y.4375 Z-.25 F10.
N2980 G01 X-1.1875 Y-.4375 Z-.25 F10.
N2990 G01 X-1. Y-.4375 Z-.25 F10.
N3000 G17 G02 X-.6875 Y-.75 Z-.25 I0.0 J-.3125 K0.0 F10.
N3010 G01 X-.6875 Y-1.1875 Z-.25 F10.
N3020 G01 X.6875 Y-1.1875 Z-.25 F10.
N3030 G01 X.6875 Y-.75 Z-.25 F10.
N3040 G17 G02 X1. Y-.4375 Z-.25 I.3125 J0.0 K0.0 F10.
N3050 G01 X1.1875 Y-.4375 Z-.25 F10.
N3060 G01 X1.1875 Y.4375 Z-.25 F10.
N3070 G01 X1. Y.4375 Z-.25 F10.
N3080 G17 G02 X.7297 Y.5931 Z-.25 I0.0 J.3125 K0.0 F10.
N3090 G01 X.9196 Y.2777 Z-.25 F10.
N3100 G17 G03 X.8587 Y.583 Z-.25 I-.2223 J.1144 K0.0 F10.
N3110 G17 G02 X.8108 Y.6402 Z-.25 I.1413 J.167 K0.0 F10.
N3120 G17 G02 X.7812 Y.75 Z-.25 I.1892 J.1098 K0.0 F10.
N3130 G01 X.7812 Y1.2812 Z-.25 F10.
N3140 G01 X-.7812 Y1.2812 Z-.25 F10.
N3150 G01 X-.7812 Y.75 Z-.25 F10.
N3160 G17 G02 X-1. Y.5312 Z-.25 I-.2188 J0.0 K0.0 F10.
N3170 G01 X-1.2812 Y.5312 Z-.25 F10.
N3180 G01 X-1.2812 Y-.5312 Z-.25 F10.
N3190 G01 X-1. Y-.5312 Z-.25 F10.
N3200 G17 G02 X-.7812 Y-.75 Z-.25 I0.0 J-.2188 K0.0 F10.
N3210 G01 X-.7812 Y-1.2812 Z-.25 F10.
N3220 G01 X.7812 Y-1.2812 Z-.25 F10.
N3230 G01 X.7812 Y-.75 Z-.25 F10.
N3240 G17 G02 X1. Y-.5312 Z-.25 I.2188 J0.0 K0.0 F10.
N3250 G01 X1.2812 Y-.5312 Z-.25 F10.
N3260 G01 X1.2812 Y.5312 Z-.25 F10.
N3270 G01 X1. Y.5312 Z-.25 F10.
N3280 G17 G02 X.7849 Y.7102 Z-.25 I0.0 J.2188 K0.0 F10.
N3290 G17 G03 X.6502 Y.8886 Z-.25 I-.2458 J-.0455 K0.0 F10.
N3300 G01 X1.0827 Y.3574 Z-.25 F10.
N3310 G17 G03 X.9462 Y.6372 Z-.25 I-.2441 J.0541 K0.0 F10.
N3320 G17 G02 X.8919 Y.6872 Z-.25 I.0538 J.1128 K0.0 F10.
N3330 G17 G02 X.875 Y.75 Z-.25 I.1081 J.0628 K0.0 F10.
N3340 G01 X.875 Y1.375 Z-.25 F10.
N3350 G01 X-.875 Y1.375 Z-.25 F10.
N3360 G01 X-.875 Y.75 Z-.25 F10.
N3370 G17 G02 X-1. Y.625 Z-.25 I-.125 J0.0 K0.0 F10.
N3380 G01 X-1.375 Y.625 Z-.25 F10.
N3390 G01 X-1.375 Y-.625 Z-.25 F10.
N3400 G01 X-1. Y-.625 Z-.25 F10.
N3410 G17 G02 X-.875 Y-.75 Z-.25 I0.0 J-.125 K0.0 F10.
N3420 G01 X-.875 Y-1.375 Z-.25 F10.
N3430 G01 X.875 Y-1.375 Z-.25 F10.
N3440 G01 X.875 Y-.75 Z-.25 F10.
N3450 G17 G02 X1. Y-.625 Z-.25 I.125 J0.0 K0.0 F10.
N3460 G01 X1.375 Y-.625 Z-.25 F10.
N3470 G01 X1.375 Y.625 Z-.25 F10.
N3480 G01 X1. Y.625 Z-.25 F10.
N3490 G17 G02 X.875 Y.75 Z-.25 I0.0 J.125 K0.0 F10.
N3500 G01 X.875 Y.7593 Z-.25 F10.
N3510 G17 G03 X.775 Y.9593 Z-.25 I-.25 J0.0 K0.0 F10.
N3520 G01 X.775 Y.9593 Z-.15 F20.
N3530 G01 X.775 Y.9593 Z.2 F20.
N3540 G01 X.0037 Y.1633 Z.2 F20.
N3550 G01 X.0037 Y.1633 Z-.15 F20.
N3560 G01 X0.0 Y.1696 Z-.1519 F10.
N3570 G01 X-.0241 Y.128 Z-.1648 F10.
N3580 G01 X-.0888 Y.0366 Z-.1948 F10.
N3590 G01 X-.12 Y0.0 Z-.2077 F10.
N3600 G01 X-.0888 Y-.0366 Z-.2206 F10.
N3610 G01 X-.0241 Y-.128 Z-.2506 F10.
N3620 G01 X0.0 Y-.1696 Z-.2635 F10.
N3630 G01 X.0241 Y-.128 Z-.2764 F10.
N3640 G01 X.0888 Y-.0366 Z-.3063 F10.
N3650 G01 X.12 Y0.0 Z-.3192 F10.
N3660 G01 X.0888 Y.0366 Z-.3321 F10.
N3670 G01 X.0241 Y.128 Z-.3621 F10.
N3680 G01 X0.0 Y.1696 Z-.375 F10.
N3690 G17 G02 X-.12 Y0.0 Z-.375 I-1. J.5804 K0.0 F10.
N3700 G17 G02 X0.0 Y-.1696 Z-.375 I-.88 J-.75 K0.0 F10.
N3710 G17 G02 X.12 Y0.0 Z-.375 I1. J-.5804 K0.0 F10.
N3720 G17 G02 X0.0 Y.1696 Z-.375 I.88 J.75 K0.0 F10.
N3730 G01 X.0811 Y.2166 Z-.375 F10.
N3740 G17 G02 X0.0 Y.391 Z-.375 I.9189 J.5334 K0.0 F10.
N3750 G17 G02 X-.2474 Y0.0 Z-.375 I-1. J.359 K0.0 F10.
N3760 G17 G02 X0.0 Y-.391 Z-.375 I-.7526 J-.75 K0.0 F10.
N3770 G17 G02 X.2474 Y0.0 Z-.375 I1. J-.359 K0.0 F10.
N3780 G17 G02 X.0811 Y.2166 Z-.375 I.7526 J.75 K0.0 F10.
N3790 G01 X.1622 Y.2637 Z-.375 F10.
N3800 G17 G02 X.0563 Y.5312 Z-.375 I.8378 J.4863 K0.0 F10.
N3810 G01 X-.0563 Y.5312 Z-.375 F10.
N3820 G17 G02 X-.3868 Y0.0 Z-.375 I-.9437 J.2188 K0.0 F10.
N3830 G17 G02 X-.0882 Y-.4226 Z-.375 I-.6132 J-.75 K0.0 F10.
N3840 G17 G02 X-.0563 Y-.5312 Z-.375 I-.9118 J-.3274 K0.0 F10.
N3850 G01 X.0563 Y-.5312 Z-.375 F10.
N3860 G17 G02 X.0882 Y-.4226 Z-.375 I.9437 J-.2188 K0.0 F10.
N3870 G17 G02 X.3868 Y0.0 Z-.375 I.9118 J-.3274 K0.0 F10.
N3880 G17 G02 X.1622 Y.2637 Z-.375 I.6132 J.75 K0.0 F10.
N3890 G01 X.2432 Y.3107 Z-.375 F10.
N3900 G17 G02 X.134 Y.625 Z-.375 I.7568 J.4393 K0.0 F10.
N3910 G01 X-.134 Y.625 Z-.375 F10.
N3920 G17 G02 X-.5493 Y0.0 Z-.375 I-.866 J.125 K0.0 F10.
N3930 G17 G02 X-.134 Y-.625 Z-.375 I-.4507 J-.75 K0.0 F10.
N3940 G01 X.134 Y-.625 Z-.375 F10.
N3950 G17 G02 X.5493 Y0.0 Z-.375 I.866 J-.125 K0.0 F10.
N3960 G17 G02 X.2432 Y.3107 Z-.375 I.4507 J.75 K0.0 F10.
N3970 G01 X.3243 Y.3578 Z-.375 F10.
N3980 G17 G02 X.2194 Y.7187 Z-.375 I.6757 J.3922 K0.0 F10.
N3990 G01 X-.2194 Y.7187 Z-.375 F10.
N4000 G17 G02 X-.7187 Y.0211 Z-.375 I-.7806 J.0313 K0.0 F10.
N4010 G01 X-.7187 Y-.0211 Z-.375 F10.
N4020 G17 G02 X-.2194 Y-.7187 Z-.375 I-.2813 J-.7289 K0.0 F10.
N4030 G01 X.2194 Y-.7187 Z-.375 F10.
N4040 G17 G02 X.7187 Y-.0211 Z-.375 I.7806 J-.0313 K0.0 F10.
N4050 G01 X.7187 Y.0211 Z-.375 F10.
N4060 G17 G02 X.3243 Y.3578 Z-.375 I.2813 J.7289 K0.0 F10.
N4070 G01 X.4054 Y.4049 Z-.375 F10.
N4080 G17 G02 X.3125 Y.75 Z-.375 I.5946 J.3451 K0.0 F10.
N4090 G01 X.3125 Y.8125 Z-.375 F10.
N4100 G01 X-.3125 Y.8125 Z-.375 F10.
N4110 G01 X-.3125 Y.75 Z-.375 F10.
N4120 G17 G02 X-.8125 Y.0886 Z-.375 I-.6875 J0.0 K0.0 F10.
N4130 G01 X-.8125 Y-.0886 Z-.375 F10.
N4140 G17 G02 X-.3125 Y-.75 Z-.375 I-.1875 J-.6614 K0.0 F10.
N4150 G01 X-.3125 Y-.8125 Z-.375 F10.
N4160 G01 X.3125 Y-.8125 Z-.375 F10.
N4170 G01 X.3125 Y-.75 Z-.375 F10.
N4180 G17 G02 X.8125 Y-.0886 Z-.375 I.6875 J0.0 K0.0 F10.
N4190 G01 X.8125 Y.0886 Z-.375 F10.
N4200 G17 G02 X.4054 Y.4049 Z-.375 I.1875 J.6614 K0.0 F10.
N4210 G01 X.4865 Y.4519 Z-.375 F10.
N4220 G17 G02 X.4062 Y.75 Z-.375 I.5135 J.2981 K0.0 F10.
N4230 G01 X.4062 Y.9062 Z-.375 F10.
N4240 G01 X-.4062 Y.9062 Z-.375 F10.
N4250 G01 X-.4062 Y.75 Z-.375 F10.
N4260 G17 G02 X-.9062 Y.1637 Z-.375 I-.5938 J0.0 K0.0 F10.
N4270 G01 X-.9062 Y-.1637 Z-.375 F10.
N4280 G17 G02 X-.4062 Y-.75 Z-.375 I-.0938 J-.5863 K0.0 F10.
N4290 G01 X-.4062 Y-.9062 Z-.375 F10.
N4300 G01 X.4062 Y-.9062 Z-.375 F10.
N4310 G01 X.4062 Y-.75 Z-.375 F10.
N4320 G17 G02 X.9062 Y-.1637 Z-.375 I.5938 J0.0 K0.0 F10.
N4330 G01 X.9062 Y.1637 Z-.375 F10.
N4340 G17 G02 X.4865 Y.4519 Z-.375 I.0938 J.5863 K0.0 F10.
N4350 G01 X.5676 Y.499 Z-.375 F10.
N4360 G17 G02 X.5 Y.75 Z-.375 I.4324 J.251 K0.0 F10.
N4370 G01 X.5 Y1. Z-.375 F10.
N4380 G01 X-.5 Y1. Z-.375 F10.
N4390 G01 X-.5 Y.75 Z-.375 F10.
N4400 G17 G02 X-1. Y.25 Z-.375 I-.5 J0.0 K0.0 F10.
N4410 G01 X-1. Y-.25 Z-.375 F10.
N4420 G17 G02 X-.5 Y-.75 Z-.375 I0.0 J-.5 K0.0 F10.
N4430 G01 X-.5 Y-1. Z-.375 F10.
N4440 G01 X.5 Y-1. Z-.375 F10.
N4450 G01 X.5 Y-.75 Z-.375 F10.
N4460 G17 G02 X1. Y-.25 Z-.375 I.5 J0.0 K0.0 F10.
N4470 G01 X1. Y.25 Z-.375 F10.
N4480 G17 G02 X.5676 Y.499 Z-.375 I0.0 J.5 K0.0 F10.
N4490 G01 X.6486 Y.5461 Z-.375 F10.
N4500 G17 G02 X.5937 Y.75 Z-.375 I.3514 J.2039 K0.0 F10.
N4510 G01 X.5937 Y1.0937 Z-.375 F10.
N4520 G01 X-.5937 Y1.0937 Z-.375 F10.
N4530 G01 X-.5937 Y.75 Z-.375 F10.
N4540 G17 G02 X-1. Y.3437 Z-.375 I-.4063 J0.0 K0.0 F10.
N4550 G01 X-1.0937 Y.3437 Z-.375 F10.
N4560 G01 X-1.0937 Y-.3437 Z-.375 F10.
N4570 G01 X-1. Y-.3437 Z-.375 F10.
N4580 G17 G02 X-.5937 Y-.75 Z-.375 I0.0 J-.4063 K0.0 F10.
N4590 G01 X-.5937 Y-1.0937 Z-.375 F10.
N4600 G01 X.5937 Y-1.0937 Z-.375 F10.
N4610 G01 X.5937 Y-.75 Z-.375 F10.
N4620 G17 G02 X1. Y-.3437 Z-.375 I.4063 J0.0 K0.0 F10.
N4630 G01 X1.0937 Y-.3437 Z-.375 F10.
N4640 G01 X1.0937 Y.3437 Z-.375 F10.
N4650 G01 X1. Y.3437 Z-.375 F10.
N4660 G17 G02 X.6486 Y.5461 Z-.375 I0.0 J.4063 K0.0 F10.
N4670 G01 X.7297 Y.5931 Z-.375 F10.
N4680 G17 G02 X.6875 Y.75 Z-.375 I.2703 J.1569 K0.0 F10.
N4690 G01 X.6875 Y1.1875 Z-.375 F10.
N4700 G01 X-.6875 Y1.1875 Z-.375 F10.
N4710 G01 X-.6875 Y.75 Z-.375 F10.
N4720 G17 G02 X-1. Y.4375 Z-.375 I-.3125 J0.0 K0.0 F10.
N4730 G01 X-1.1875 Y.4375 Z-.375 F10.
N4740 G01 X-1.1875 Y-.4375 Z-.375 F10.
N4750 G01 X-1. Y-.4375 Z-.375 F10.
N4760 G17 G02 X-.6875 Y-.75 Z-.375 I0.0 J-.3125 K0.0 F10.
N4770 G01 X-.6875 Y-1.1875 Z-.375 F10.
N4780 G01 X.6875 Y-1.1875 Z-.375 F10.
N4790 G01 X.6875 Y-.75 Z-.375 F10.
N4800 G17 G02 X1. Y-.4375 Z-.375 I.3125 J0.0 K0.0 F10.
N4810 G01 X1.1875 Y-.4375 Z-.375 F10.
N4820 G01 X1.1875 Y.4375 Z-.375 F10.
N4830 G01 X1. Y.4375 Z-.375 F10.
N4840 G17 G02 X.7297 Y.5931 Z-.375 I0.0 J.3125 K0.0 F10.
N4850 G01 X.9196 Y.2777 Z-.375 F10.
N4860 G17 G03 X.8587 Y.583 Z-.375 I-.2223 J.1144 K0.0 F10.
N4870 G17 G02 X.8108 Y.6402 Z-.375 I.1413 J.167 K0.0 F10.
N4880 G17 G02 X.7812 Y.75 Z-.375 I.1892 J.1098 K0.0 F10.
N4890 G01 X.7812 Y1.2812 Z-.375 F10.
N4900 G01 X-.7812 Y1.2812 Z-.375 F10.
N4910 G01 X-.7812 Y.75 Z-.375 F10.
N4920 G17 G02 X-1. Y.5312 Z-.375 I-.2188 J0.0 K0.0 F10.
N4930 G01 X-1.2812 Y.5312 Z-.375 F10.
N4940 G01 X-1.2812 Y-.5312 Z-.375 F10.
N4950 G01 X-1. Y-.5312 Z-.375 F10.
N4960 G17 G02 X-.7812 Y-.75 Z-.375 I0.0 J-.2188 K0.0 F10.
N4970 G01 X-.7812 Y-1.2812 Z-.375 F10.
N4980 G01 X.7812 Y-1.2812 Z-.375 F10.
N4990 G01 X.7812 Y-.75 Z-.375 F10.
N5000 G17 G02 X1. Y-.5312 Z-.375 I.2188 J0.0 K0.0 F10.
N5010 G01 X1.2812 Y-.5312 Z-.375 F10.
N5020 G01 X1.2812 Y.5312 Z-.375 F10.
N5030 G01 X1. Y.5312 Z-.375 F10.
N5040 G17 G02 X.7849 Y.7102 Z-.375 I0.0 J.2188 K0.0 F10.
N5050 G17 G03 X.6502 Y.8886 Z-.375 I-.2458 J-.0455 K0.0 F10.
N5060 G01 X1.0827 Y.3574 Z-.375 F10.
N5070 G17 G03 X.9462 Y.6372 Z-.375 I-.2441 J.0541 K0.0 F10.
N5080 G17 G02 X.8919 Y.6872 Z-.375 I.0538 J.1128 K0.0 F10.
N5090 G17 G02 X.875 Y.75 Z-.375 I.1081 J.0628 K0.0 F10.
N5100 G01 X.875 Y1.375 Z-.375 F10.
N5110 G01 X-.875 Y1.375 Z-.375 F10.
N5120 G01 X-.875 Y.75 Z-.375 F10.
N5130 G17 G02 X-1. Y.625 Z-.375 I-.125 J0.0 K0.0 F10.
N5140 G01 X-1.375 Y.625 Z-.375 F10.
N5150 G01 X-1.375 Y-.625 Z-.375 F10.
N5160 G01 X-1. Y-.625 Z-.375 F10.
N5170 G17 G02 X-.875 Y-.75 Z-.375 I0.0 J-.125 K0.0 F10.
N5180 G01 X-.875 Y-1.375 Z-.375 F10.
N5190 G01 X.875 Y-1.375 Z-.375 F10.
N5200 G01 X.875 Y-.75 Z-.375 F10.
N5210 G17 G02 X1. Y-.625 Z-.375 I.125 J0.0 K0.0 F10.
N5220 G01 X1.375 Y-.625 Z-.375 F10.
N5230 G01 X1.375 Y.625 Z-.375 F10.
N5240 G01 X1. Y.625 Z-.375 F10.
N5250 G17 G02 X.875 Y.75 Z-.375 I0.0 J.125 K0.0 F10.
N5260 G01 X.875 Y.7593 Z-.375 F10.
N5270 G17 G03 X.775 Y.9593 Z-.375 I-.25 J0.0 K0.0 F10.
N5280 G43 T01 H01 M06
N5290 G01 X.3422 Y-3.8348 Z.25 F20. S0 M03
N5300 G01 X.3422 Y-3.8348 Z.1 F20.
N5310 G01 X.3422 Y-3.8348 Z-.025 F20.
N5320 G01 X.3422 Y-3.8348 Z-.125 F10.
N5330 G17 G03 X.1426 Y-3.7473 Z-.125 I-.1901 J-.1623 K0.0 F10.
N5340 G17 G02 X.0676 Y-3.7494 Z-.125 I-.1426 J3.7473 K0.0 F10.
N5350 G17 G02 X-3.2143 Y-1.9315 Z-.125 I-.0676 J3.7494 K0.0 F10.
N5360 G17 G02 X-3.25 Y-1.8028 Z-.125 I.2143 J.1287 K0.0 F10.
N5370 G01 X-3.25 Y1.8028 Z-.125 F10.
N5380 G17 G02 X-3.2143 Y1.9315 Z-.125 I.25 J0.0 K0.0 F10.
N5390 G17 G02 X3.2143 Y1.9315 Z-.125 I3.2143 J-1.9315 K0.0 F10.
N5400 G17 G02 X3.25 Y1.8028 Z-.125 I-.2143 J-.1287 K0.0 F10.
N5410 G01 X3.25 Y-1.8028 Z-.125 F10.
N5420 G17 G02 X3.2143 Y-1.9315 Z-.125 I-.25 J0.0 K0.0 F10.
N5430 G17 G02 X-.0074 Y-3.75 Z-.125 I-3.2143 J1.9315 K0.0 F10.
N5440 G17 G03 X-.2076 Y-3.8496 Z-.125 I-.0005 J-.25 K0.0 F10.
N5450 G01 X-.2076 Y-3.8496 Z-.025 F20.
N5460 G01 X-.2076 Y-3.8496 Z.25 F20.
N5470 G01 X.3422 Y-3.8348 Z.25 F20.
N5480 G01 X.3422 Y-3.8348 Z-.025 F20.
N5490 G01 X.3422 Y-3.8348 Z-.15 F20.
N5500 G01 X.3422 Y-3.8348 Z-.25 F10.
N5510 G17 G03 X.1426 Y-3.7473 Z-.25 I-.1901 J-.1623 K0.0 F10.
N5520 G17 G02 X.0676 Y-3.7494 Z-.25 I-.1426 J3.7473 K0.0 F10.
N5530 G17 G02 X-3.2143 Y-1.9315 Z-.25 I-.0676 J3.7494 K0.0 F10.
N5540 G17 G02 X-3.25 Y-1.8028 Z-.25 I.2143 J.1287 K0.0 F10.
N5550 G01 X-3.25 Y1.8028 Z-.25 F10.
N5560 G17 G02 X-3.2143 Y1.9315 Z-.25 I.25 J0.0 K0.0 F10.
N5570 G17 G02 X3.2143 Y1.9315 Z-.25 I3.2143 J-1.9315 K0.0 F10.
N5580 G17 G02 X3.25 Y1.8028 Z-.25 I-.2143 J-.1287 K0.0 F10.
N5590 G01 X3.25 Y-1.8028 Z-.25 F10.
N5600 G17 G02 X3.2143 Y-1.9315 Z-.25 I-.25 J0.0 K0.0 F10.
N5610 G17 G02 X-.0074 Y-3.75 Z-.25 I-3.2143 J1.9315 K0.0 F10.
N5620 G17 G03 X-.2076 Y-3.8496 Z-.25 I-.0005 J-.25 K0.0 F10.
N5630 G01 X-.2076 Y-3.8496 Z-.15 F20.
N5640 G01 X-.2076 Y-3.8496 Z.25 F20.
N5650 G01 X.3422 Y-3.8348 Z.25 F20.
N5660 G01 X.3422 Y-3.8348 Z-.15 F20.
N5670 G01 X.3422 Y-3.8348 Z-.275 F20.
N5680 G01 X.3422 Y-3.8348 Z-.375 F10.
N5690 G17 G03 X.1426 Y-3.7473 Z-.375 I-.1901 J-.1623 K0.0 F10.
N5700 G17 G02 X.0676 Y-3.7494 Z-.375 I-.1426 J3.7473 K0.0 F10.
N5710 G17 G02 X-3.2143 Y-1.9315 Z-.375 I-.0676 J3.7494 K0.0 F10.
N5720 G17 G02 X-3.25 Y-1.8028 Z-.375 I.2143 J.1287 K0.0 F10.
N5730 G01 X-3.25 Y1.8028 Z-.375 F10.
N5740 G17 G02 X-3.2143 Y1.9315 Z-.375 I.25 J0.0 K0.0 F10.
N5750 G17 G02 X3.2143 Y1.9315 Z-.375 I3.2143 J-1.9315 K0.0 F10.
N5760 G17 G02 X3.25 Y1.8028 Z-.375 I-.2143 J-.1287 K0.0 F10.
N5770 G01 X3.25 Y-1.8028 Z-.375 F10.
N5780 G17 G02 X3.2143 Y-1.9315 Z-.375 I-.25 J0.0 K0.0 F10.
N5790 G17 G02 X-.0074 Y-3.75 Z-.375 I-3.2143 J1.9315 K0.0 F10.
N5800 G17 G03 X-.2076 Y-3.8496 Z-.375 I-.0005 J-.25 K0.0 F10.
N5810 G01 X-.2076 Y-3.8496 Z-.275 F20.
N5820 G01 X-.2076 Y-3.8496 Z.25 F20.
N5830 G01 X.3422 Y-3.8348 Z.25 F20.
N5840 G01 X.3422 Y-3.8348 Z-.275 F20.
N5850 G01 X.3422 Y-3.8348 Z-.4 F20.
N5860 G01 X.3422 Y-3.8348 Z-.5 F10.
N5870 G17 G03 X.1426 Y-3.7473 Z-.5 I-.1901 J-.1623 K0.0 F10.
N5880 G17 G02 X.0676 Y-3.7494 Z-.5 I-.1426 J3.7473 K0.0 F10.
N5890 G17 G02 X-3.2143 Y-1.9315 Z-.5 I-.0676 J3.7494 K0.0 F10.
N5900 G17 G02 X-3.25 Y-1.8028 Z-.5 I.2143 J.1287 K0.0 F10.
N5910 G01 X-3.25 Y1.8028 Z-.5 F10.
N5920 G17 G02 X-3.2143 Y1.9315 Z-.5 I.25 J0.0 K0.0 F10.
N5930 G17 G02 X3.2143 Y1.9315 Z-.5 I3.2143 J-1.9315 K0.0 F10.
N5940 G17 G02 X3.25 Y1.8028 Z-.5 I-.2143 J-.1287 K0.0 F10.
N5950 G01 X3.25 Y-1.8028 Z-.5 F10.
N5960 G17 G02 X3.2143 Y-1.9315 Z-.5 I-.25 J0.0 K0.0 F10.
N5970 G17 G02 X-.0074 Y-3.75 Z-.5 I-3.2143 J1.9315 K0.0 F10.
N5980 G17 G03 X-.2076 Y-3.8496 Z-.5 I-.0005 J-.25 K0.0 F10.
N5990 G01 X-.2076 Y-3.8496 Z-.4 F20.
N6000 G01 X-.2076 Y-3.8496 Z.25 F20.
N6010 G01 X.3422 Y-3.8348 Z.25 F20.
N6020 G01 X.3422 Y-3.8348 Z-.4 F20.
N6030 G01 X.3422 Y-3.8348 Z-.525 F20.
N6040 G01 X.3422 Y-3.8348 Z-.625 F10.
N6050 G17 G03 X.1426 Y-3.7473 Z-.625 I-.1901 J-.1623 K0.0 F10.
N6060 G17 G02 X.0676 Y-3.7494 Z-.625 I-.1426 J3.7473 K0.0 F10.
N6070 G17 G02 X-3.2143 Y-1.9315 Z-.625 I-.0676 J3.7494 K0.0 F10.
N6080 G17 G02 X-3.25 Y-1.8028 Z-.625 I.2143 J.1287 K0.0 F10.
N6090 G01 X-3.25 Y1.8028 Z-.625 F10.
N6100 G17 G02 X-3.2143 Y1.9315 Z-.625 I.25 J0.0 K0.0 F10.
N6110 G17 G02 X3.2143 Y1.9315 Z-.625 I3.2143 J-1.9315 K0.0 F10.
N6120 G17 G02 X3.25 Y1.8028 Z-.625 I-.2143 J-.1287 K0.0 F10.
N6130 G01 X3.25 Y-1.8028 Z-.625 F10.
N6140 G17 G02 X3.2143 Y-1.9315 Z-.625 I-.25 J0.0 K0.0 F10.
N6150 G17 G02 X-.0074 Y-3.75 Z-.625 I-3.2143 J1.9315 K0.0 F10.
N6160 G17 G03 X-.2076 Y-3.8496 Z-.625 I-.0005 J-.25 K0.0 F10.
N6170 G01 X-.2076 Y-3.8496 Z-.525 F20.
N6180 G01 X-.2076 Y-3.8496 Z.25 F20.
N6190 G01 X.3422 Y-3.8348 Z.25 F20.
N6200 G01 X.3422 Y-3.8348 Z-.525 F20.
N6210 G01 X.3422 Y-3.8348 Z-.65 F20.
N6220 G01 X.3422 Y-3.8348 Z-.75 F10.
N6230 G17 G03 X.1426 Y-3.7473 Z-.75 I-.1901 J-.1623 K0.0 F10.
N6240 G17 G02 X.0676 Y-3.7494 Z-.75 I-.1426 J3.7473 K0.0 F10.
N6250 G17 G02 X-3.2143 Y-1.9315 Z-.75 I-.0676 J3.7494 K0.0 F10.
N6260 G17 G02 X-3.25 Y-1.8028 Z-.75 I.2143 J.1287 K0.0 F10.
N6270 G01 X-3.25 Y1.8028 Z-.75 F10.
N6280 G17 G02 X-3.2143 Y1.9315 Z-.75 I.25 J0.0 K0.0 F10.
N6290 G17 G02 X3.2143 Y1.9315 Z-.75 I3.2143 J-1.9315 K0.0 F10.
N6300 G17 G02 X3.25 Y1.8028 Z-.75 I-.2143 J-.1287 K0.0 F10.
N6310 G01 X3.25 Y-1.8028 Z-.75 F10.
N6320 G17 G02 X3.2143 Y-1.9315 Z-.75 I-.25 J0.0 K0.0 F10.
N6330 G17 G02 X-.0074 Y-3.75 Z-.75 I-3.2143 J1.9315 K0.0 F10.
N6340 G17 G03 X-.2076 Y-3.8496 Z-.75 I-.0005 J-.25 K0.0 F10.
N6350 G01 X-.2076 Y-3.8496 Z.25 F20.
N6360 M02
%



N100 G20
N102 G0 G17 G40 G49 G80 G90
N106 G54 X0. Y0. Z0.5 ( Z value is clearance over part ( initial Plane))
N108 Z.5 (it can be placed on seperate line)
N112 G0 G90 X-.3164 Y1.9337 (G90 is not needed it has already been established in N102)
N116 Z.1 (Establish clearance plane)
N118 G1 Z0. F5. (Since top of part has been established as Z0, Z value will be negative number for depth of cut Ex: Z-0.125)
N120 Y1.5587 F10.
N122 G3 X.0586 Y1.1837 R.375 (counterclockwise radius .375)
N124 G1 X.3021 (linear (straight line) move)
N126 G2 X.4356 Y1.1403 R.2269 (clockwise radius .2269)
N128 G1 X1.2751 Y.5297
N130 G2 X1.3686 Y.3462 R.2269
N132 G1 Y-.148
N134 G2 X1.287 Y-.3223 R.2269
N136 X-.0031 Y-.7661 R1.9182
N138 G1 X-1.8504
N140 G2 X-2.2348 Y-.3818 R.3843
N142 G1 Y-.2756
N144 G2 X-1.9685 Y-.0094 R.2663
N146 G1 X0.
N148 G3 Y.0094 R.0094
N150 G1 X-1.9685
N152 G2 X-2.2348 Y.2756 R.2662
N154 G1 Y.4056
N156 G2 X-1.8504 Y.7899 R.3844
N158 G1 X-1.4255
N160 G3 X-.3102 Y1.146 R2.1525
N162 G2 X-.185 Y1.1837 R.2269
N164 G1 X.0586
N166 G3 X.4336 Y1.5587 R.375
N168 G1 Y1.9337
N170 Z.1 F6.42 ( Usually G00 move G00 Z.1)
N182 G0 G90 X.2253 Y.7087
N186 G99 G81 Z0. R.1 F5.76 (This is a drill cycle will feed to z depth at a feed of 5.76 and retract to R.1 clearance or initial clearance .1 depending on using G99 or G98 here your initial plane(N170) and retract (R value) are the same)
N188 X.9027 Y.2107 (will repeat G81 at this location)
N190 G80 (cancels G81)
N194 X0. Y0. (back to part zero)
N196 Z0. (should be a positive number)
N198 M30 ( ends program and rewinds to top)

bumper
11-21-2006, 11:00 AM
Ok wayne i will keep trying to see what i can come up with, thanks

davidflana
01-04-2007, 04:17 PM
Wayne, if this works, you are a GOD SEND!

I have some gcode files that do not seem to convert right using your software. Can you look at them?

Here's one:
H DX1219.20 DY273.05 DZ19.05 -AB R1 /DEF

*R99P0001

O Y=350

F1

C2

G0 X=711.20 Y=-21.33 Z=-6.35 V2 S18 T201

G1 X=711.20 Y=-9.14 Z=19.25 V2

G1 X=711.20 Y=127.00 Z=19.25 V3

G1 X=863.60 Y=127.00 Z=19.25 V3

G1 X=863.60 Y=-9.14 Z=19.25 V3

G1 X=863.60 Y=-21.34 Z=-6.35 V3

G0 X=138.23 Y=42.83 Z=-6.35 V3 S18 T201

G3 X=88.15 Y=69.10 Z=20.52 I=155.32 J=136.27 V3

G3 X=60.32 Y=136.27 I=155.32 J=136.27 V3

G1 X=60.32 Y=136.78 Z=20.52 V3

G3 X=155.32 Y=231.77 I=155.32 J=136.78 V3

G1 X=155.83 Y=231.77 Z=20.52 V3

G3 X=250.82 Y=136.78 I=155.83 J=136.78 V3

G1 X=250.82 Y=136.27 Z=20.52 V3

G3 X=155.83 Y=41.27 I=155.83 J=136.27 V3

G1 X=155.32 Y=41.27 Z=20.52 V3

G3 X=88.15 Y=69.10 I=155.32 J=136.27 V3

G3 X=79.60 Y=78.91 I=155.32 J=136.27 V3

G0 X=1046.28 Y=42.83 Z=-6.35 V3 S18 T201

G3 X=996.20 Y=69.10 Z=20.52 I=1063.37 J=136.27 V3

G3 X=968.37 Y=136.27 I=1063.37 J=136.27 V3

G1 X=968.37 Y=136.78 Z=20.52 V3

G3 X=1063.37 Y=231.77 I=1063.37 J=136.78 V3

G1 X=1063.88 Y=231.77 Z=20.52 V3

G3 X=1158.87 Y=136.78 I=1063.88 J=136.78 V3

G1 X=1158.87 Y=136.27 Z=20.52 V3

G3 X=1063.88 Y=41.27 I=1063.88 J=136.27 V3

G1 X=1063.37 Y=41.27 Z=20.52 V3

G3 X=996.20 Y=69.10 I=1063.37 J=136.27 V3

G3 X=987.65 Y=78.91 I=1063.37 J=136.27 V3




And another:
G70X34.5Y23.875Z0.75T00D48N27L26
G150(left side, a=toe height, b=toe depth, c=top drawer) A4.5B3.5C6.125
!D=37/25.4 E=261/25.4 F=357/25.4 G=453/25.4 I=517/25.4
* T1=2 R0=0.9 R1=16 R2=24
* T2=14 R0=0.9 R1=16.0519 R2=24
* T3=26.9621 R0=4.4001 R1=16.1391 R2=24.3741
G88G90G54P5T01c2G41X=l-a Y-1Z0.875
G1G90X=l-a Y=b Z0.875
G1G90X=l Y=b Z0.875
G1G90X=l Y=h+1 Z0.875
G88G90G54P5T01c2G42X-1Y=h-0.875 Z0.375
G1G90X=l+1 Y=h-0.875 Z0.375
G185G54P5R54=8/25.4 X=l-(a-1) Y=b+0.375 Z0.375I=l K=64/25.4
G186G54P5R54=8/25.4 X=l-(a+0.375) Y1Z0.5J=h-1 K=64/25.4
G186G54P5R54=5/25.4 X=l-(a+1.4375) Y=d Z0.5J=d+32/25.4 K=32/25.4
G186G54P5R54=5/25.4 X=l-(a+1.4375) Y=i Z0.5J=i-32/25.4 K=32/25.4
G0G90G54P5L004/X=l-(a+3.0625) A0
G186G54P5R54=8/25.4 X0.375Y1Z0.5J5K=64/25.4
G186G54P5R54=8/25.4 X0.375Y=h-1.875 Z0.5J=h-5.875 K=64/25.4
G186G54P5R54=8/25.4 X=c Y1Z0.5J5K=64/25.4
G81G90G54P5R54=5/25.4 X=c-1.875 Y=37/25.4 Z0.5
G81G90G54P5R54=5/25.4 X=c-1.875 Y=e Z0.5
G81G90G54P5R54=5/25.4 X=c-1.875 Y=i Z0.5
G0G90G54P5L004/X=c+3 A0
G185G54P5R54=5/25.4 X=l-(a+6) Y=i Z0.5I=c+6 K=32/25.4
G185G54P5R54=5/25.4 X=l-(a+6) Y=d Z0.5I=c+6 K=32/25.4
M2



They are taken from two completely different systems.
If you can make sense of either, that would be great!

Thanks!

Dave

ger21
01-04-2007, 06:51 PM
This program will convert a standard line-arc gcode file to a DXF file.


Those are not "standard" g-code.

WayneHill
01-07-2007, 12:32 AM
Wayne, if this works, you are a GOD SEND!

I have some gcode files that do not seem to convert right using your software. Can you look at them?
....

Thanks!

Dave

"It's against my programming to impersonate a deity." -C3PO, Return of the Jedi

"I'm sorry Dave, I'm afraid I can't do that." -HAL, 2001: A Space Odyssey

ger21
01-07-2007, 07:18 AM
That second one is an interesting way to convert mm to inches :eek:

JonK
02-11-2007, 02:47 PM
I have taken WayneHill's source code and ported it to C#. I also added a couple of features that I found useful, mainly the ability to not create lines that represented rapid movement (G00) and/or when the Z axis is above the surface of the work piece. These cleaned up the resulting drawing significantly for me in a couple of cases and saved a bunch of manual cleanup.

Like Wayne's original application, this one really only handles basic g-code functions G00/G01/G02/G03. Two things I know I want to add are the ability to handle RS-274/NGC style in-line comments and a help file, but I think most people will figure out how to use it.

If you want to eliminate lines that represent non-cutting movement and you don't know the Z coordinate surface, selecting the option not to draw rapid positioning movements generally does a pretty good job. If you know the Z coordinate of the surface, selecting the option not to draw movements above the work surface provides better results. There is probably no need to use both of these options together, but it shouldn't hurt anything.

If you try it, I'd love to know whether or not it worked for you. I'm also open to any ideas for additional features (no promises). I'd like to make this as useful as possible.

WayneHill
02-12-2007, 12:47 PM
Hi Jonk,

Your program looks good. Are you using Borland C#? Is there a hint of a TMS custom component menu? Borland Delphi is my main program format. I dropped the Powerbasic language due to it's limitations.

Welcome to this forum. What other projects are you working on or plan to work on?

Wayne

JonK
02-12-2007, 08:20 PM
Wayne,

I put this together with Microsoft Visual Studio 2005 using built-in components.

In the other projects catagory, I've CNCed my Grizzly G0463 Mill/Drill and have been playing with it using eMachineShop to generate DXF files, CamBam (a wonderful piece of free software!) to generate g-code, CncSimulator to check out the g-code before I ruin any hardware, and EMCII to drive the stepper controller. Not sure exactly where I'm headed with this, but it's been a fun journey so far!

alilou
02-24-2007, 11:39 AM
hello!
can any one give AP100US ?
it's a soft for punch cnc machine
thanks

Switcher
08-06-2007, 09:13 AM
Wayne, I ported your code to "VB.Net 2005", thanks for the source. :)

mikkojay, your VB6 code helped to, thanks both.



I didn't change much, I might add a file splitter later, maybe split large g-code files.




.

WayneHill
08-06-2007, 10:12 AM
Hi Switcher,

Looks good.

What's with all those source file's? My program only had one source file :)


Wayne

Switcher
08-06-2007, 04:52 PM
Hi Switcher,

Looks good.

What's with all those source file's? My program only had one source file :)


Wayne

I guess it's a vb.net thing. :)




.

Bubba
08-06-2007, 07:40 PM
Wayne,
I have to thank you for the original program!
today, I attempted to open a dxf to make some changes and the darn thing was corrupted. fortunately, I had posted it to a g-code file and was able recover my original stuff!

Thanks!

WayneHill
08-06-2007, 08:02 PM
Switcher: Yes it is VB.NET thing. That's why we need bigger hardrives...

I stopped using PowerBASIC and moved to Delphi. More toys to play with and lots more source files to compile an EXE.

Bubba: Thank you. Glad to hear I did something right.

Wayne

KWW
08-13-2007, 09:39 PM
Hi all

I am fairly new to this forum. I have made some changes and additions to your source code Switcher. I started to add functions to use this program for Mill or Lathe.
How do you upload the files to this thread?

Switcher
08-14-2007, 02:37 AM
Hi all

I am fairly new to this forum. I have made some changes and additions to your source code Switcher. I started to add functions to use this program for Mill or Lathe.
How do you upload the files to this thread?

1) First, Zip all the source code up.

2) You need to use the "Go Advanced" option (instead of the quick reply).

3) Scroll down & click the "Manage Attachments" button (a pop-up window appears).

4) Click the "Browse" button (in the pop-up window), select your zipped file.

5) Then click the "Upload" button, make sure you wait until the "Current Attachments" appears & shows your zipped file name (in the pop-up window).

6) Close the pop-up window & click the "Submit Reply" button, when your ready to post your message/file.



.

Switcher
08-14-2007, 02:46 AM
Switcher: Yes it is VB.NET thing. That's why we need bigger hardrives...
I stopped using PowerBASIC and moved to Delphi. More toys to play with and lots more source files to compile an EXE.

Bubba: Thank you. Glad to hear I did something right.

Wayne

Remember back in the day, when a 10gig hard drive was huge. :)

I found a 1.5 terabyte hard drive at CompUSA, the other day, you can never have enough room for all that clutter...


.

Switcher
08-14-2007, 07:32 AM
I added a small (cheapo) plotter, & another form to be able to swap axis for the RTB on the left (g-code only).

Not much error handling. (chair)



.

KWW
08-14-2007, 08:24 AM
Thanks Switcher

I have made some changes to the source as well as added in some functions. There is a small problem with converting some mill files. It will crash if the arcs are real small. I will look into this. I am going to rewrite this so that it is use's more of the .net functions and make it more faster for lager files. Over all it seems to work on most files. There is still alot more to add to it. You will see that I added a function to be able to use the AutoCad colour cababilities. I have made it that the lines, arcs are in different colours. I will automate this process later.

Switcher
08-14-2007, 08:38 AM
KWW, nice work.

Do you have a site showing your work?

.

KWW
08-14-2007, 10:08 AM
Switcher

Thanks for the compliment. As I said before it needs to be rewritten so that it is much easier to try and understand whats happening.

I am a freelance software developer. I have been developing software for the CNC industry for some 25 years. Every thing from Editors, plotting, serial and usb communications, drill applications, code optimzation cam/cad etc for various company that I am not allowed to mention because of non discloser agreements etc. I program in several different languages.

I am not a machinest, but have learned what it's all about from fellows like yourself who are in the industry over the years

I also do alot of RFID programming for the CNC industry as well.

I plan on putting together some other code snippets and uploading them for others to play with who are interested programming

KWW

WayneHill
08-15-2007, 05:26 PM
KWW,

Nice. The G-Code to DXF program has been revised and improved beyond my expectations. I just slapped together the original source code and set it free. It is really taking shape.


Wayne

KWW
08-16-2007, 07:32 AM
Wayne

Thanks

I will have a new version up shortly. It will go DXF to G and G to DXF as well as plot the DXF file

KWW
08-29-2007, 09:22 PM
Hi Guys
Just to let you know that I did not get lost. I have been on some well deserved vaction time. We also had a death in the family which was a travel out of the country. We hope to have an update on the Gcode2DXF for you all to try out in about a week.

Cheers

Anils
01-04-2008, 06:03 AM
Hi All ,

I am Anil from INDIA .

I require the .exe file for the Gcode2DXF software.

I have some old NC files generated from FANUC wireEDM software.
I want it all of them to be converted back to DXF or DWG.

Please anyone who has such a software please help me.

( I do not have VB to create the EXE from the Source Code file )

Please reply back to mr.anils@gmail.com

Thanks in Advance,
Anil.S

Switcher
01-04-2008, 09:16 AM
You don't need Vb.net to run the program, you will need "Microsoft .NET Framework Version 2.0 (http://www.microsoft.com/downloads/details.aspx?familyid=0856eacb-4362-4b0d-8edd-aab15c5e04f5&displaylang=en)" (Download & install this If it's not already on your PC before you run the Gcode2DXF).


After you download the .Net Framework 2.0, then download the .Zip file here (http://www.cnczone.com/forums/attachment.php?attachmentid=42062&d=1187093911) (latest version post #49).

After you have the 2 downloads on your PC, unzip the "Gcode2DXF .zip file" & follow the path below to the program (assuming you downloaded the "Gcode2DXF .zip file" to the desktop).

...\Desktop\Convert DXF SourceCode\Convert DXF SourceCode\Convert_DXF\bin\Release\Convert_DXF

:cheers:

.

drape
04-20-2008, 02:51 AM
your app works very well. i'm exporting .nc files from mastercam. no problems on the conversion. they look sweet in Rhino when i'm looking at them.

this will be a good tool in my architecture school. thanks!

whptehnika
05-21-2008, 10:10 AM
Hi there,

have some problems with conversion. Could I send you a test file?
Thank you and regards
Ivan

WayneHill
05-21-2008, 10:53 AM
Hi Ivan,

Welcome to the CNCZone. Send a sample text file.

Thank you,

Wayne

WayneHill
05-21-2008, 01:02 PM
Ivan,

Your file is in a rich text format. Use Wordpad to convert it to a plain text file.
Then run the GCode2DXF conversion.

Thank you,

Wayne

whptehnika
05-25-2008, 02:51 PM
Hi there,

are you still working on your program?
Regards, Ivan

whptehnika
05-25-2008, 02:55 PM
Hi Switcher,

did you add a plot feature?

Regards, Ivan

eatanimals
07-25-2008, 11:31 PM
Hi,
Will your g-code to .dxf conversion program run in Vista?

Chris:cheers:

mattpatt
03-09-2009, 01:04 AM
Been a while since anyone posted on this thread, but just thought I'd say that the very first, original program seems fine, and I get a DXF file output with just a few extra lines for the rapid above job movement, but the newer versions either don't work for me, or I don't understand what Im supposed to do.:confused:

Still, it's very very useful as I lost the file model for an engraving job that I had done for the last four or five years. The guy doing the job also lost the file, but he has the g-code in his machine so we'll be able to save it (I hope), without me having to do the model again.

Fantastic. Thanks to all you guys cleverer than me. Which is probably most of you :)

smoregrava
03-10-2009, 04:09 AM
I agree the newer version's is a better user interface. But when I use it I get some strange result on the arcs.

I Have attached two pictures to illustrate the problem. Original G code is a picture from My Cam software It is a slot opperation (engraving). And I have done this on my CNC and it looks exactly like this

"The dxf created from the g code" picture is the result after using "convert DXF". Very strange really

If anyone wants to look into the problem I could upload my G code file

smoregrava
03-10-2009, 04:14 AM
"The dxf created from the g code" picture was a little hard to see so I marked the lines so they are a little easier to see.

smoregrava
03-10-2009, 04:29 AM
And If anyone wonder here is the result form the first/old program on the same G code

nice:-) Program migth not look so fancy but it does the work :-)

mattpatt
03-10-2009, 04:42 AM
Program migth not look so fancy but it does the work :-)

Exactly what I found. It worked perfectly for me.

As I said, I just had to delete the extra lines generated from the rapid above job movements, but that's not a problem.

I'm sure thre's just something I'm either doing wrong, or something a little 'strange' in the g-code, that not being accepted.

But Hey! It's all a massive help, and big thanks to everyone taking the time and trouble in not only building these programs, but then sharing them with us.

Matt.

LONGLEG
06-06-2009, 07:20 AM
I AM A CHINESE.I CANNOT READ A TO Z. BUT I NEED HELP. HOW TO EXCHANG THE G-CODE TO HPGL?

LONGLEG
06-14-2009, 07:30 AM
THANKS! ALL OF YOU. I FIND THE WAY TO to convert THE G-CODE TO HPLT WITH VBA-PROGRAMMING IN THE CORELDRAW12 AND ACAD2000.

WayneHill
06-14-2009, 10:49 PM
smoregrava,

The old program is a bare bones example just to get the code out in the public domain. The newer versions must have introduced a precision error when it calculates the center arc position.

Wayne

caddjunky
07-02-2009, 10:23 PM
Hey where do i go to download and try this thanks

Dean

jschmitt
07-04-2009, 05:59 AM
post # 49 has the latest zip file. Installation instructions are in post #56.

mrbroms
08-05-2009, 11:54 PM
Wayne..

All I can say is thank you. I have been making some designs in vcarve and cut3d but I can't save them as models. your app really helps. But... now what? Do you have any links on good tutorials to get the dfx to be a solid for booleans or meshs so I can re-create the model in autocad or 3ds max(RHINO)? thanks again for your program!!

Broms

WayneHill
08-06-2009, 02:02 AM
Broms,

Thank you. Check out Moi Solid modeler. It is written by the author of Rhino.

moi3d.com

mrbroms
08-10-2009, 02:23 PM
wayne-

I went in MOI. I didn't know what to look for so I tried to make the cuves into a network but it didn't do anything. I know that Rhino looks at each segment as its own curve but I don't know what rhino can do with them. Do you have a workflow to get all of the separate curve into a mesh or solid? the curves look like the shape of my cnc cut but I don't know how to connect them and create a surface for trimming or boolean. I feel I'm close but can't wrap my head around it. Can I email you the file and get your ideas? If yes, what format?

By the way, thanks for getting back to me so quickly!!!

Thanks again,
broms

tgm
08-10-2009, 04:52 PM
Wayne,
Thanks for the useful program for conversion. I tried using it and I am unable to find the converted file. It is not in the source directory as stated above. Where else would it go??

Thanks again,

Tom in PA

mrbroms
08-11-2009, 01:27 AM
WAYNE-

Here is what the dxf looks like from gcode to autocad to rhino. The dxf can be seen but it is a series of 1448 curve segments. I tried to join them but had no luck. Take a look and let me know what you think.

Thanks,
chris

http://www.flickr.com/photos/34396447@N06/

mrbroms
08-11-2009, 01:28 AM
here is the link to conversion image

http://www.flickr.com/photos/34396447@N06/

WayneHill
08-17-2009, 12:45 AM
It's like making a cow out of hamburger. All the parts are there. Just don't know how to put it together.

smoregrava
08-17-2009, 03:32 AM
It's like making a cow out of hamburger. All the parts are there. Just don't know how to put it together.

Nice comment and I have to agree. Inverse ingeneering is not easy
I have dreamt of making 3D parts from scans and paths. At my work we have a highend 3D scanner (100K $) this creates very nice STL files but what happens is even with a good scan you want some changes and then you find out that its very hard to work with the files. Almoust every time I end up modelling the part up in 3D from scratch. Faster and much more flexible to changes.

WayneHill
08-19-2009, 10:54 AM
It is possible to create a point cloud from a G-Code to a DXF file. Have the CAD software generate a surface from the points. A lot of the surface texture would be missing. It would be possible to generate an XYZ vector points from the DXF line and circles. This could be handy to someone working on a reverse 3D model.

liliostasi
12-26-2009, 11:03 AM
Wayne, I ported your code to "VB.Net 2005", thanks for the source. :)

mikkojay, your VB6 code helped to, thanks both.



I didn't change much, I might add a file splitter later, maybe split large g-code files.




.


Hello and thanks for upload.

I tried this software on my Gcode and opened the output in AutoCAD but the result wasnt okay.I wrote my Gcode with the aid of CNC simulator(CNCsimulator.com) but im new to this so i had to make some moves to improve my product that maybe confused your program.Im sending you my Gcode in a pm to check it yourself if youre in mood.

thanks

WayneHill
12-30-2009, 12:08 AM
Liliostasi,

The original program works with basic XYZ g-code. Anything else will fail to convert.

Wayne

mrbroms
01-20-2010, 10:50 AM
Wayne-

I've been gone for a while but thanks for answering my question.

I loved your quote "It's like making a cow out of hamburger".

wayne wrote "It is possible to create a point cloud from a G-Code to a DXF file. Have the CAD software generate a surface from the points. "

I am going to try your method of creating a point cloud from g-code. I don't know what program does this and have had no luck searching on the internet. What program is it?

many thanks in advance!
chris

WayneHill
01-30-2010, 10:07 PM
PM'ed

ata3636
02-03-2010, 11:22 AM
Hi! Evreybody..


I need help about EMC2. I have projects with aotocat and corell Draw dxf file. But some times I couldn't convert g code for emc2 and also deskcnc open that files.
If you use better g code converter please help me...
Thanks
Atakan

gwittlock
02-17-2010, 04:22 PM
You don't need Vb.net to run the program, you will need "Microsoft .NET Framework Version 2.0 (http://www.microsoft.com/downloads/details.aspx?familyid=0856eacb-4362-4b0d-8edd-aab15c5e04f5&displaylang=en)" (Download & install this If it's not already on your PC before you run the Gcode2DXF).


After you download the .Net Framework 2.0, then download the .Zip file here (http://www.cnczone.com/forums/attachment.php?attachmentid=42062&d=1187093911) (latest version post #49).

After you have the 2 downloads on your PC, unzip the "Gcode2DXF .zip file" & follow the path below to the program (assuming you downloaded the "Gcode2DXF .zip file" to the desktop).

...\Desktop\Convert DXF SourceCode\Convert DXF SourceCode\Convert_DXF\bin\Release\Convert_DXF

:cheers:

.

Just wanting to know if anyone has ever modifed the program to accept incremental code.

gwittlock
02-18-2010, 09:43 PM
Can anyone tell me why this file does not convert properly. It creates the outside of the part but does not bring in the circle in the center of the part

Apexengineering
02-23-2010, 10:32 PM
gwittlock,
I converted your nc code using the convert dxf program. Importing the dxf into cadkey, gpuncher and gcad3d the circle showed up. I tried several viewers and the circle did not show up. It seems there is something in the dxf that is not recognized by all viewers and cad programs. Maybe Wayne can look at the dxf output and see it.

WayneHill
02-24-2010, 03:13 AM
The circle showed up in Vector CAD/CAM. It did not show up in Solidworks eDrawing viewer. The g code looks good. Something flacky on how the viewers translate the circle direction.

In the viewers: If the arc value is changed from 0 - 360 to 0-359.9999 it will show up in the viewers. I will keep researching.



Wayne

abbtech
02-27-2010, 03:13 PM
I was working on an Artcam project that got corrupted. I have the gcode that was created before the file got damaged though. I am trying to get a DXF file from the gcode.

I have tried another converter that kept all of the above workpiece moves in the output, when I tried to clean it up I was not able to make it work. This software sounds like it would give me exactly what I need since it can ignore the moves above the workpiece. When I run it I get an error though. The error is "Index and length must refer to a location within the string. Paramater name: length"

The gcode file is here.
http://alan-parekh.com/wp-content/uploads/2010/02/letter_engraving.tap

Any ideas?

MetLHead
02-27-2010, 03:30 PM
See if this works for you, I converted it in NCPlot.

Scott

abbtech
02-27-2010, 03:50 PM
See if this works for you, I converted it in NCPlot.

Scott

Hi Scott,

That works perfectly! You saved me hours of work. :)

Thanks a million.

WayneHill
02-28-2010, 02:09 PM
abbtech - I was able to convert your file with no problem. Was software was giving you that error?

Scott - I like your NCPlot software :)

Wayne

abbtech
02-28-2010, 02:20 PM
abbtech - I was able to convert your file with no problem. Was software was giving you that error?

Scott - I like your NCPlot software :)

Wayne


Hi Wayne,

It was the one listed on comment #36 or #40. I actually didn't realize there was more than one conversion program or version listed in this thread until I went looking for the comment that I got it from.

Alan

WayneHill
03-01-2010, 12:15 PM
Alan,

Yes, there have been additional converson programs written and posted in this thread. My original program did not have any error checking in it ;) , so I knew that the error was not generated from my program.

Thanks,

Wayne

wriwo
03-21-2010, 01:01 PM
Wayne,

I tried your program and it converted the g code to dxf, however it brought in the rapid movements as well. Is there an easy way to eliminate the rapid movements without having to go into the text file and removing them prior to the conversion? Thanks.

Rush

WayneHill
03-24-2010, 01:03 AM
Rush,

WYSIWUG. There might be some other programs in this thread that will do what you are looking for.

naveedakhan
07-08-2010, 04:17 AM
Great Work Wayne, its a remarkable program. I simply love it :)
Thanks!

abbtech
07-08-2010, 03:16 PM
See if this works for you, I converted it in NCPlot.

Scott

Hi Scott and Wayne,

Just though you would like to see the end result of the project.
http://hackedgadgets.com/2010/06/23/multimeter-clock-styled-after-the-simpson-260-multimeter/

Regards,

Alan Parekh

WayneHill
07-09-2010, 10:07 AM
Alan,

That is really cool! Are you selling these clocks? The NIXIE Clock Multimeter is my favorite.

Thank you for the update!

Wayne

WayneHill
08-22-2010, 11:14 AM
Hi All,

I am working on a new commercial version of my Gcode2DXF. that features the ability to plot lines at or below the Z plane. It has new GUI interface that is easier to use.

Stay tuned for future updates.

Wayne Hill
'----------------------

( For the Search Bots )
gcode2dxf gcodetodxf gcode to dxf dxf to gcode dxftogcode
code conversion filter cnc

Bob Adams
08-22-2010, 11:54 AM
Wayne,

I tried your program and it converted the g code to dxf, however it brought in the rapid movements as well. Is there an easy way to eliminate the rapid movements without having to go into the text file and removing them prior to the conversion? Thanks.

RushAfter converting to a DXF. I use my CAD program to edit out the rapid moves. Then save as Autocad R11/12 with the changes.
Bob A
http://www.cad2gcode.com/cncprojects

WayneHill
08-22-2010, 12:50 PM
Bob,

That is one way to do it. My new program (not released yet) will eliminate all lines above Z plane.

Wayne





After converting to a DXF. I use my CAD program to edit out the rapid moves. Then save as Autocad R11/12 with the changes.
Bob A
http://www.cad2gcode.com/cncprojects

CJL5585
08-22-2010, 01:20 PM
Sounds really great Wayne. I will need a copy of the new program, as I lost all my backup AND cad files when my hard disk crashed. I learned one thing. Never have your back-up files on the same hard disk as your work files. I lost everything but the g-code which was on a different computer.

Amyot
08-24-2010, 08:35 AM
Hello

WayneHill
08-24-2010, 10:19 AM
Hello Amyot,

Welcome to the CNC Zone. Do you have a question about the GcodetoDXF software?

Wayne
'--------
www.codemangler.com

Angusisthedevil
09-02-2010, 08:44 PM
Hello Wayne and others

I am looking for some way to convert the following to DXF. I have tried the version you have and another one based on your work but without success. I see that K is not supported in your version however I cannot get it to work on any of the following.

What the 3 examples below are, are an output shape of some rollers from a design package of roll forming. When I try even the simple one without G03 I do not get any result.

Can you or anyone assist me on how to convert this to a dxf file?

I am also happy to buy a commercial package if I can see it works on the following.

Thanks

Brian



%04B-04
N10 G71
N20 G01 X0 Z0
N30 G01 X174 Z0
N40 G03 X184 Z-5 I0 K-5
N50 G01 X184 Z-38.337
N60 G03 X181.18 Z-40.881 I-3 K0
N70 G01 X120 Z-60
N80 G01 X0 Z-60
N90 M30

%04B-05
N10 G71
N20 G01 X0 Z0
N30 G01 X120 Z0
N40 G01 X120 Z-25
N50 G01 X0 Z-25
N60 M30

%04B-04
N10 G71
N20 G01 X0 Z0
N30 G01 X120 Z0
N40 G01 X181.18 Z-19.119
N50 G03 X184 Z-21.663 I-1.59 K-2.544
N60 G01 X184 Z-60
N70 G02 X184 Z-60 I0 K0
N80 G01 X0 Z-60
N90 M30

MetLHead
09-03-2010, 12:24 AM
Brian,

These look like lathe programs, is that right?

Scott

Angusisthedevil
09-03-2010, 02:05 AM
MeTLhead

Yes they are lathe programmes

WayneHill
09-09-2010, 10:59 AM
Brian,

My program does not convert lathe programs at this time. I will add it to the wish list.

Wayne

MetLHead
09-09-2010, 11:21 AM
Brian,

See if these will work for you.

Scott

WayneHill
09-12-2010, 09:30 AM
Scott,

Sweet! Did you exchange the K-J and Z-Y? Lathe is a little more tricky. Some machines are radius X. Some are front lathes that have the circular G02-G03 inverted. Some I values are double. I started manual programming on a front lathe (Hardinge CHNC 1980 vintage). It was not until the company purchased a slant bed back lathe that I noticed the difference in programming of lathes and type.


Wayne

MetLHead
09-12-2010, 11:55 AM
Wayne,

I first plotted these with NCPlot then saved as DXF. When NCPlot saves a lathe program as a DXF it swaps the axes around so that the plot ends up on the XY plane.

Scott

PavementStencil
09-15-2010, 02:50 PM
Hi!

I recently downloaded your g-code to dxf program thinking it was the answer to my problems but then I realized that it wasnt for tap files. Does anyone know of a program that converts tap files to dxf files?

Thanks!
Megan

Bubba
09-15-2010, 03:05 PM
Megan,
Rename the file extension from tap to txt or whatever and it will work. A g code file is a plain text file.

PavementStencil
09-15-2010, 03:35 PM
Thanks so much!!! It worked great! Now we can get back a lot of files we lost! :D

Angusisthedevil
09-15-2010, 05:19 PM
I got my brother to write a programme that does it. He is still doing it but it works in testing. My needs are also to rotate part so I can put it into the CAM software so it faces the chuck the correct way. Also there are 400 parts in my file and it sorts them and outputs individual dxf files as well. Will post a copy when it is done if anyone is interested.

WayneHill
09-16-2010, 08:45 AM
Megan,

Post #15 has the program with the TAP file extension included. Like Bubba said, just rename file will work.

Wayne




Hi!

I recently downloaded your g-code to dxf program thinking it was the answer to my problems but then I realized that it wasnt for tap files. Does anyone know of a program that converts tap files to dxf files?

Thanks!
Megan

PavementStencil
09-16-2010, 09:22 AM
Megan,

Post #15 has the program with the TAP file extension included. Like Bubba said, just rename file will work.

Wayne

Hey Wayne!

Thanks that makes it even easier. You guys were a life saver!

tdiaz
09-26-2010, 11:38 PM
I found this thread.. and excellent application:

For my intention, it's just sitting doing nothing when set in motion:

This is a selection of what I'm trying to convert:

It's for the Phlat Printer and I want to make it with a laser instead

Basically, I've figure out that M07 turns off my laser, M09 turns it on. I usually use DesKAM 2000 to convert DXF to gcode.


G90
G20
G49
M3 S15000
G00 Z 0.050
G01 X 3.257 Y 0.746 F250
G01 Z -0.083 F100
G01 Y 2.121 F250
G00 Z 0.050
G01 X 5.766 Y 0.758 F250
G01 Z -0.083 F100
G01 Y 2.108 F250
G00 Z 0.050
G01 X 10.939 Y 0.784 F250
G01 Z -0.083 F100
G01 Y 2.082 F250
G00 Z 0.050
G01 X 12.257 Y 0.799 F250
G01 Z -0.083 F100
G01 Y 2.068 F250
G00 Z 0.050
G01 X 12.909 Y 0.807 F250
G01 Z -0.083 F100
G01 Y 2.060 F250

Edit: I found the one with the installer, "G-Code td DXF Converter", and with the two boxes ticked, I get much more favorable results.

I just need to figure out if I need to allow for some of the Z surface to be valid as what I think should be two identical parts is not coming out that way.

The first image shows the output and where the part closest to the bottom and the fourth one up, the fourth one up is two pieces, the bottom is a single piece. The second image is zoomed in to see the detail. Kinda choppy, since I have not seen the file cut I don't know what it really is supposed to look like.

WayneHill
09-27-2010, 02:31 AM
Tdiaz,

Are you able to post the Gcode or send it to be by email? I did not write the program version with a loader. Switcher has a version posted somewhere in this thread.

Wayne

WayneHill
09-28-2010, 09:50 AM
tdiaz,

If you view the part on an angle, you can see the tabs in the design. The forth part from the bottom is acually two parts.
The design looks okay for the conversion from Gcode to DXF. See attached files.
I used my new GCode to DXF program that is still being tested.
Wayne

tdiaz
09-28-2010, 11:54 AM
Hmmm.. interesting, and I have the opportunity to do a lot more of these- when do you say this might be ready? :)

Obviously the tabs are not going to import, though what would be nice to have a way of viewing the GCode with the tool functions omitted, as even when I viewed the original file in Mach3 it still had the tool lines showing as cuts rather than repositioning.

Hmm.. wait a minute though, that implies thats got raised tabs on it, but the phat printer isn't milling down the entire surface of the pieces just to get the raised tabs.

As for the areas of the foam cutting that would be partial if done with the Phlatprinter, if I run the laser over it at a lessor power setting and then drag a fingernail, followed by a small piece of bent music wire through the path I get the same effect that the dremel bit would have done, and with respect to wrapping pieces since what I'm doing forms a "V" rather than a "U" I think it looks nicer from a front view.

WayneHill
09-28-2010, 12:26 PM
FYI,

By filtering Z Values on the soon to be released commercial GCodetoDXF program, it is able to remove the tabs.

Wayne

WayneHill
09-28-2010, 12:34 PM
The new GCODEtoDXF program does not have a DXF viewer. I use my CAD/CAM program.

tdiaz
09-28-2010, 01:05 PM
I can see where there might be tabs if I follow the Gcode, but interesting that I don't get them at all.

Obviously you've got a lot more going on in your application thats brewing.

WayneHill
09-30-2010, 10:33 AM
Tony,

You will not see the raised tabs when viewing the part from the top. The tabs will show up when the angle of the view is rotated.

Wayne

tdiaz
09-30-2010, 11:32 AM
Wayne,

Right, I realize that. At first I thought the jaggy result might have been something else, but I see where that could be the tabs being flattened, too.
I meant to include a screen shot on the earlier post.

(which is from the one thats not yours)

WayneHill
10-03-2010, 10:03 AM
Tony,

Zoom in on the parts and the tabs will show up in better detail. The jaggy lines are the CAD system trying to draw a line on an angle other than horizontal or vertical.

Wayne

tdiaz
10-04-2010, 04:25 AM
Wayne,

Suddenly this makes more sense, the tabs are partially cut through - but what was throwing me was your graphic display having the tabs pointing up, they are actually pointing down with regard to the tool. The tool is cutting the part out but leaving it connected by cutting only half depth at those locations. Where as the laser cutter would be just the laser turned off.

So, your second example would be the correct way for 2D cutting with retaining the pieces on the frame, and flattening everything like shown in the first graphic you posted.

WayneHill
10-04-2010, 10:51 AM
Tony,

The Gcode is cutting the profile from the top. A Phlatprinter cuts from the bottom. Is the ZAxis inverted on a Phlatprinter? In other words, as the Z axis spindle goes deeper into the part, are the numbers going more in the Z minus direction?

Wayne

WayneHill
10-04-2010, 11:00 AM
The second example is filtering out everything above the bottom profile level.
w


Wayne,

Suddenly this makes more sense, the tabs are partially cut through - but what was throwing me was your graphic display having the tabs pointing up, they are actually pointing down with regard to the tool. The tool is cutting the part out but leaving it connected by cutting only half depth at those locations. Where as the laser cutter would be just the laser turned off.

So, your second example would be the correct way for 2D cutting with retaining the pieces on the frame, and flattening everything like shown in the first graphic you posted.

tdiaz
10-04-2010, 11:22 AM
It has to be reverse then, otherwise in order for those tabs to exist it would mean that it's carving off an entire layer of material. With a router bit that would be horribly in-efficient, and produce an awful lot of waste.

Where as if you flip that over and look at it, you can visualize the tab being material left over in the kerf so that the pieces remain connected to the sheet and don't start flying out of the machine when the sheet is slid back and forth.

Tony

jorgyCNC
10-06-2010, 10:44 AM
where do I go to download the software to convert G-code to DXF? Am I blind?

WayneHill
10-06-2010, 11:08 AM
JorgyCNC,

Welcome to the Zone! Your first post is in my GCode to DXF thread - Thank you !!!

You are not blind. It is not easy to find. My last public domain program is located at:


http://www.cnczone.com/forums/attachments/opensource_software/16660d1144605718-g-code_dxf-g-code_dxf_zip


I am currently working on a new commercial version that has lots of improvments. It also fixes a major bug that is in the public domain program :)

Khalid
10-06-2010, 11:34 AM
JorgyCNC:)
We welcome you in this forum.. I hope a time will come when you share a lot of good stuff with us...

jorgyCNC
10-06-2010, 11:44 AM
Thanks Wayne!!

What should I know about the bug? I'm trying to convert G-code to DXF so I can take a steel cutout file and use it on a wood laser cutter....any thoughts?? PS I'm the designer not the CNC person so I'm completely unversed.

jorgyCNC
10-06-2010, 02:12 PM
Wayne,

Thanks for the help. Our steel guy is telling us that their file is a sheet file or txt file. This is what we have to convert to DXF file.

Can you help with this?

Thanks again!

Erik

WayneHill
10-07-2010, 08:34 AM
Erik,

A gcode file is a text file. Can you send me a sample of the gcode format?
My program does not work with all Gcode programs.

The bug in my public program has to do with 360 degree circles. Some CAD systems can read them and some CAD systems cannot read them. It has been corrected in the new commercial version.

Thanks you,

Wayne

WayneHill
11-08-2010, 07:32 PM
The commercial version of GCodetoDXF has been released along with another software to convert GCode to Point Cloud (XYZ) data.

Here is the link to my web site.

www.codemangler.com (http://www.codemangler.com/)

Thank you,
Wayne Hill

(Admin)
This will be the only announcement of this product on this thread.

WayneHill
11-29-2010, 10:40 AM
Tony,

PM me. Got something for you.

Wayne

lasercnc
12-23-2010, 07:28 PM
Can I download the program?

WayneHill
12-24-2010, 03:18 PM
LaserCnc,

There are two GCode to DXF programs available. The download link to the first one located on post #137. It is the original public domain program written five years ago and is no longer supported. The newest program can be purchased from my web site. This program has many new filtering features added and is much faster. It is fully supported and maintained.

Thank you for your interest.

Wayne Hill
www.codemangler.com (http://www.codemangler.com)

machinist2012
01-06-2011, 01:11 PM
Thanks for this program! I will get some use out of this, it solves a problem! I just used it to convert engraving

WayneHill
01-08-2011, 04:37 PM
Thank you !

WayneHill
02-09-2011, 11:31 AM
FYI - Updated commercial GCode to DXF program to work with Vectric GCode format.

coderr
03-27-2011, 10:22 PM
This program will convert a standard line-arc gcode file to a DXF file.

It is written in PowerBASIC and is released to the public doman.

CNCzone.com-Machinist Community Forums - Welcome Page - Welcome Page (http://www.cnczone.com/modules/Downloads/userfile.php?id=22)




thanks you much, it is all opensource software i searched for.

yusif
04-21-2011, 10:05 AM
Hello Wayne,
This G code file is sprocket tooth profile.
I used yours Gcode program to convert it to DXF file.
But I got more circle instead tooth profile.
What I doing wrong?
Thank you for help

Yusif




%
N0P458A5
N10G91
N20G70
N30X3.345Y7.762
N40G97
N50M04
N60G45X-0.52Y-0.468
N70G02X-0.489Y-0.104I-0.334J0.372
N80G03X-0.495Y0.142I-2.336J-7.19
N90X-0.142Y-0.021I-0.046J-0.182
N100X-1.064Y-1.281I1.281J-2.146
N110G02X-0.296Y-0.284I-0.441J0.163
N120X-1.995Y-0.648
N130X-1.996Y-0.649
N140X-0.406Y0.057I-0.145J0.447
N150G03X-1.614Y0.41I-1.389J-2.079
N160X-0.127Y-0.066I0.017J-0.187
N170X-0.317Y-0.406I5.799J-4.85
N180X-0.289Y-0.427I6.116J-4.444
N190X-0.024Y-0.142I0.16J-0.1
N200X0.89Y-1.408I2.438J0.555
N210G02X0.179Y-0.369I-0.291J-0.369
N220Y-2.098
N230Y-2.098
N240X-0.179Y-0.369I-0.47
N250G03X-0.89Y-1.408I1.548J-1.963
N260X0.024Y-0.142I0.184J-0.042
N270X0.289Y-0.427I6.405J4.017
N280X0.317Y-0.406I6.116J4.444
N290X0.127Y-0.066I0.144J0.121
N300X1.614Y0.41I0.225J2.489
N310G02X0.406Y0.057I0.261J-0.39
N320X1.996Y-0.649
N330X1.995Y-0.648
N340X0.296Y-0.284I-0.145J-0.447
N350G03X1.064Y-1.281I2.345J0.865
N360X0.142Y-0.021I0.096J0.161
N370X0.495Y0.142I-1.841J7.332
N380X0.484Y0.176I-2.336J7.19
N390X0.103Y0.1I-0.07J0.174
N400X0.108Y1.662I-2.298J0.984
N410G02X0.072Y0.404I0.452J0.128
N420X1.233Y1.697
N430X1.233Y1.698
N440X0.362Y0.193I0.381J-0.277
N450G03X1.548Y0.616I-0.098J2.498
N460X0.063Y0.129I-0.124J0.142
N470X0.018Y0.515I-7.542J0.515
N480X-0.018Y0.515I-7.56
N490X-0.063Y0.129I-0.187J-0.013
N500X-1.548Y0.616I-1.646J-1.882
N510G02X-0.362Y0.193I0.019J0.47
N520X-1.233Y1.698
N530X-1.233Y1.697
N540X-0.072Y0.404I0.38J0.276
N550G03X-0.108Y1.662I-2.406J0.678
N560X-0.103Y0.1I-0.173J-0.074
N570X-0.484Y0.176I-2.82J-7.014
N580G02X-0.334Y0.372I0.155J0.476
N590X-0.146Y0.684
N600M03
N610G98
N620M30

WayneHill
04-21-2011, 12:13 PM
Yusif,

My old version posted several years ago is not longer supported because I switched from PowerBASIC to Delphi programming language. My new version corrected some of the issues with the original program.

Reasons the program did not convert:
1. Your program is entirely incremental and is not supported by the original GCodetoDXF program.

2. Something is unique in the program where there are no G01 or G00 linear codes between the G02 G03 codes where I and J codes are missing. The modal G02/G03 codes are confusing the logic and more study with this unique program structure will be required.

I have attached a modified gear2.txt file and a converted gear2.dxf file. Is this closer to the tool path? Can you send more information or picture of the actual part?

The attached DXF file was created from the newer commercial version of my software.

Thank you,

Wayne Hill

yusif
04-25-2011, 11:06 AM
Hello Wayne,
Take a look at attached files.
Is your new version of program able to convert it?

Yusif

WayneHill
04-25-2011, 12:08 PM
Yusif,

I have modified my program to work with your file format. The attached DXF file is created with my newest version.

Thank you,

Wayne Hill
www.codemangler.com (http://www.codemangler.com)

yusif
04-26-2011, 11:06 AM
Wayne,
I can not open attached DXF file witn my AutoCad 2006.

please advise.

thank you
Yusif
4/26/11

WayneHill
04-26-2011, 12:17 PM
Hmmm. It is working on all my other programs that imports DXF files. I do not have AC2006 to trouble shoot compatibility issues. Is there a setting in AC2006 to import older versions of DXF? I try to keep the DXF format at the lowest level to be backward compatible with most all products.

I could use some help from other members with this issue.

Thank you for notifying me.

Wayne

Bubba
04-26-2011, 12:39 PM
I just tried to open it in Acad 2002 and it crashed with an "Undefined code group 94 on line 14"

It however did open in Progecad Smart 2009.

WayneHill
04-26-2011, 01:17 PM
This DXF was import on my Vector CAD/CAM and saved back as DXF.

Bubba
04-26-2011, 02:26 PM
Worked for me in Acad 2002 this time.

yusif
04-26-2011, 04:46 PM
Yah, this file is OK!
Can you please make some changes in your program to convert it to normal format?

Thank you
Yusif
4/26/11

WayneHill
04-26-2011, 11:33 PM
Yusif,

There is no normal for DXF. The DXF conversion for AC2xxx will take more effort than the G-code conversion.

Stay tuned.

Wayne.








Yah, this file is OK!
Can you please make some changes in your program to convert it to normal format?

Thank you
Yusif
4/26/11

WayneHill
04-26-2011, 11:54 PM
Sorry for the double post

WayneHill
05-04-2011, 12:17 PM
Ok folks. I changed the DXF header information to be more compatible with AutoCAD. I took the header information from a DXF export file and pasted it onto the output file of my program. I need some feed back from AutoCAD users to see if this is working. I do not have access to AutoCAD programs.


Thank you,


Wayne

Bubba
05-04-2011, 12:27 PM
Wayne,
In acad 2002, got the following error:
Error in drawing header on line 15.

Progecad 2009 would also NOT open it.

Nor would it load in Draftsight

WayneHill
05-04-2011, 04:50 PM
Bubba,

That is weird because the first 1000 lines of the header are from a different DXF export file. (V14) Bubba, could you draw something simple and send me the DXF export for an AC20XX version program? What has me baffeled is my DXF files are importing fine with the programs I am using. Vectric programs have no trouble reading them. Vector CAD/CAM has no trouble. AutoCAD 20XX is not backward compatable with it's own format!!

Wayne

Bubba
05-04-2011, 06:54 PM
Wayne,
sorry for the delay, but my internet has been down for a few hours:{(

Anyhow, here is a simple drawing saved from acad 2004 as dxf version 2004 and also as 2000

Hope this helps

yusif
05-05-2011, 03:20 PM
I couldn't open it in my autocad 2006.
header ok, seems needs to change encoding format

good try - don't give up :drowning:

Yusif

WayneHill
05-06-2011, 01:08 PM
Thank you Bubba - I will be working in it this weekend.

WayneHill
05-11-2011, 11:38 AM
Attached is a DXF test file. I attached the header of the Acad2000 file that Bubba was kind enough to supply. The entity formats changed in AC2000 and the starting parameter line counter was also changed. Keeping my fingers crossed on this one. BTW it loaded fine on all my other programs. AutoCAD is just being fussy.

Let me know if it works with AutoCAD products and other DXF import programs.

Thank you,

Wayne

Bubba
05-11-2011, 12:03 PM
Wayne,
You aren't going to believe this: "Error in drawing header on line 15.
C:\DOCUME~1\Art\LOCALS~1\Temp\78A6 AC2000.dxf is not valid DXF file
Invalid or incomplete DXF input -- drawing discarded." is the message from the same acad that I used to send you the original files!
Progecad says "incorrect or corrupt information"
Draftsight was not happy either:{(


Looking at the file for a hint, I did find on or about line 15:
0
SECTION
2
HEADER
9
$ACADVER
1
AC1015
9
$ACADMAINTVER
70
20
9
$DWGCODEPAG
E
3
ANSI_1252

If I look at a native dxf file, the
$DWGCODEPAG
E

Appears as $DWGCODEPAGE

However if I edit the file to change that, it still does not open properly:{(

WayneHill
05-11-2011, 12:10 PM
Thanks Bubba. Found out that it did not work through a different method.

I found a new method of testing DXF files.

AutoCAD has a website that links with Android products.

I signed up and got my Xoom synced to the web site.

Real cool stuff here:

https://www.autocadws.com/

Web based AutoCAD 2D!!

Wayne

yusif
05-18-2011, 10:42 AM
Hi Wayne,
Do you have any success related with converting to dxf?

You can also try attached .txt g-code file and you will get attached .dxf file (AutoCad 2000 format)

thank you
Yusif
:violin:

WayneHill
05-18-2011, 11:45 AM
Yusif,

I took a little break from the GCode to DXF program to work on some fun projects. Will be getting back to it soon.

Wayne

mikenuke
05-30-2011, 04:40 AM
This program will convert a standard line-arc gcode file to a DXF file.

It is written in PowerBASIC and is released to the public doman.

CNCzone.com-Machinist Community Forums - Welcome Page - Welcome Page (http://www.cnczone.com/modules/Downloads/userfile.php?id=22)




#PBFORMS CREATED V1.50
'------------------------------------------------------------------------------
' The first line in this file is a PB/Forms metastatement.
' It should ALWAYS be the first line of the file. Other
' PB/Forms metastatements are placed at the beginning and
' end of "Named Blocks" of code that should be edited
' with PBForms only. Do not manually edit or delete these
' metastatements or PB/Forms will not be able to reread
' the file correctly. See the PB/Forms documentation for
' more information.
' Named blocks begin like this: #PBFORMS BEGIN ...
' Named blocks end like this: #PBFORMS END ...
' Other PB/Forms metastatements such as:
' #PBFORMS DECLARATIONS
' are used by PB/Forms to insert additional code.
' Feel free to make changes anywhere else in the file.
'------------------------------------------------------------------------------
#COMPILE EXE "G-Code to DXF"
#DIM ALL
'------------------------------------------------------------------------------
' ** Includes **
'------------------------------------------------------------------------------
#PBFORMS BEGIN INCLUDES
#IF NOT %DEF(%WINAPI)
#INCLUDE "WIN32API.INC"
#ENDIF
#PBFORMS END INCLUDES
'------------------------------------------------------------------------------
#INCLUDE "COMDLG32.INC"

#INCLUDE "C:\QVCS LIB\Workfile\PowerBasic\Common\URL\url.inc" ' Add Urls
'------------------------------------------------------------------------------
' ** Constants **
'------------------------------------------------------------------------------
#PBFORMS BEGIN CONSTANTS
%IDD_DIALOG1 = 101
%IDC_BUTTON1 = 1001
%IDC_BUTTON2 = 1002
%IDC_LABEL1 = 1003
%IDC_LABEL2 = 1004 '*
%IDC_LABEL3 = 1005
%IDC_LABEL4 = 1006
%IDC_BUTTON3 = 1007
%IDC_LABEL5 = 1008
#PBFORMS END CONSTANTS
'------------------------------------------------------------------------------
MACRO Pi = 3.141592653589793##
TYPE TypPoints
X AS SINGLE ' Center of first circle or first point of intersection
Y AS SINGLE
Z AS SINGLE
I AS SINGLE
J AS SINGLE
X1 AS SINGLE ' Center of first circle or first point of intersection
Y1 AS SINGLE
X2 AS SINGLE ' Point on diameter of circle or second point of intersection
Y2 AS SINGLE
R AS SINGLE ' Common Radius
Ang AS SINGLE ' Angle of Radius Point on Circomference.
END TYPE
GLOBAL TypOld AS TypPoints ' Hold Values of Geometry
DECLARE SUB CalcCenters( BYREF Centers AS TypPoints )
DECLARE SUB CalcAngle( BYREF tPoints AS TypPoints )
DECLARE SUB PARSEFILE( hWnd AS LONG,SMYSOURCEFILE AS STRING )

$ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
$DP = "#.0###" ' FORMAT OF XYZ - CODE

'------------------------------------------------------------------------------
' ** Declarations **
'------------------------------------------------------------------------------
DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG

#PBFORMS DECLARATIONS
'------------------------------------------------------------------------------
DECLARE FUNCTION ExeName(Op AS LONG) AS STRING
'------------------------------------------------------------------------------
' ** Main Application Entry Point **
'------------------------------------------------------------------------------
FUNCTION PBMAIN()
ShowDIALOG1 %HWND_DESKTOP
END FUNCTION
'------------------------------------------------------------------------------

'------------------------------------------------------------------------------
' ** CallBacks **
'------------------------------------------------------------------------------
CALLBACK FUNCTION ShowDIALOG1Proc()

SELECT CASE AS LONG CBMSG
CASE %WM_INITDIALOG
' Initialization handler

CASE %WM_NCACTIVATE
STATIC hWndSaveFocus AS DWORD
IF ISFALSE CBWPARAM THEN
' Save control focus
hWndSaveFocus = GetFocus()
ELSEIF hWndSaveFocus THEN
' Restore control focus
SetFocus(hWndSaveFocus)
hWndSaveFocus = 0
END IF

CASE %WM_COMMAND
' Process control notifications
SELECT CASE AS LONG CBCTL
' /* Inserted by PB/Forms 10-11-2004 00:36:51
CASE %IDC_LABEL5
' */

' /* Inserted by PB/Forms 09-11-2004 15:16:59
CASE %IDC_BUTTON3
IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
DIALOG END CBHNDL 'Exit
END IF
' */

CASE %IDC_BUTTON1
IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN

DIM InputFile AS STRING

Inputfile = "*.cnc;*.txt;*.dnc"
IF OpenFileDialog(0, _
"Open PowerBasic Source File", _
InputFile, _
CURDIR$, _
"CNC Files (*.cnc;*.txt;*.dnc)|*.cnc,*.txt,*.dnc", _
"cnc", _
%OFN_FILEMUSTEXIST OR %OFN_HIDEREADONLY) THEN
END IF
IF Inputfile = "*.cnc;*.txt;*.dnc" THEN Inputfile = "None"
CONTROL SET TEXT CBHNDL , %IDC_LABEL1, InputFile

END IF

CASE %IDC_BUTTON2
IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN

CONTROL GET TEXT CBHNDL , %IDC_LABEL1 TO InputFile
IF Inputfile = "None" THEN EXIT FUNCTION

' Disable system menu's close item
MENU SET STATE GetSystemMenu(CBHNDL, 0), %SC_CLOSE, %MF_GRAYED

' Disable other controls
CONTROL DISABLE CBHNDL, %IDC_BUTTON1
CONTROL DISABLE CBHNDL, %IDC_BUTTON2
CONTROL DISABLE CBHNDL, %IDC_BUTTON3
PARSEFILE(CBHNDL,InputFile)
MSGBOX "Finished"

CONTROL ENABLE CBHNDL, %IDC_BUTTON1
CONTROL ENABLE CBHNDL, %IDC_BUTTON2
CONTROL ENABLE CBHNDL, %IDC_BUTTON3

END IF

CASE %IDC_LABEL1

CASE %IDC_LABEL3

CASE %IDC_LABEL4

END SELECT
END SELECT
END FUNCTION
'------------------------------------------------------------------------------

'------------------------------------------------------------------------------
' ** Dialogs **
'------------------------------------------------------------------------------
FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
LOCAL lRslt AS LONG

#PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
LOCAL hDlg AS DWORD

DIALOG NEW hParent, "G-Code to DXF", 73, 156, 274, 94, %WS_POPUP OR _
%WS_BORDER OR %WS_DLGFRAME OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR _
%DS_MODALFRAME OR %DS_CENTER OR %DS_3DLOOK OR %DS_NOFAILCREATE OR _
%DS_SETFONT, %WS_EX_WINDOWEDGE OR %WS_EX_CONTROLPARENT OR _
%WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
CONTROL ADD BUTTON, hDlg, %IDC_BUTTON1, "Import G-Code", 5, 10, 65, 15
CONTROL ADD BUTTON, hDlg, %IDC_BUTTON2, "Convert to DXF", 5, 45, 65, 15
CONTROL ADD LABEL, hDlg, %IDC_LABEL1, "None", 10, 30, 255, 10
CONTROL ADD LABEL, hDlg, %IDC_LABEL3, "Line : ", 80, 50, 25, 10
CONTROL ADD LABEL, hDlg, %IDC_LABEL4, "", 110, 50, 155, 10
CONTROL ADD BUTTON, hDlg, %IDC_BUTTON3, "Exit", 205, 70, 50, 15
#PBFORMS END DIALOG
InitUrlCtrl ' INI for URL's
CONTROL ADD "PBURL32", hDlg, 106, "By Wayne Hill;mailto:wayne_j_hill@yahoo.com", _
10, 70, 80, 14, %WS_VISIBLE OR %WS_CHILD

DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt

#PBFORMS BEGIN CLEANUP %IDD_DIALOG1
#PBFORMS END CLEANUP

FUNCTION = lRslt
END FUNCTION
'------------------------------------------------------------------------------
FUNCTION ExeName(Op AS LONG) AS STRING
LOCAL TmpAsciiz AS ASCIIZ * 256
GetModuleFileName GetModuleHandle(BYVAL 0&), TmpAsciiz, 255
IF Op = 1 THEN
FUNCTION = TmpAsciiz
ELSE
LOCAL i AS LONG, j AS LONG
DO
j = INSTR(i + 1, TmpAsciiz, "\")
IF j = 0 THEN EXIT DO ELSE i = j
LOOP
IF Op = 2 THEN FUNCTION = LEFT$(TmpAsciiz$, i) ELSE _ ' With final \
FUNCTION = MID$(TmpAsciiz$, i + 1)
END IF
END FUNCTION

SUB PARSEFILE( hWnd AS LONG,SMYSOURCEFILE AS STRING )


DIM TypNew AS TypPoints

DIM MyResults AS TypPoints
DIM lNumberOfLines AS LONG
DIM lNumberofAlpha_Codes AS LONG
DIM lLineCount AS LONG
DIM lAlphaCode_Count AS LONG
DIM lAlphaCodePos AS LONG
DIM lAlphaValue AS LONG
DIM sLine AS STRING
DIM sLineParsed AS STRING
DIM sAlphaCode AS STRING
DIM sGMode AS STRING
LOCAL ArcCenterX AS SINGLE
LOCAL ArcCenterY AS SINGLE
LOCAL SideXs AS SINGLE
LOCAL SideYs AS SINGLE
LOCAL Radius AS SINGLE
LOCAL AngleEnd AS SINGLE
LOCAL AngleStart AS SINGLE
LOCAL LineCounter AS LONG
LineCounter = 48 ' Start at 48 for AutoCAD Line Number Entity
DIM HFILE AS LONG
DIM sBUFFER AS STRING
DIM sTemp AS STRING

TypOld = TypNew ' Clear


HFILE = FREEFILE
OPEN SMYSOURCEFILE FOR INPUT AS HFILE
WHILE ISFALSE EOF( HFILE )
LINE INPUT# HFILE, sTemp
CONTROL SET TEXT hWnd , %IDC_LABEL4, sTemp
sBUFFER = sBUFFER + sTemp + $CRLF
DIALOG DOEVENTS
WEND
CLOSE HFILE

HFILE = FREEFILE
OPEN "Data.DXF" FOR OUTPUT AS HFILE 'DXF FILE.
PRINT #HFILE, " 0"
PRINT #HFILE, "SECTION"
PRINT #HFILE, " 2"
PRINT #HFILE, "ENTITIES"

lNumberOfLines = TALLY( sBUFFER, $CRLF )
FOR lLineCount = 1 TO lNumberOfLines
DIALOG DOEVENTS
CONTROL SET TEXT hWnd , %IDC_LABEL4, STR$(lLineCount)
sLine = PARSE$( sBUFFER, $CRLF, lLineCount )
sLine = PARSE$( sLine, "(", 1 ) ' REMOVE COMMENT LINE
sLine = UCASE$( sLine ) ' CHANGE TO UPPERCASE
sLine = REMOVE$( sLine, " " ) ' REMOVE SPACES
lNumberofAlpha_Codes = TALLY( sLine, ANY $ALPHA )
FOR lAlphaCode_Count = 1 TO lNumberofAlpha_Codes
lAlphaCodePos = INSTR( - 1, sLine, ANY $ALPHA ) ' FIND THE RIGHTMOST LETTER
sLineParsed = MID$( sLine, lAlphaCodePos, LEN( sLine )) ' GET THE CODE AND THE VALUE
sLine = EXTRACT$( sLine, sLineParsed ) ' REMOVE IT FROM THE MAIN STRING
sAlphaCode = LEFT$( sLineParsed, 1 )
SELECT CASE sAlphaCode
CASE "X"
TypNew.X = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "Y"
TypNew.Y = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "Z"
TypNew.Z = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "R"
TypNew.R = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "I"
TypNew.I = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "J"
TypNew.J = VAL( FORMAT$( VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 )), $DP ))
CASE "G"
lAlphaValue = VAL( PARSE$( sLineParsed, ANY $ALPHA, 2 ))
SELECT CASE lAlphaValue
CASE 0
sGMode = "0" ' Group 1 G Codes
CASE 1
sGMode = "1"
CASE 2
sGMode = "2"
CASE 3
sGMode = "3"
END SELECT
END SELECT
NEXT ALPHACODECOUNT

IF sGMode = "3" OR sGMode = "2" THEN

IF TypNew.R <> 0 THEN
MyResults.X1 = TypOld.X
MyResults.Y1 = TypOld.Y
MyResults.X2 = TypNew.X
MyResults.Y2 = TypNew.Y
Radius = TypNew.R
MyResults.R = ABS( Radius )
CalcCenters MyResults

IF ( sGMode = "2" ) AND ( SGN( Radius ) = - 1 ) THEN
ArcCenterX = MyResults.X2
ArcCenterY = MyResults.Y2
END IF
IF ( sGMode = "2" ) AND ( SGN( Radius ) = 1 ) THEN
ArcCenterX = MyResults.X1
ArcCenterY = MyResults.Y1
END IF
IF ( sGMode = "3" ) AND ( SGN( Radius ) = - 1 ) THEN
ArcCenterX = MyResults.X1
ArcCenterY = MyResults.Y1
END IF
IF ( sGMode = "3" ) AND ( SGN( Radius ) = 1 ) THEN
ArcCenterX = MyResults.X2
ArcCenterY = MyResults.Y2
END IF
GOTO PlotPoint
END IF

IF ( TypNew.I <> 0 ) OR ( TypNew.J <> 0 ) THEN
ArcCenterX = TypOld.X + TypNew.I
ArcCenterY = TypOld.Y + TypNew.J
END IF

PlotPoint:
MyResults.X1 = ArcCenterX ' Center of Circle
MyResults.Y1 = ArcCenterY
MyResults.X2 = TypOld.X ' Point in Radius
MyResults.Y2 = TypOld.Y

CalcAngle MyResults
AngleStart = MyResults.ang
MyResults.X1 = ArcCenterX ' Center of Circle
MyResults.Y1 = ArcCenterY
MyResults.X2 = TypNew.X ' Point in Radius
MyResults.Y2 = TypNew.Y

CalcAngle MyResults
AngleEnd = MyResults.ang
TypNew.R = MyResults.r
IF sGMode = "3" THEN
IF AngleStart = > AngleEnd THEN AngleEnd = AngleEnd + 360
END IF
IF sGMode = "2" THEN
IF AngleStart < = AngleEnd THEN AngleEnd = AngleEnd - 360
END IF
PRINT #HFILE, " 0"
PRINT #HFILE, "ARC"
PRINT #HFILE, " 5"
PRINT #HFILE, HEX$( LineCounter )
PRINT #HFILE, "100"
PRINT #HFILE, "AcDbEntity"
PRINT #HFILE, " 8"
PRINT #HFILE, "0"
PRINT #HFILE, " 62" ' Line Color Format
PRINT #HFILE, " " + STR$( 45 ) ' Line Color
PRINT #HFILE, "100"
PRINT #HFILE, "AcDbCircle"
PRINT #HFILE, " 10"
PRINT #HFILE, ArcCenterX
PRINT #HFILE, " 20"
PRINT #HFILE, ArcCenterY
PRINT #HFILE, " 30"
PRINT #HFILE, TypOld.Z
PRINT #HFILE, " 40"
PRINT #HFILE, TypNew.R
PRINT #HFILE, "100"
PRINT #HFILE, "AcDbArc"
PRINT #HFILE, " 50"
IF sGMode = "2" THEN PRINT #HFILE, AngleEnd
IF sGMode = "3" THEN PRINT #HFILE, AngleStart
PRINT #HFILE, " 51"
IF sGMode = "2" THEN PRINT #HFILE, AngleStart
IF sGMode = "3" THEN PRINT #HFILE, AngleEnd
INCR LineCounter
TypOld.X = TypNew.X
TypOld.Y = TypNew.Y
TypOld.Z = TypNew.Z
TypNew.R=0
TypNew.I=0
TypNew.J=0


ITERATE FOR
END IF

PRINT #HFILE, " 0"
PRINT #HFILE, "LINE"
PRINT #HFILE, " 5"
PRINT #HFILE, HEX$( LineCounter )
PRINT #HFILE, "100"
PRINT #HFILE, "AcDbEntity"
PRINT #HFILE, " 8"
PRINT #HFILE, "0"
PRINT #HFILE, " 62" ' Line Color Format
PRINT #HFILE, " " + STR$( 45 ) ' Line Color
PRINT #HFILE, "100"
PRINT #HFILE, "AcDbLine"
PRINT #HFILE, " 10"
PRINT #HFILE, TypOld.X
PRINT #HFILE, " 20"
PRINT #HFILE, TypOld.Y
PRINT #HFILE, " 30"
PRINT #HFILE, TypOld.Z
PRINT #HFILE, " 11"
PRINT #HFILE, TypNew.X
PRINT #HFILE, " 21"
PRINT #HFILE, TypNew.Y
PRINT #HFILE, " 31"
PRINT #HFILE, TypNew.Z
INCR LineCounter
TypOld.X = TypNew.X
TypOld.Y = TypNew.Y
TypOld.Z = TypNew.Z
NEXT lLineCount
PRINT #HFILE, " 0"
PRINT #HFILE, "ENDSEC"
PRINT #HFILE, " 0"
PRINT #HFILE, "EOF"
CLOSE HFILE
END SUB
' ================================================================================
'
' CalcCenters calculates the centers of two circles given their points
' of intersection and common radius.
'
' ================================================================================
'
SUB CalcCenters( BYREF Centers AS TypPoints )
LOCAL c AS TypPoints ' Points of intersection
LOCAL H1!, H2!, K1!, K2!, X!, Y!, D!, D2!
c = Centers
X = c.x1 - c.x2
Y = c.y1 - c.y2
D2 = X^2 + Y^2
D = SQR( D2 )
IF 2 * c.r < D, THEN ' values of H and K are not real
c.x1 = 0! ' and there is no solution.
c.x2 = 0!
c.y1 = 0!
c.y2 = 0!
c.r = 0!
Centers = c
EXIT SUB
END IF
K1 = ( Y + X * SQR( 4 * c.r^2 / D^2 - 1 )) / 2
K2 = ( Y - X * SQR( 4 * c.r^2 / D^2 - 1 )) / 2
H1 = ( X^2 - Y * ( 2 * K1 - Y )) / ( 2 * X )
H2 = ( X^2 - Y * ( 2 * K2 - Y )) / ( 2 * X )
h1 = H1 + c.x2
h2 = H2 + c.x2
k1 = K1 + c.y2
k2 = K2 + c.y2
c.x1 = h1
c.x2 = h2
c.y1 = k1
c.y2 = k2
c.r = c.r
Centers = c
END SUB
'
' ================================================================================
'
' CalcAngle calculates the angle of radius given
' center of circle to point on circomeference.
'
' ================================================================================
'
SUB CalcAngle( BYREF tPoints AS TypPoints )
LOCAL c AS TypPoints ' Radius and Angle of circle
LOCAL X!, Y!, R!
c = tPoints
X = c.x2 - c.x1
Y = c.y2 - c.y1
c.r = SQR( X^2 + Y^2 ) ' Hyp of angle (Radius)
IF c.r = 0 THEN ' values are not real
c.x1 = 0! ' and there is no solution.
c.x2 = 0!
c.y1 = 0!
c.y2 = 0!
c.r = 0!
c.ang = 0!
tPoints = c
EXIT SUB
END IF
' Find quadrant of angle in radians
IF x = 0 THEN
IF y > = 0 THEN
c.ang = PI / 2
ELSE ' Y
c.ang = 3 * PI / 2
END IF 'Y
ELSE ' X
c.ang = ATN( Y / X )
END IF 'X
IF X < 0 THEN
c.ang = c.ang + PI
ELSE
IF ( x > 0 ) AND ( y < 0 ) THEN
c.ang = c.ang + 2 * PI
END IF
END IF
c.ang = c.ang * 180 / pi ' Convert to Decimal Degrees
tPoints = c
END SUB



I want to thank you for this little program that made possible to complete a job by using it. thanks

bhavik
07-09-2011, 06:53 AM
i have downloaded the gcode to dxf converter

but i have .txt file when i click on convert it prompt msg finished & lines : 968

But the output file .dxf is not created

Pls help

I problem is i want to do following things:::

open a dxf file in vb
edit the dxf file
save the dxf file

Can u help me on this issue

WayneHill
07-27-2011, 10:11 PM
Thank you MikeNuke.

bhavik : Search for filename "Data.DXF" on your computer.

bhavik
07-28-2011, 01:28 AM
it is showing me blank

Data.DXF file is blank

what should i do

can it be possible to open a dxf file in vb6 & then edit it
& again save the edited file in dxf format

Pls rply

WayneHill
07-31-2011, 10:28 AM
Bhavic,

Can you post the code program you are trying to convert?

Rolf_K
08-24-2011, 12:26 PM
Hi Wayne,

I am not a programmer and I am looking desperately for a little program that would read my dxf files and do a "tool path sort" and write it back to dxf.
Nothing fancy, no graphics are needed.

When I convert B&W drivings into vector files and send them to my engraver the transverse time of the head is more than the actual engraving time.
So just a small improvement would be great.
The problems seem to be mostly with the many shorter polly arc lines.

I could of cause buy a newer full fledged engraving program with this function, but that seems like waste of money when I only do this as a hobby.

Rolf

WayneHill
08-26-2011, 06:48 PM
Hi Rolf,

It is an interesting project. The issue I think of is determining what direction arcs are set for on a toolpath. If all the lines and arcs are sorted to the closest entity start or end point, then the programming fun begins. All point to point would be easier to sort. Any lurkers out there looking for a challenge?

scbauml
09-02-2011, 04:44 PM
However it's not reading G02 and G03 codes... Am I not seeing something?
Thanks!!!!

Rolf_K
09-02-2011, 06:32 PM
Bhavic,

Can you post the code program you are trying to convert?

Problem solved, but it took two programs at the cost of about $100.
First I had to get a newer version of CorelDRAW to import my DXF file into.
Secondly I bought a Corel add-on called "Artwork Optimizier for CorelDRAW Standard Edition"

Corel now Exports sorted DXF files that cuts down the traverse time of the cutting tool substantially.

Rolf

WayneHill
09-07-2011, 11:05 AM
Rolf,

Good to hear!

WayneHill
09-07-2011, 09:04 PM
scbauml,

Can you post the CNC code that is not working? It could be a formatting type the software does not work with.

Thanks,

Wayne

bhavik
09-08-2011, 02:32 AM
HIII

i am working with vb6 & drawing the semi circle with Circle command in vb6 on picturebox which is drawn fine

My problem is that the endpoints are coincided with the points where i have made selection & given command to draw a semi circle
So how can i coincide the points

Second problem is when i m saving the semi circle in dxf format & when view in it it is shown as a polygon with 10 points connected with line

Similarly when i zoom in the endpoints are not connected with the start ^& end point of line which is selected

how can i overcome the problem

Pls any body help is appreciated

WayneHill
09-17-2011, 01:33 AM
[


It could be a default setting of autocad that defines the graphic circle tolerance.

QUOTE=bhavik;989877]HIII

i am working with vb6 & drawing the semi circle with Circle command in vb6 on picturebox which is drawn fine

My problem is that the endpoints are coincided with the points where i have made selection & given command to draw a semi circle
So how can i coincide the points

Second problem is when i m saving the semi circle in dxf format & when view in it it is shown as a polygon with 10 points connected with line

Similarly when i zoom in the endpoints are not connected with the start ^& end point of line which is selected

how can i overcome the problem

Pls any body help is appreciated[/QUOTE]

bhavik
09-17-2011, 03:04 AM
HIIIIII

I have thew problem in setting the lineStyle i.e DAshed & continous

I m using VB6 & opening the DXF file & saving in DXF format

But I m unble to set LSTYLE to Dashed & Again reset to Continus or solid lines

Since i have toi distinguish my object with diffent lines But i m unable to do so since the LSTYLE is set in header section
I want it to be change in when & were required 3
How can i do this

Pls help is appriciated

Another case is of displaying Filled circle How can i stored information tat thecircle is fiiled with suppose Yellow color

Can this be possible

Pls help

jorgecventoso
10-13-2011, 10:17 AM
Hello Wayne,

I need help because i only have file .nc and the program not accept this tipe of file. Exist any mode to convert .nc to .dxf?
thanks you,
Jorge Ventoso

WayneHill
12-26-2011, 10:34 AM
Just rename the file to TXT extension.

Mat composite
01-30-2012, 03:18 AM
Thanks Joe. Now you can rotate or scale the code as you like. :banana:

Wayne

Hello Mister Hill,

I search for the same application but with only the G1 deplacement, it is posssible ??

thank you very much for your answer.

Mat

WayneHill
01-30-2012, 11:15 AM
Hello Mat,

I sell a newer version on my web site. See my Sig link below.

Thank you,

Wayne

Vogavt
02-29-2012, 08:37 PM
Hello Mat,

I sell a newer version on my web site. See my Sig link below.

Thank you,

Wayne

Web site has either been sold, hacked or something. All I see is a lady and I'm not fluent in the language presented.

WayneHill
03-02-2012, 12:12 PM
Hello Mat,

Thank you for letting me know about this. My Web Host has been hacked for a third time. I am getting sick of this.

Grrrrrrr....


Wayne

WayneHill
03-02-2012, 10:04 PM
Mat,

This is what I think happened. My web site was registered as
codemangler.com

www in front of it defaulted to my web site. Something happen on the internet where www class of web site can be used as another web site. So I guess I lost the WWW in front of my web site... Grrrrrrr

Thank you for the information.

See my web site at
codemangler.com :)

Wayne

doorknob
03-02-2012, 11:23 PM
Mat,

This is what I think happened. My web site was registered as
codemangler.com

www in front of it defaulted to my web site. Something happen on the internet where www class of web site can be used as another web site. So I guess I lost the WWW in front of my web site... Grrrrrrr

Thank you for the information.

See my web site at
codemangler.com :)

Wayne

Where is your web hosting handled?

Most likely either your DNS record has been hijacked or someone tampered with your server's configuration.

It should be possible to get it fixed - if not by your hosting company, then by changing to a different hosting company.

WayneHill
03-03-2012, 09:41 AM
DoorKnob:

It is hosted at Portal Home - iamyourhost.com (http://www.iamyourhost.com).

They admit they had been hacked through a software flaw in a cart program on the host. It was nothing that I had done to expose any weakness on my web site.

Time to search for a secure web host...

wendtmk
03-03-2012, 12:58 PM
Wayne,

For your web site, log in only via ssh and only use sftp to transfer your files. Telnet and ftp broadcast your username and password in clear text, where ssh and sftp are encrypted. Login to your host via ssh and change your password.

Mark

Vogavt
03-10-2012, 06:43 PM
FYI,

Either you've been hosed again or you've made some changes.

The images aren't there, the "More Informaton" link and the "Purchase" like yields a HTTP-404 error.

Vogavt

WayneHill
03-10-2012, 09:28 PM
Vogavt,

I hosed my own website this time! It's back up.

The web host said the hacker installed hidden directories on the site that launched the other web site. I will be rotating my password more often. It was a php flaw that was allowed access to several web account on the host.

Thank you,


Wayne

Vogavt
03-10-2012, 09:50 PM
From your website:


The Z Low and Z High will filter out Z data within that range. This will be very handy when you need just the top level data on a GCode program.

I'm confused. Seems like you would want to exclude anything outisde of the upper and lower limits. Did you intend to say "The Z Low and Z High will filter out Z data not within that range."?

or maybe

Setting the Z Low and Z High parameters will only show the Z data within that range, i.e., excluding all other data. This will be very handy when you need just the top level data on a GCode program or data from a particular range of Z height.

WayneHill
03-10-2012, 10:10 PM
The Z filter will keep the Z positions within the Min/Max of the settings. The website will be updated to clear up this statment.


W




From your website:



I'm confused. Seems like you would want to exclude anything outisde of the upper and lower limits. Did you intend to say "The Z Low and Z High will filter out Z data not within that range."?

or maybe

Setting the Z Low and Z High parameters will only show the Z data within that range, i.e., excluding all other data. This will be very handy when you need just the top level data on a GCode program or data from a particular range of Z height.

WayneHill
04-22-2012, 10:51 PM
Hi All,

My Web Site is back up.

georgef09
09-06-2012, 02:11 PM
Wayne,

Your site seems to been down again.

George

Vogavt
09-06-2012, 07:31 PM
Wayne,

Your site seems to been down again.

George

and the tab even states "[+] Hacked by xrootx [+]" :eek:

WayneHill
09-08-2012, 08:24 PM
Thank you George!

It is back up again. Evil Hackers keep getting into the Host and pilfering the client web sites. Anybody have a suggestion for a hack proof Web host I can use ? This has happened several times. They also overrode the IP filters that was placed on it.

Wayne

wendtmk
09-09-2012, 10:28 AM
Wayne,

Dunno who you are using currently, but one of the forums I admin has Dreamhost as our hosting service. We've had very good service from them, and they are very attentive to security.

Mark

WayneHill
09-26-2012, 09:04 PM
D.P.

Here is your sample output.

Thank you,

Wayne

krugshouse
11-22-2012, 05:48 PM
i tried using this program and got mostly unusable garbae on the convert. is there anything else i can use?

tdiaz
11-22-2012, 10:37 PM
"unusable garbage" may be because you need to remove the tool movements. If you're trying to convert a 2D file (laser cutter, router, mill..) use the ignore height past .010.. then you'll get only actual cuts, not tool movement. Otherwise, the converter works by the book, and pretty darn good.

krugshouse
11-22-2012, 11:14 PM
the dialog window i get when i run the program only allows me to import the g code file. there is nothing that would allow me to set any restriction on heights.

esquire
11-26-2012, 08:46 PM
Thanks Wayne for this small and neat proggy.
Is this possible to eliminate G0 and G1 rapid movements subs?
I clean file manually, which is painful for larger files.

Thanks

arius666
12-02-2012, 10:52 AM
WayneHill, thank you for a very useful program!!!

salzburg
12-02-2012, 12:26 PM
When I click on My Blog | My Wordpress Blog (http://www.codemangler.com) all I get is wordpress blog.

How do I get to codemangler?

salzburg
12-02-2012, 12:31 PM
What is happening , I didn't type it this way. Something is mangling

what I type.

My question was: how to connect to www.codemanler.com.

All I ever get is The Blog by wordpress.

WayneHill
02-02-2013, 08:42 PM
FYI.

My web site is no longer in use. My Web Host kept F****** up on security and was constantly hacked by php script kiddies.

Bye Bye
iamyourhost.com

Good riddens.

Wayne



What is happening , I didn't type it this way. Something is mangling

what I type.

My question was: how to connect to www.codemanler.com.

All I ever get is The Blog by wordpress.

Gnork
03-19-2013, 08:27 AM
Where i can download "G-Code to DXF" now? Link in the first post is broken...

abd
05-11-2013, 02:26 PM
please i need program gcode to dxf
pleaseeeeeeeeeeeeeeeeeeeeeeeee

WayneHill
05-20-2013, 10:28 PM
abd,

See post #15

Wayne

Vogavt
11-10-2013, 10:25 AM
Something tells me the zip file in post#15 isn't the one you were selling. Am I correct? I went looking for your previous website that was constantly getting hosed by perpetrators (sorry to hear that) but couldn't find anything new or of late.

bankshot
01-08-2014, 01:59 AM
link isnt any good, perhaps too old, can someone fix?

Kommanu
01-19-2014, 04:04 AM
Hello, i dont think so that there is a new link it's to old ; )

WayneHill
01-28-2014, 08:50 PM
There are contributes on this thread there that are taking this project to a higher level. My participation on this conversion development has ended. Onward to other projects.

Thank you,
Wayne

scorch
02-01-2014, 01:07 AM
I have updated G-Code Ripper to export DXF formatted files. The latest G-Code Ripper files are located here G-Code Ripper V0.05 (http://www.scorchworks.com/Gcoderipper/gcoderipper.html).

The rapid and controlled moves are written to different layers with different color indexes. The rapid moves can optionally be omitted from the G-Code Ripper output.

All of the arcs (G2/G3 moves) are converted to multiple linear segments for now. I will include arc output to the DXF file if there is interest. I am not sure what people are using g-code to DXF conversion data for. If it is for visualization the linear approximation should be sufficient.

I also added an option to export tool path data in CSV (Comma Separated Value) format. I am sure someone will find a use for the CSV format.

I am open to suggestions for improvement.

rccars4sal
11-17-2015, 02:35 PM
Thanks for this program. I can confirm it runs on win10 laptop. Yes, some funny arcs, but its a real time saver to recover lost drawings. Can always fill in the details, and delete extras myself.

Great times we live in. With this app, and somewhat usable raster to vector conversion its actually possible to reverse engineer simple items. No probe for my router so havent gone there yet.

RustySparks
09-15-2016, 12:03 PM
Wayne,
Thanks for great program works fine for me on Win 10 64 desktop.
I would very much like to be able to remove the rapid tool movements above the work plane, is there a version, or do you know of a version that allows removal of rapids?
Thanks again for the great work,
RustySparks

Tasdau
01-16-2018, 11:41 AM
Hi All,

I figured this is worth a bump.

Wayne Hill's original program (post #15) and Jonk's (#36) were the only two that worked for me. Wayne's read all my G codes with the shortened syntax of G1, G2, G3, etc. but only used up to 4 decimal places for the coordinates. Jonk's read up to 5 decimal places but needed all the G codes replaced with their longer counterparts (G01, G02, etc).

Thanks to all for a huge time saver!

WayneHill
03-25-2018, 12:13 AM
You are welcome. It seems a lifetime ago the program was written. Looks like it still stands up.