585,996 active members*
4,096 visitors online*
Register for free
Login
Page 9 of 12 7891011
Results 161 to 180 of 228
  1. #161
    Join Date
    Mar 2004
    Posts
    761
    Sorry for the double post
    Wayne Hill

  2. #162
    Join Date
    Mar 2004
    Posts
    761

    Lightbulb DXF header test

    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
    Attached Files Attached Files
    Wayne Hill

  3. #163
    Join Date
    Mar 2004
    Posts
    1806
    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
    Art
    AKA Country Bubba (Older Than Dirt)

  4. #164
    Join Date
    Mar 2004
    Posts
    761
    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
    Wayne Hill

  5. #165
    Join Date
    Mar 2004
    Posts
    1806
    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
    Attached Files Attached Files
    Art
    AKA Country Bubba (Older Than Dirt)

  6. #166
    Join Date
    Jun 2010
    Posts
    0
    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

  7. #167
    Join Date
    Mar 2004
    Posts
    761
    Thank you Bubba - I will be working in it this weekend.
    Wayne Hill

  8. #168
    Join Date
    Mar 2004
    Posts
    761

    Post AutoCAD2000 DXF test file

    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
    Attached Files Attached Files
    Wayne Hill

  9. #169
    Join Date
    Mar 2004
    Posts
    1806
    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:{(
    Art
    AKA Country Bubba (Older Than Dirt)

  10. #170
    Join Date
    Mar 2004
    Posts
    761

    I found a new method of testing DXF files

    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
    Wayne Hill

  11. #171
    Join Date
    Jun 2010
    Posts
    0

    CONVERT GCODE2DXF

    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:
    Attached Files Attached Files

  12. #172
    Join Date
    Mar 2004
    Posts
    761
    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
    Wayne Hill

  13. #173
    Quote Originally Posted by WayneHill View Post
    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


    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:[email protected]", _
                    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

  14. #174
    Join Date
    Jul 2011
    Posts
    0
    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

  15. #175
    Join Date
    Mar 2004
    Posts
    761
    Thank you MikeNuke.

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

  16. #176
    Join Date
    Jul 2011
    Posts
    0

    edit a dxf file in vb6

    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

  17. #177
    Join Date
    Mar 2004
    Posts
    761
    Bhavic,

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

  18. #178
    Join Date
    Dec 2007
    Posts
    98

    DXF - Tool Path Sorting .......

    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

  19. #179
    Join Date
    Mar 2004
    Posts
    761
    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?
    Wayne Hill

  20. #180
    Join Date
    Nov 2005
    Posts
    1

    Awesome

    However it's not reading G02 and G03 codes... Am I not seeing something?
    Thanks!!!!

Page 9 of 12 7891011

Similar Threads

  1. Replies: 51
    Last Post: 09-16-2020, 01:28 AM
  2. corel.hpgl > sheetcam.tap > pronterface.g-code > slic3r.g.code> ramps 1.4 > H-BOT
    By thesignworks in forum Uncategorised CAM Discussion
    Replies: 0
    Last Post: 05-25-2014, 02:11 PM
  3. Cambium Code Web Tools – Parametric G-code Generation
    By CambiumMachines in forum News Announcements
    Replies: 0
    Last Post: 12-19-2012, 04:37 AM
  4. Replies: 8
    Last Post: 12-15-2010, 09:32 PM

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
  •