Insert Block with Mleader containing attributes.

Insert Block with Mleader containing attributes.

C.Utzinger
Collaborator Collaborator
1,223 Views
4 Replies
Message 1 of 5

Insert Block with Mleader containing attributes.

C.Utzinger
Collaborator
Collaborator

HI

 

I'm trying to insert with this code a block with an mleader with attributes. But it doesn't work.

 

Why??????? See the attachments please.

 

With the block it works, with the mleaderblock it doesn´t.

 

 

(vl-load-com)
(defun c:<Test3 ( / *error* oATTREQ oATTDIA LM:vl-setattributevalue en-blk1 pos. 83cm)
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
      (princ (strcat "\nError: " errmsg)))
    (setvar 'ATTREQ oATTREQ)
    (setvar 'ATTDIA oATTDIA)
    (princ))
  (defun LM:vl-setattributevalue ( blk tag val )
    (setq tag (strcase tag))
    (vl-some '(lambda ( att )
                (if (= tag (strcase (vla-get-tagstring att)))
                  (progn (vla-put-textstring att val) val)))
             (vlax-invoke blk 'getattributes)))
  (setq oATTREQ (getvar 'ATTREQ)
        oATTDIA (getvar 'ATTDIA))
  (setvar 'ATTREQ 0)
  (setvar 'ATTDIA 0)
  (if (and (not (command "_.INSERT" "SPI-Comax_T83" "_s" 1 "_r" 0))							
           (not (command PAUSE))							
           (setq en-blk1 (entlast))
           (setq pos. (getstring T "\nPosition: "))
           (setq 83cm (getstring T "\nAnzahl 83cm: "))
           )
    (progn
      (LM:vl-setattributevalue (vlax-ename->vla-object en-blk1) "pos." pos.)
      (LM:vl-setattributevalue (vlax-ename->vla-object en-blk1) "83cm" 83cm)
      ))
  (setvar 'ATTREQ oATTREQ)
  (setvar 'ATTDIA oATTDIA)
  (prin1)
) ; end of defun

 

 

Please help...

0 Likes
1,224 Views
4 Replies
Replies (4)
Message 2 of 5

patrick_35
Collaborator
Collaborator

Hi

 

With your examples, it work for me.

 

@+

0 Likes
Message 3 of 5

C.Utzinger
Collaborator
Collaborator

With the Block "SPI-Comax_T83" it works perfect!

 

But with the Block "SPI-Comax_F-T83"  it doesn't!!!!

 

So the next Code doesn't work:

(vl-load-com)
(defun c:<Test3 ( / *error* oATTREQ oATTDIA LM:vl-setattributevalue en-blk1 pos. 83cm)
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
      (princ (strcat "\nError: " errmsg)))
    (setvar 'ATTREQ oATTREQ)
    (setvar 'ATTDIA oATTDIA)
    (princ))
  (defun LM:vl-setattributevalue ( blk tag val )
    (setq tag (strcase tag))
    (vl-some '(lambda ( att )
                (if (= tag (strcase (vla-get-tagstring att)))
                  (progn (vla-put-textstring att val) val)))
             (vlax-invoke blk 'getattributes)))
  (setq oATTREQ (getvar 'ATTREQ)
        oATTDIA (getvar 'ATTDIA))
  (setvar 'ATTREQ 0)
  (setvar 'ATTDIA 0)
  (if (and (not (command "_.INSERT" "*SPI-Comax_F-T83" "_s" 1 "_r" 0)	
           (not (command PAUSE))							
           (setq en-blk1 (entlast))
           (setq pos. (getstring T "\nPosition: "))
           (setq 83cm (getstring T "\nAnzahl 83cm: "))
           )
    (progn
      (LM:vl-setattributevalue (vlax-ename->vla-object en-blk1) "pos." pos.)
      (LM:vl-setattributevalue (vlax-ename->vla-object en-blk1) "83cm" 83cm)
      ))
  (setvar 'ATTREQ oATTREQ)
  (setvar 'ATTDIA oATTDIA)
  (prin1)
) ; end of defun
0 Likes
Message 4 of 5

Anonymous
Not applicable

Because there is not a block with the name of "*SPI-Comax_F-T83" in the "SPI-Comax_F-T83.dwg"

 

Multileaders can not place with insert command.  Lisp routine might be like that:

 

1- Make a multileader with entmake function or Command: Multileader -> options -> Content type -> Block

2- Then connect with the block named "SPI-Comax_T83"

3- Access block that connected the multileader. And change attributes.

 

0 Likes
Message 5 of 5

patrick_35
Collaborator
Collaborator

yes, because you have a block in a block.

 

@+

0 Likes