Set Polyline from AcadEntitiy

Discussion in 'AutoCAD' started by Andrew Elmore, Jan 25, 2004.

  1. I'm haveing problems setting and AcadPolyline from an AcadEntity's Handle.
    What am I doing wrong?

    Dim Entity As AcadEntity

    For Each Entity In ThisDrawing.ModelSpace
    Select Case Entity.ObjectName
    Case "AcDbPolyline"
    Dim oPoly As AcadPolyline
    Set oPoly = ThisDrawing.HandleToObject(Entity.Handle)
    MsgBox oPoly.ObjectID
    End Select
    Next Entity
     
    Andrew Elmore, Jan 25, 2004
    #1
  2. Dim Entity As AcadEntity

    For Each Entity in ThisDrawing.ModelSpace
    Select Case Entity.ObjectName
    Case "AcDbPolyline"
    Dim oPoly As AcadPolyline
    Set oPoly = Entity
    MsgBox oPoly.ObjectID
    End Select
    Next Entity
     
    Tony Tanzillo, Jan 25, 2004
    #2
  3. I still get an error "Run-Time Error '13'"
    What would cause this?

    Public Function GetPoly()
    Dim Entity As AcadEntity

    For Each Entity In ThisDrawing.ModelSpace
    Select Case Entity.ObjectName
    Case "AcDbPolyline"
    Dim oPoly As AcadPolyline
    Set oPoly = Entity
    MsgBox oPoly.ObjectID
    End Select
    Next Entity
    End Function
     
    Andrew Elmore, Jan 25, 2004
    #3
  4. Andrew Elmore

    Jeff Mishler Guest

    Andrew,
    Be careful what you are looking for. "AcDbPolyline" refers to a LWPolyline.
    Your function is trying to place a LWpolyline in a Polyline container....If
    you want the old style polyline it needs to be "AcDb2dPolyline"

    HTH,
    Jeff
     
    Jeff Mishler, Jan 25, 2004
    #4
  5. That what it was I needed to use "LWPolyline" I was wondering why it would
    not work.
    Thanks,
    Andy
     
    Andrew Elmore, Jan 25, 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.