Vertex of polyline

Discussion in 'AutoCAD' started by fazzini, Jan 19, 2004.

  1. fazzini

    fazzini Guest

    I've make this wrong routine for get the coordinates of
    the first and second vertex of a polyline.

    Private Sub DirPol(Pol As AcadLWPolyline)
    Dim PrimoVer As Variant
    Dim SecondoVer As Variant
    Set PrimoVer = Pol.Coordinate(0) 'first vertex
    Set SecondoVer = Pol.Coordinate(1) 'second vertex
    End Sub

    I have make an error? thx?
     
    fazzini, Jan 19, 2004
    #1
  2. fazzini

    LochDhu Guest

    Lose the 'Set' keyword.

    Scott
     
    LochDhu, Jan 19, 2004
    #2
  3. fazzini

    Tim J Guest

    Also, the first vertex is going to have 2 coordinates (x and y) and the
    second will have 2.

    PrimoVer(0)=Pol.Coordinate(0)
    PrimoVer(1)=Pol.Coordinate(1)
    SecondoVer(0)=Pol.Coordinate(2)
    SecondoVer(1)=Pol.Coordinate(3)
     
    Tim J, Jan 19, 2004
    #3
  4. fazzini

    LochDhu Guest

    Coordinate returns a 2-element array of doubles for a LWPoly...

    So my code is fine.

    PrimoVer(0) will be the X of first Vertex
    PrimoVer(1) will be the Y of first Vertex.

    Scott
     
    LochDhu, Jan 19, 2004
    #4
  5. fazzini

    Tim J Guest

    Sorry about that, you are right. I confused the Coordinate property with
    the Coordinates property which returns all of the elements in one array.
     
    Tim J, Jan 19, 2004
    #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.