• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Visual LISP, AutoLISP and General Customization

    Reply
    Valued Contributor
    aabfm
    Posts: 74
    Registered: ‎01-05-2012

    Problem inserting blocks with attributes

    86 Views, 0 Replies
    01-05-2012 01:49 AM

    Hi,

    I've been trying hundreds of different solutions to solve this problem: insert a block that has an attribute which happens  to be the last object id.

    This is the best code I tried so far but without any succss.

     

    (defun c:q1()
      (command "_.PLINE")
      (while (= (getvar "CMDNAMES") "PLINE")
        (command pause)
      )

      (setq objname (entlast))

      (setq oad (getvar "attdia"))
      (setq orq (getvar "attreq"))
      (setq oec (getvar "cmdecho"))
      (setvar "attdia" 1)
      (setvar "attreq" 0)
      (setvar "CMDECHO" 0)

      (setq xScale 1)
      (setq yScale 1)
      (setq rot 0)
      (setq at1 "abc")
      (setq pt (getpoint "\nSpecify Insertion Point: "))
      (command "_.insert" "TROC_PRP" pt xScale yScale rot objname)

      (setvar "attdia" oad)
      (setvar "attreq" orq)
      (setvar "cmdecho" 1)
    )

     

    Can you help me?

    Kind regards.

    Please use plain text.