Author Topic: vla leaders  (Read 1497 times)

0 Members and 1 Guest are viewing this topic.

chauhuh

  • Guest
vla leaders
« 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)
)

ribarm

  • Gator
  • Posts: 3261
  • Marko Ribar, architect
Re: vla leaders
« Reply #1 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)))
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

chauhuh

  • Guest
Re: vla leaders
« Reply #2 on: October 29, 2015, 04:26:51 PM »
Your a BOSS! Thank you for the prompt reply.