Select text, Place Multileaderstyle with attribute block from selected text.

Select text, Place Multileaderstyle with attribute block from selected text.

Anonymous
Not applicable
1,124 Views
6 Replies
Message 1 of 7

Select text, Place Multileaderstyle with attribute block from selected text.

Anonymous
Not applicable

Hello,

 

i've been working on a command where I:

  1. Select a text or mtext object ;Done
  2. Pick an arrow point and landing point for the MLeader ;Done
  3. use those attributes to put in a multileader style with the the current multileader style.
    It's the standard library "_tagslot" block with the "TAGNUMBER" attribute.

the code works great until the Edit Attributes window shows up and asks me to insert the value wich should be "txt" value from the code.

 

(defun c:2ml ( / txt arp lap)
	(vl-load-com)
	(setq txt (vla-get-TextString(vlax-ename->vla-object (car (entsel))))) ;;; select content from text object
  	
	(setq arp (getpoint "\nPick Arrow Location: "))
  	(setq lap (getpoint "\nPick Text Location: "))
  	(vl-cmdf "_mleader" arp lap txt "") ;;; This needs work
	
)

Thanks for checking it out.

0 Likes
1,125 Views
6 Replies
Replies (6)
Message 2 of 7

Moshe-A
Mentor
Mentor

@Anonymous  hi,

 

here is my fix

 

Moshe

 

 

(defun c:2ml ( / txt arp lap)
 (vl-load-com)
 (setq txt (vla-get-TextString(vlax-ename->vla-object (car (entsel))))) ;;; select content from text object
  	
 (setq arp (getpoint "\nPick Arrow Location: "))
 (setq lap (getpoint arp "\nPick Text Location: "))
 (vl-cmdf "_mleader" arp lap txt) ;;; This needs work
 (princ) 
)

 

0 Likes
Message 3 of 7

Anonymous
Not applicable

@Moshe-A Thanks for replying.

 

This still asks me this dialog.
I want lisp to fill-in this attribute under the hood automatically.

 

Edit attributes.jpg

0 Likes
Message 4 of 7

dlanorh
Advisor
Advisor

Post a sample drawing (AutoCAD 2010 or earlier format drawing) of a before and after of what you are trying to achieve, to include what you are selecting to get the text item. I think the solution is simple but from what I can piece together I think you are selecting a block attribute for the text, the trying to insert the block into the MLeader.

 

 

I am not one of the robots you're looking for

0 Likes
Message 5 of 7

Anonymous
Not applicable

What I'm trying to achieve is similar to the poplar MT2ML.lsp

 

But this MLstyle "blusapparaat" has a block "_Tagslot" with an attribute "TAGNUMBER".

it prompts me to edit the atribute,
so I want the value from "txt" to be put in "blusapparaat" without the prompt.

 

I thought what I wanted to achieve, was clear from my explanation...?

 

See dwg attached.

 

0 Likes
Message 6 of 7

Moshe-A
Mentor
Mentor

@Anonymous ,

 

got you now,  here is my second fix:

 

you should create an attribute block by the name _tagslot as you specified (if it's something else, change it in lisp)

you will need to control the block scale, plus remove the landing in the mleaderstyle.

in mleaderstyle there is an option to use a block but as far as i remember the attribute value there will be populate to all mleaders. that's why i used simple insert block.

 

enjoy

moshe

 

 

 

 

 

(defun c:2ml ( / txt arp lap savAttreq)
 (vl-load-com)
 (setq txt (vla-get-TextString(vlax-ename->vla-object (car (entsel))))) ;;; select content from text object
  	
 (setq arp (getpoint "\nPick Arrow Location: "))
 (setq lap (getpoint arp "\nPick Text Location: "))
 (vl-cmdf "_mleader" arp lap "") ;;; This needs work

 (setq savAttreq (getvar "attreq")) 
 (setvar "attreq" 0)
 (vl-cmdf "_insert" "_tagslot" lap 1 1 0 txt)
 (setvar "attreq" savAttreq)  
 (princ) 
)

 

 

 

0 Likes
Message 7 of 7

dlanorh
Advisor
Advisor

Posted solution at TheSwamp

I am not one of the robots you're looking for

0 Likes