why LWPOLYLINE's ObjectName is AcDbPolyline?

Discussion in 'AutoCAD' started by weslleywang, Feb 2, 2004.

  1. weslleywang

    weslleywang Guest

    Hi:
    this is really confused me:
    Dim obj1 As AcadObject
    Dim pt1
    ThisDrawing.Utility.GetEntity obj1, pt1

    MsgBox obj1.ObjectName

    When I pick a LWPOYLINE, it show up as AcDbPolyline. Why not AcDbLWPolyline? does a system variable affect it? a bug? I really appreaciate any one could point out the reason.


    Thanks
    Wes
     
    weslleywang, Feb 2, 2004
    #1
  2. weslleywang

    Mark Propst Guest

    don't know if it's a bug but it does seem wrong.
    this is another reason not to test on objectname property(per posts by TT
    and others in past)

    If TypeOf obj1 Is AcadLWPolyline Then
    MsgBox "Lightweight"
    Else
    MsgBox "Regular"
    End if

    AcDbLWPolyline? does a system variable affect it? a bug? I really
    appreaciate any one could point out the reason.
     
    Mark Propst, Feb 2, 2004
    #2
  3. weslleywang

    egc Guest

    It may be because the LWPolyline is derived from the Polyline (base
    class) but I am just guessing.
     
    egc, Feb 2, 2004
    #3
  4. weslleywang

    developer Guest

    Lightweight polylines are AcDbPolyline and the old style polylines are AcDb2dPolyline. I'm not sure about the reasoning behind this standard, but I don't think it's a bug.
     
    developer, Feb 2, 2004
    #4
  5. weslleywang

    Mark Propst Guest

    right you are, but the inconsistency between object type and object name, if
    not a bug, is at least confusing programming style
    :)~

    Dim pl As AcadEntity
    Dim vpt
    ThisDrawing.Utility.GetEntity pl, vpt, "Pick"

    Select Case True
    Case TypeOf pl Is AcadLWPolyline
    MsgBox "Lightweight: " & pl.ObjectName
    Case TypeOf pl Is AcadPolyline
    MsgBox "Heavy weight 2d: " & pl.ObjectName
    Case TypeOf pl Is Acad3DPolyline
    MsgBox "Heavy weight 3d: " & pl.ObjectName
    Case Else
    MsgBox "Something else: " & pl.ObjectName
    End Select


    AcDb2dPolyline. I'm not sure about the reasoning behind this standard, but
    I don't think it's a bug.
     
    Mark Propst, Feb 2, 2004
    #5
  6. weslleywang

    developer Guest

    You seem to be confused by more than just the programming style. What's with the face?
     
    developer, Feb 2, 2004
    #6
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.