Does anyone have a 'Load points' Routine?

Discussion in 'AutoCAD' started by john_m_lee, Nov 14, 2004.

  1. john_m_lee

    john_m_lee Guest

    Before I begin trying to write my first VB program for AutoCAD, does anyone have a simple 'Load Points' routine that I can start from? All I want to do is write a program that will take a CSV file containing x,y,z type data and create the points within a drawing.

    Sounds easy enough but if someone has already written it, I have no ego in this...

    John
     
    john_m_lee, Nov 14, 2004
    #1
  2. This should give you an idea of how to write your own program:

    Private Sub ImportPoints(FileName As String)
    Dim fn As Integer
    Dim point(0 To 2) As Double

    If Dir(FileName) <> "" Then
    fn = FreeFile
    Open FileName For Input As fn
    Do
    Input #fn, point(0), point(1), point(2)
    ThisDrawing.ModelSpace.ADDPoint point
    Loop While Not EOF(fn)
    End If

    End Sub
     
    Jorge Jimenez, Nov 14, 2004
    #2
  3. john_m_lee

    smjgsmith Guest

    You can do this with standard AutoCAD.

    Save the csv file to a text file with a script extension (.scr). Edit the first line to be POINT MULTIPLE then the list of your xyz coordinates. Run the script in AutoCAD.
     
    smjgsmith, Nov 16, 2004
    #3
  4. john_m_lee

    john_m_lee Guest

    I created the text file that contained the four lines shown here:

    POINT MULTIPLE
    100,100,100
    200,200,200
    300,300,300

    Since I am running AutoCAD 2005 without any other autodesk add-ons, here are the messages from the command window:

    Command: '_script
    Command: point
    Current point modes: PDMODE=0 PDSIZE=0.0000
    Specify a point: multiple

    Invalid point.
    Specify a point:

    I am not a script programmer. ANy suggestions.

    Thanks,

    John

    :
     
    john_m_lee, Feb 18, 2005
    #4
  5. John,
    Script programming is simply putting the same keystrokes into the file as
    you would type in ACAD. So you'd have to use "MULTIPLE POINT". The ends of
    lines in script files are like hitting the ENTER key. Be careful of stray
    SPACEs.

    James

    are the messages from the command window:
     
    James Belshan, Feb 18, 2005
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.