Author Topic: MText and Leaders  (Read 1326 times)

0 Members and 1 Guest are viewing this topic.

jrr114

  • Newt
  • Posts: 21
MText and Leaders
« on: June 20, 2023, 03:01:53 PM »
Is there a lisp that disassociates MText from quick leaders?  I know that there is a command in express tools.  Having a lisp or button would be easier.

BIGAL

  • Swamp Rat
  • Posts: 1417
  • 40 + years of using Autocad
Re: MText and Leaders
« Reply #1 on: June 20, 2023, 07:41:06 PM »
Something like this

Code: [Select]
(setq txt (cdr (assoc 1 (entget (cdr (assoc 340 (entget (car (entsel "\nPick leader ")))))))))
A man who never made a mistake never made anything

jrr114

  • Newt
  • Posts: 21
Re: MText and Leaders
« Reply #2 on: June 22, 2023, 03:47:04 PM »
BigAl,
Please excuse my lack of knowledge.  What would the command be for this?

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2140
  • class keyThumper<T>:ILazy<T>
Re: MText and Leaders
« Reply #3 on: June 22, 2023, 04:55:51 PM »
BigAl,
Please excuse my lack of knowledge.  What would the command be for this?

you'd need to wrap that statement in a command.
Something like :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:DOIT ()
  2.   (setq txt
  3.          (cdr
  4.            (assoc
  5.              1
  6.              (entget
  7.                (cdr (assoc
  8.                       340
  9.                       (entget (car (entsel "\nPick leader ")))
  10.                     )
  11.                )
  12.              )
  13.            )
  14.          )
  15.   )
  16. )
  17.  
  18.  

Note: I assume the statement serves the purpose you require.

« Last Edit: June 22, 2023, 04:59:16 PM by kdub_nz »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

BIGAL

  • Swamp Rat
  • Posts: 1417
  • 40 + years of using Autocad
Re: MText and Leaders
« Reply #4 on: June 22, 2023, 07:37:24 PM »
Thanks Kdub_nz

Another must pick the text
Code: [Select]
(defun c:doit ( / )
(setq txt (cdr
  (assoc 1
    (entget
      (car (nentsel "\nPick the text ")
)))))
(princ)
)

Code: [Select]
(setq txt (vlax-get (vlax-ename->vla-object
  (car  (nentsel "Pick text ")
  ))
    'TEXTstring)
)
« Last Edit: June 22, 2023, 07:44:42 PM by BIGAL »
A man who never made a mistake never made anything

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: MText and Leaders
« Reply #5 on: June 23, 2023, 06:01:02 AM »
Give this a go and let me know.
Code - Auto/Visual Lisp: [Select]
  1. (defun c:Test (/ int ent sel dxf get )
  2.   ;;----------------------------------------------------;;
  3.   ;;    Author : Tharwat Al Choufi                      ;;
  4.   ;; website: https://autolispprograms.wordpress.com    ;;
  5.   ;;----------------------------------------------------;;
  6.   (and (princ "\nSelect Mtext to disassociate from its related leader : ")
  7.        (setq int -1 sel (ssget "_:L" '((0 . "MTEXT"))))
  8.        (while (setq int (1+ int) ent (ssname sel int))
  9.          (and (assoc 102 (setq get (entget ent)))
  10.               (or (setq dxf nil)
  11.                   (mapcar '(lambda (itm) (or (= (car itm) 102) (setq dxf (cons itm dxf)))) get)
  12.                   )
  13.               (entmake (reverse dxf))
  14.               (entdel ent)
  15.               )
  16.          )
  17.        )
  18.   (princ)
  19.   )

jrr114

  • Newt
  • Posts: 21
Re: MText and Leaders
« Reply #6 on: June 26, 2023, 01:35:22 PM »
I am able to get Tharwat's "test" LISP to work but not the other one.  I'm sure that it is user error on my part.  I appreciate all that you guys are doing to help me.
I'm guessing that I can changes the command name from test to LdrDis?

dwaschnia

  • Mosquito
  • Posts: 13
Re: MText and Leaders
« Reply #7 on: June 27, 2023, 03:15:10 AM »
What do you mean with "disassociate the mtext"?
Do you want only the mtext to remain from selected mleaders?
If so, try this:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo ( / le ss e ss2 )
  2.   (setq le (entlast))
  3.   (if (setq ss (ssget "_:L" '((0 . "MULTILEADER"))))
  4.     (progn
  5.       (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
  6.         (command "._explode" x)
  7.       )
  8.       (setq e (entnext le))
  9.       (setq ss2 (ssadd))
  10.       (while e
  11.         (setq ss2 (ssadd e ss2))
  12.         (setq e (entnext e))
  13.       )
  14.       (foreach x (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss2))))
  15.         (if (/= (vla-get-objectname x) "AcDbMText")
  16.           (vla-delete x)
  17.         )
  18.       )
  19.     )
  20.   )
  21. )
  22.  

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: MText and Leaders
« Reply #8 on: June 27, 2023, 07:10:51 AM »
What do you mean with "disassociate the mtext"?
Do you want only the mtext to remain from selected mleaders?
If so, try this:

The OP is referring to Qleader and NOT Multileader, and they want to delink the connection between Mtext and Leader objects so the text won't follow the leader if leader object moved / relocated after all and that what it's called disassociate.

dwaschnia

  • Mosquito
  • Posts: 13
Re: MText and Leaders
« Reply #9 on: June 27, 2023, 08:01:49 AM »
What do you mean with "disassociate the mtext"?
Do you want only the mtext to remain from selected mleaders?
If so, try this:

The OP is referring to Qleader and NOT Multileader, and they want to delink the connection between Mtext and Leader objects so the text won't follow the leader if leader object moved / relocated after all and that what it's called disassociate.


Oh, I see. Never heard of qleaders before. The disassociating part seems to happen automatically for me, when I make one (bricscad).