G-Code to DXF

Page 1 of 12 123411 ... LastLast
Results 1 to 20 of 229

Thread: G-Code to DXF

  1. #1
    Member WayneHill's Avatar
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    761
    Downloads
    0
    Uploads
    0

    Default G-Code to DXF

    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/Downl...file.php?id=22


    Code:
    #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


    Similar Threads:


  2. #2
    www.joescnc.com joecnc2006's Avatar
    Join Date
    Aug 2004
    Location
    usa
    Posts
    3215
    Downloads
    2
    Uploads
    0

    Default

    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

    Attached Images Attached Images


  3. #3
    Member WayneHill's Avatar
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    761
    Downloads
    0
    Uploads
    0

    Cool

    Quote Originally Posted by joe2000che
    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.

    Wayne



  4. #4
    Registered smoregrava's Avatar
    Join Date
    Sep 2005
    Location
    Norway
    Posts
    197
    Downloads
    0
    Uploads
    0

    Default

    Waynehill you're the king!!
    This was just a perfect program have been searching the nett for a program like this. thank you



  5. #5
    Member CLaNZeR's Avatar
    Join Date
    Jul 2005
    Location
    UK
    Posts
    113
    Downloads
    0
    Uploads
    0

    Default

    Excellent Waynehill

    Works a treat this end!

    Regards

    Sean.



  6. #6
    Member WayneHill's Avatar
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    761
    Downloads
    0
    Uploads
    0

    Default

    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

    Wayne Hill


  7. #7
    Registered
    Join Date
    Oct 2004
    Location
    USA
    Posts
    742
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by WayneHill

    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



  8. #8
    Member WayneHill's Avatar
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    761
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by CJL5585
    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

    Wayne Hill


  9. #9
    Registered
    Join Date
    May 2004
    Location
    United States
    Posts
    200
    Downloads
    0
    Uploads
    0

    Default

    never heard of power basic.. that a mac program?



  10. #10
    Member WayneHill's Avatar
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    761
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by tekno
    never heard of power basic.. that a mac program?
    It's a Windows basic compiler.

    www.powerbasic.com

    I also program in Delphi.

    Wayne Hill


  11. #11
    Registered
    Join Date
    Dec 2005
    Location
    South Africa
    Posts
    4
    Downloads
    0
    Uploads
    0

    Default

    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



  12. #12
    Member WayneHill's Avatar
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    761
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by cheeky
    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/Downl...file.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

    Wayne Hill


  13. #13
    Registered
    Join Date
    Dec 2005
    Location
    South Africa
    Posts
    4
    Downloads
    0
    Uploads
    0

    Default

    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



  14. #14
    Member WayneHill's Avatar
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    761
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by cheeky
    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.

    Wayne Hill


  15. #15
    Member WayneHill's Avatar
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    761
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by cheeky
    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.

    Attached Files Attached Files
    Wayne Hill


  16. #16
    Registered mikkojay's Avatar
    Join Date
    Mar 2006
    Location
    USA
    Posts
    119
    Downloads
    0
    Uploads
    0

    Default

    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

    Attached Files Attached Files
    Expensive tools can be cheaper than professional therapy


  17. #17
    Member WayneHill's Avatar
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    761
    Downloads
    0
    Uploads
    0

    Cool Cool

    Good going Mike. I put the source code out there for all to use.

    Wayne

    Wayne Hill


  18. #18
    Registered
    Join Date
    Oct 2006
    Location
    usa
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default Not getting expected results

    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.



  19. #19
    Registered MetLHead's Avatar
    Join Date
    Mar 2003
    Location
    USA
    Posts
    765
    Downloads
    0
    Uploads
    0

    Default

    Can you post a sample G-Code file?

    Regards,
    Scott



  20. #20
    Member WayneHill's Avatar
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    761
    Downloads
    0
    Uploads
    0

    Default

    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 Hill


Page 1 of 12 123411 ... LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

G-Code to DXF

G-Code to DXF