Results 1 to 6 of 6

Thread: Writing a DXF file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member
    Join Date
    2008-06
    Posts
    2
    Login to Give a bone
    0

    Default Writing a DXF file

    Maybe this isn't the right forum (I'm new here), but here goes....I'm trying to write a DXF file outside of AutoCAD that can be opened within AutoCad, but I'm having problems.

    I've created a simple AutoCAD drawing (a 4-sided, 2D box), saved it as a DXF file, opened it in wordpad and studied it. I wrote a piece of code in visual basic to replicate the dxf file exactly, but it won't open as a dxf file in AutoCAD. Do you follow?

    Here's the error AutoCAD gives me when I try to open my auto-generated dxf file...

    Error in APPID Table
    DXF read error on line 1418.
    Invalid or incomplete DXF input -- drawing discarded.

    I'm compared the files line-by-line and can't find a discrepency. Any tought, tips or tricks would be approciated.

    PS: I'm brand new to writing any kind of code for AutoCAD

  2. #2
    Member
    Join Date
    2008-06
    Posts
    2
    Login to Give a bone
    0

    Default Re: Writing a DXF file

    Update: I was able to open the dxf file successfully in another application (Google Sketch-up). There's something with AutoCad that just isn't syncing. The plot thickens.....


    Thanks,
    Kevin

  3. #3
    I could stop if I wanted to hugh.69031's Avatar
    Join Date
    2016-01
    Location
    Melbourne, Australia
    Posts
    360
    Login to Give a bone
    0

    Default Re: Writing a DXF file

    Try comparing the original and generated DXFs with a text comparison utility such as WINDIFF or PSPad's text compare feature (either is easy to find on the web).

    It looks like there is a difference between the two in a location ignored by SketchUp.

    Not all DXF items are required in DXF - the APPID table may be optional for your purposes.

  4. #4
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Writing a DXF file

    Or even just the built-in Windows Command line utility COMP, something like:
    Code:
    COMP File1.DXF File2.DXF > Difference.TXT
    Then open the Difference.TXT file to see the differences found.

    It may also be that your VB code writes the file in some other text encoding, something like Unicode instead of the ANSI or ASCII that AutoCAD expects. If you use the /A or /D switches for COMP you may find these differences as well. From COMP's /? help:
    Compares the contents of two files or sets of files.

    COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C] [/OFF[LINE]]

    data1 Specifies location and name(s) of first file(s) to compare.
    data2 Specifies location and name(s) of second files to compare.
    /D Displays differences in decimal format.
    /A Displays differences in ASCII characters.
    /L Displays line numbers for differences.
    /N=number Compares only the first specified number of lines in each file.
    /C Disregards case of ASCII letters when comparing files.
    /OFF[LINE] Do not skip files with offline attribute set.

    To compare sets of files, use wildcards in data1 and data2 parameters.

  5. #5
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Writing a DXF file

    Heard about TextPad it is great to edit and do everything in multiple or single ASCII files.
    http://www.textpad.com/

    : ) Happy Computing !

    kennet

  6. #6
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Writing a DXF file

    Seeing as you're doing the programming in VB. Can't you rather just use the AutoCAD Type Library in the References. Then create the lines directly in a DWG file using the ActiveX objects & methods?

    The code will run if you've got AutoCAD installed on the PC. Or else you may have to look at RealDWG.

Similar Threads

  1. Writing dwg's to a zip file.
    By kdayman in forum VBA/COM Interop
    Replies: 14
    Last Post: 2008-08-12, 06:13 PM
  2. Problem writing to a file
    By ppirtle in forum Revit - API
    Replies: 3
    Last Post: 2008-02-15, 09:23 PM
  3. STC failure with error writing to backup file
    By Wes Macaulay in forum Revit - Worksharing/Worksets/Revit Server
    Replies: 6
    Last Post: 2007-10-03, 12:40 AM
  4. Writing to a text file
    By ewuensch in forum AutoLISP
    Replies: 4
    Last Post: 2007-02-22, 01:05 PM
  5. Replies: 1
    Last Post: 2005-08-13, 04:37 PM

Posting Permissions

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