Invalid class: Heavy polylines

Discussion in 'AutoCAD' started by randy benson, Jun 30, 2004.

  1. randy benson

    randy benson Guest

    Are 2d (heavy) polylines going extinct? Is that why I get the following?
    Just curious...

    I'm picking a POLYLINE that's been converted from an LWPolyline to
    Heavy, so it's now an AcDb2dPolyline. Here's what the assoc data looks
    like when unclumped:

    Command: get
    Select object:
    (-1 . <Entity name: 7efa6690>)
    (0 . POLYLINE)
    (330 . <Entity name: 7ef8e008>)
    (5 . B652)
    (100 . AcDbEntity)
    (67 . 0)
    (410 . Model)
    (8 . HATCH-OL-BRICK)
    (100 . AcDb2dPolyline)
    (66 . 1)
    (10 0.0 0.0 0.0)
    (70 . 1)
    (40 . 0.0)
    (41 . 0.0)
    (210 0.0 0.0 1.0)
    (71 . 0)
    (72 . 0)
    (73 . 0)
    (74 . 0)
    (75 . 0)


    Now pick the same polyline:

    Command: (setq ep (entsel "\nPick entity: "))

    Pick entity: (<Entity name: 7efa6690> (4639.94 4596.06 0.0))


    Command: (setq vo (vlax-ename->vla-object (car ep )))
    #<VLA-OBJECT IAcadLWPolyline 0ff856c4>

    And dump it:

    Command: (vlax-dump-object vo)
    ; IAcadLWPolyline: AutoCAD Lightweight Polyline Interface
    ; Property values:
    ; Application (RO) = #<VLA-OBJECT IAcadApplication 00b9b5e4>
    ; Area (RO) = AutoCAD.Application: Invalid class
    ; Closed = AutoCAD.Application: Invalid class
    ; ConstantWidth = AutoCAD.Application: Invalid class
    ; Coordinate = ...Indexed contents not shown...
    ; Coordinates = AutoCAD.Application: Invalid class
    ; Document (RO) = #<VLA-OBJECT IAcadDocument 01161740>
    ; Elevation = AutoCAD.Application: Invalid class
    ; Handle (RO) = "B652"
    ; HasExtensionDictionary (RO) = 0
    ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0ff76f14>
    ; Layer = "HATCH-OL-BRICK"
    ; Length (RO) = AutoCAD.Application: Invalid class
    ; Linetype = "BYLAYER"
    ; LinetypeGeneration = AutoCAD.Application: Invalid class
    ; LinetypeScale = 1.0
    ; Lineweight = -1
    ; Normal = AutoCAD.Application: Invalid class
    ; ObjectID (RO) = 2130339472
    ; ObjectName (RO) = "AcDb2dPolyline"
    ; OwnerID (RO) = 2130239496
    ; PlotStyleName = "ByLayer"
    ; Thickness = AutoCAD.Application: Invalid class
    ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 0ff71bd0>
    ; Visible = -1
     
    randy benson, Jun 30, 2004
    #1
  2. randy benson

    Doug Broad Guest

    Randy,
    I think you need to release the old vla-object before you
    use vlax-ename->vla-object on the new object.
    By converting the polyline without releasing the object,
    the vla-object is still cast to the old object type (I think).

    Close the drawing and open it again. All the problems
    will probably go away.
     
    Doug Broad, Jun 30, 2004
    #2
  3. randy benson

    randy benson Guest

    Hi Doug,
    Thanks! -

    2) You're right -- closing and reopening the drawing fixed it, but

    1) I don't see where the old object is ever touched by anything even
    requiring (vl-load-com), much less any vlax- functions; my 'get' routine
    uses only vanilla lisp functions. But I opened a new drawing, drew an
    lwpoly, converted heavy, selected 'last', and got the correct result
    this time, so...
     
    randy benson, Jun 30, 2004
    #3
  4. randy benson

    randy benson Guest

    In addition to making the variable local, I should get in the habit of
    performing

    (if vo (vlax-release-object vo))

    at the end of these fns?
     
    randy benson, Jun 30, 2004
    #4
  5. randy benson

    Doug Broad Guest

    Randy,
    Glad its working for you. Its really impossible
    to guess what's causing your problems without
    looking at your code, the command history, and
    any reactors running.

    At least you know now that AutoCAD still
    supports the heavy polylines.
     
    Doug Broad, Jul 1, 2004
    #5
  6. randy benson

    randy benson Guest

    No reactors running; just simple straighforward etudes like the following - in general is a vlax- object 'attached' by vlax-ename->vla-object or by vlax-get-property such that it needs to be released?

    ; AL - Get Arclength property from an entity that has one.
    (vl-load-com)
    (defun c:al ( / ep vo)
    (cond
    ( (not (setq ep (entsel "\nPick Arc: ")))
    (princ "\nMissed. Try again. ")
    )
    ( (not
    (vlax-property-available-p
    (setq vo (vlax-ename->vla-object (car ep ))) 'ArcLength
    )
    )
    (princ "\nEntity is not an Arc. Try again. ")
    )
    ( t
    (princ
    (strcat
    "\nArcLength="
    (rtos (vlax-get-property vo 'ArcLength) 2 2)
    "ft."
    )
    )
    )
    )
    (if vo (vlax-release-object vo)) ; this addition doesn't appear to do any harm at least...
    (princ)
    )
     
    randy benson, Jul 1, 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.