Objects drawn with AutoLISP can't be selected

Discussion in 'AutoCAD' started by rharris51, Jan 21, 2004.

  1. rharris51

    rharris51 Guest

    Under Acad2000i, an autolisp routine I use draws a section cut arrow and prompts for and draws the section number. Until recently it worked fine but for the last two days I have been unable to select the last two items it draws, an arrowhead (a pline) and the section number until I close and reopen the file. Auditing makes no difference...what could be the problem?

    The AutoLISP routine draws with the PLINE command and writes with the TEXT command.
     
    rharris51, Jan 21, 2004
    #1
  2. rharris51

    Matthew Guest

    I've had similar problems when doing this with attributes. In my case the
    textstyle or part of the attribute entmake function had an error. The sub
    routine never completed so the end block function never got called. I would
    be left with a circle & a line through it but no attributes. After I
    reopened the drawing I could select the circle & line as a block but no
    attributes.

    HTH
    Matthew
     
    Matthew, Jan 22, 2004
    #2
  3. rharris51

    Rudy Tovar Guest

    Example: But can't remember if it was for R14 VLA or 2000+. Just the same
    you may need to do an array.

    (defun c:db (/ bk attr fa sa p2 p3 ad)

    (setq *old-error* *error* *error* *db-error*)

    (if (not (tblsearch "block" "db"))(create-detail-bubble))

    (while (setq p1 (getpoint " Pick Insertion: "))

    (if p1
    (progn
    (setq ad(vla-get-modelspace(vla-get-ActiveDocument
    (vlax-get-Acad-Object))))

    (vla-insertblock ad p1 "db" (getvar"dimscale")(getvar "dimscale") "0")


    (setq bk (vlax-ename->vla-object (entlast))
    attr(vla-getattributes bk)
    fa (car attr)
    sa (car (reverse attr))
    p2 (polar p1 (dtr 90.00) (* 0.120 (GETVAR"DIMSCALE")))
    p3 (polar p1 (dtr -90.00) (* 0.120 (GETVAR"DIMSCALE")))
    )

    (vla-put-insertionPoint fa p2)
    (vla-put-insertionPoint sa p3)

    (vla-put-horizontalalignment fa 1)
    (vla-put-horizontalalignment sa 1)

    (vla-put-verticalalignment fa 2)
    (vla-put-verticalalignment sa 2)


    (vla-put-layer fa "0")
    (vla-put-layer sa "0")

    (vla-put-color fa acByLayer)
    (vla-put-color sa acByLayer)

    (vla-put-height fa (* 0.1042 (GETVAR"DIMSCALE")))
    (vla-put-height sa (* 0.1042 (GETVAR"DIMSCALE")))

    (vla-put-stylename fa "ROMANS")
    (vla-put-stylename sa "ROMANS")

    (vla-put-textalignmentpoint fa p2)

    (vla-put-textalignmentpoint sa p3)
    (db-create-flag)
    )))


    (setq *error* *old-error* p1 nil)
    (princ)
    )

    (defun db-create-flag (/ p2 p3 di an f1 f2 f3 f4)

    (while
    (setq p2 (getpoint p1 " Pick Point: "))
    (progn
    (if
    (not ss)
    (setq p1 (polar p1 (angle p1 p2) (* (getvar"dimscale")0.2188))
    )
    )

    (entmake (list (cons 0 "LINE")(cons 10 p1)(cons 11 p2)(cons 8
    (getvar"clayer"))(cons 62 256)))
    (if (not ss)(setq ss (ssadd)))
    (setq ss (ssadd (entlast)ss ))
    (setq b1 p1 p1 p2)
    )
    )
    (if ss
    (progn
    (setq p2 (getpoint p1 " Place Flag: "))
    (if p2
    (progn
    (setq di (distance p1 p2)
    an (angle b1 p1)
    f2 (polar p1 an di)
    f1 (polar p1 (+ an (dtr 90.00)) 0.75)
    f2 (polar f2 (+ an (dtr 90.00)) 0.75)
    f3 (polar f2 (+ an (dtr -90.00)) 1.5)
    f4 (polar f1 (+ an (dtr -90.00)) 1.5)
    )


    (entmake (list (cons 0 "LINE")(cons 10 f1)(cons 11 f2)(cons 8
    (getvar"clayer"))(cons 62 256)))
    (entmake (list (cons 0 "LINE")(cons 10 f3)(cons 11 f4)(cons 8
    (getvar"clayer"))(cons 62 256)))
    (entmake (list (cons 0 "LINE")(cons 10 f1)(cons 11 f4)(cons 8
    (getvar"clayer"))(cons 62 256)))
    )
    )
    )
    )
    (setq ss nil)

    (princ)
    )

    (defun *db-error* (msg)

    (command "erase" ss "")
    (setq *error* *old-error* ss nil)
    (princ)
    )

    (defun create-detail-bubble (/)

    (if (= (tblsearch "style" "romans") nil)(command "style" "romans"
    "romans.shx" "" ".85" "" "" "" ""))
    (entmake '((0 . "block")(2 . "db")(70 . 2)(10 0.0 0.0 0.0)(8 . "0")))

    (entmake '((0 . "ATTDEF")
    (10 -0.21503 0.0563637 0.0)
    (40 . 0.104167)
    (1 . "-")
    (50 . 0.0)
    (41 . 0.85)
    (51 . 0.0)
    (7 . "ROMANS")
    (71 . 0)
    (72 . 1)
    (11 0.0 0.108447 0.0)
    (210 0.0 0.0 1.0)
    (3 . "DETAIL NUMBER")
    (2 . "DETAIL")
    (73 . 0)
    (74 . 2)
    (70 . 0)
    (8 . "0")
    ))
    (entmake '((0 . "ATTDEF")
    (10 -0.206597 -0.162386 0.0)
    (40 . 0.104167)
    (1 . "-")
    (50 . 0.0)
    (41 . 0.85)
    (51 . 0.0)
    (7 . "ROMANS")
    (71 . 0)
    (72 . 4)
    (11 0.0 -0.110303 0.0)
    (210 0.0 0.0 1.0)
    (3 . "SHEET NUMBER")
    (2 . "SHEET")
    (73 . 0)
    (74 . 0)
    (70 . 0)
    (8 . "0"))
    )
    (entmake '((0 . "LINE") (10 0.21875 0.0 0.0) (11 -0.21875 0.0 0.0) (8 .
    "0")))
    (entmake '((0 . "CIRCLE") (10 0.0 0.0 0.0) (40 . 0.21875) (8 . "0")))
    (entmake '((0 . "ENDBLK")))

    (princ)
    )
    (defun dtr (a)
    (* pi (/ a 180.0))
    )
    (defun rtd (a)
    (/ (* a 180.0) pi)
    )
     
    Rudy Tovar, Jan 22, 2004
    #3
  4. rharris51

    rharris51 Guest

    Fixed the problem. Turned out it was related to a setting called plinetype. Somehow plinetype had become set to 0. After setting it to 2 - the recommended or default setting - the routine worked just as it always had. It's a bit of a mystery how plinetype got set to 0, but I have altered the problem routine to set plinetype to 2 before drawing the polyline.

    If you're curious what plinetype does, I suggest you look it up in your AutoCAD help where it is explained clearly in as few words as possible.

    I don't see why it would have affected the routine but it did. Seems like an AutoCAD bug to me (2000i).
     
    rharris51, Jan 26, 2004
    #4
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.