TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: chauhuh on October 29, 2015, 03:17:41 PM

Title: vla leaders
Post by: chauhuh on October 29, 2015, 03:17:41 PM
Hello and thank you for looking.

The goal is to copy the properties of an existing leader and then start the leader command again. I can't seem to convert the object to a vla object in order to get the arrowheadblock.

Thanks!

Code: [Select]
(vl-load-com)

(defun c:qww (/ s en e vla_s LeaderName)
  (if
    (and (setq s (entsel "\nSelect any object: "))
(wcmatch (setq en (cdr (assoc 0 (setq e (entget (car s))))))
  "LEADER"
)
    )
     (progn

       ;; This group of settings are common to all objects
       ;; layer
       (setvar 'CLAYER (cdr (assoc 8 e)))
       ;; linetype
       (if (cdr (assoc 6 e))
(setvar 'CELTYPE (cdr (assoc 6 e)))
(setvar 'CELTYPE "ByLayer")
       )
       ;; color
       (if (cdr (assoc 62 e))
(setvar 'CECOLOR (itoa (cdr (assoc 62 e))))
(setvar 'CECOLOR "ByLayer")
       )

       (if (wcmatch en "LEADER")
(progn
   ;;convert to vl object

   (setq vla_s (vlax-ename->vla-object (ssname s 0)))
   ;(setq vla_s (vlax-ename->vla-object s))
   (princ "\nfinally!")
   (setq LeaderName (vla-get-ArrowheadBlock vla_s))

   (setvar "DIMASZ" 0.125)

   (command ".QLEADER" pause pause pause)
   (command ".TEXT" pause)

   (vla-put-ArrowheadBlock (entlast) LeaderName)

)
       )

     )
     (prompt
       "\nObject is not a LEADER."
     )
  )
  (princ)
)
Title: Re: vla leaders
Post by: ribarm on October 29, 2015, 03:35:32 PM
Try to change :
Code: [Select]
(setq vla_s (vlax-ename->vla-object (ssname s 0)))
To this :
Code: [Select]
(setq vla_s (vlax-ename->vla-object (car s)))
Title: Re: vla leaders
Post by: chauhuh on October 29, 2015, 04:26:51 PM
Your a BOSS! Thank you for the prompt reply.