Author Topic: Multileader Move Insertions  (Read 5039 times)

0 Members and 1 Guest are viewing this topic.

DanB

  • Bull Frog
  • Posts: 367
Multileader Move Insertions
« on: November 19, 2007, 09:34:44 AM »
A co-worker is in need of some assistance (of course he needs it yesterday). He currently has individual drawings each containing 500-1000 multileaders used for callouts. The mleader consists of a block attached to an extended leader. The block contains one attribute. The wish item is to "move" or modify all of the mleaders so that the block insertion is moved to the corresponding leader insertion. I think I was able to extract the insertion points through dxf codes, however I do not know how to modify the entities or cycle through a large set like this. Below are the dxf codes I think need to be evaluated.

This should be the block insertion point>>

Quote
;   (300 . "CONTEXT_DATA{")
;   (40 . 1.0)
;   (10 8.0 6.0 0.0)

This should be the leader insertion point>>

Quote
;   (304 . "LEADER_LINE{")
;   (10 4.0 3.0 0.0)

Ideally the block (8,6,0) would be moved to (4,3,0). We do not care what happens to the leader extension in any way only that the block information is moved to the desired location. Any thoughts or ideas would be appreciated.

Thanks,
Dan

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Multileader Move Insertions
« Reply #1 on: November 19, 2007, 09:40:13 AM »
Can you post a sample drawing?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

DanB

  • Bull Frog
  • Posts: 367
Re: Multileader Move Insertions
« Reply #2 on: November 19, 2007, 10:28:58 AM »
I have a sample drawing although I can't seem to log in to the lily pond? Is there another way I can attach to this post?

edit:
Does this work?

http://www.theswamp.org/screens/index.php?dir=&file=mleaders.dwg
« Last Edit: November 19, 2007, 10:32:31 AM by DanB »

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Multileader Move Insertions
« Reply #3 on: November 19, 2007, 11:27:11 AM »
I don't know enough about multileaders to continue....maybe someone can pick it up from here. This appears to create the entmod list but nothing happens:

Code: [Select]
(defun c:test (/ ent ed lst)
  (setq ent (car (entsel))
ed  (entget ent)
  )
  (mapcar
    '(lambda (x)
       (if (member (car x) '(10))
(setq lst (cons x lst))
       )
     )
    ed
  )
  (setq lst (reverse lst)
ed  (mapcar
      '(lambda (x)
(if
   (equal x (nth 2 lst) 0.0001)
    (nth 0 lst)
    x
)
       )
      ed
    )
  )
  (entmod ed)
  ;;nothing happens
)

Ron
« Last Edit: November 19, 2007, 11:31:40 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

DanB

  • Bull Frog
  • Posts: 367
Re: Multileader Move Insertions
« Reply #4 on: November 19, 2007, 11:39:53 AM »
Thanks for taking the time to get something started. On a small (very small?) scale I think I understand what you are doing with the lists. Is it possible, if not as pretty, to pass the x,y,z value to a move command for each entity (mleader) from the block insertion value to the leader insertion.

In hopes not to derail my own topic>  I had messed around with updating annotative text with a different lisp and entmod did not respond well to the new text styles. I'm falling farther behind on understanding how to manipulate these new "features."

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Multileader Move Insertions
« Reply #5 on: November 19, 2007, 11:51:57 AM »
I think I see the light now....give me a few minutes.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

DanB

  • Bull Frog
  • Posts: 367
Re: Multileader Move Insertions
« Reply #6 on: November 19, 2007, 11:54:54 AM »
If you select all of the mleaders in the sample drawing and turn off the annotative setting in Properties, run the code you (ronjonp)posted, the leader end moves to the block insertion location. This is at least something, although backwards from the desired response. I checked the output dxf list and the x,y,z appears to be "correct" which is rather confusing.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Multileader Move Insertions
« Reply #7 on: November 19, 2007, 12:06:33 PM »
OK...so it must be Monday morning...I'm having trouble visualizing what you want.  Are the leaders pointing to the correct item...or do they need to be moved?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

DanB

  • Bull Frog
  • Posts: 367
Re: Multileader Move Insertions
« Reply #8 on: November 19, 2007, 12:11:42 PM »
The leader points to the desired x,y,z. Now imagine simply placing the text (i.e. "7.3") from middle left justification at that point.

edit: will be out of the office for a bit, will check back shortly...
« Last Edit: November 19, 2007, 12:13:48 PM by DanB »

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Multileader Move Insertions
« Reply #9 on: November 19, 2007, 12:16:26 PM »
So in the end product, there will be no leader?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Multileader Move Insertions
« Reply #10 on: November 19, 2007, 12:22:37 PM »
Maybe:  :?

Code: [Select]
(defun c:test (/ ent ed obj lst lst2)
  (setq ent (car (entsel))
ed  (entget ent)
obj (vlax-ename->vla-object ent)
  )
  (mapcar
    '(lambda (x)
       (if (member (car x) '(10))
(setq lst  (cons (list (cadr x) (caddr x) (cadddr x)) lst)
       lst2 (cons x lst2)
)
       )
     )
    ed
  )
  (setq lst  (reverse lst)
lst2 (reverse lst2)
  )
  (setq ed (mapcar
     '(lambda (x)
(if
  (equal x (nth 2 lst2) 0.0001)
   (nth 0 lst2)
   x
)
      )
     ed
   )
  )
  (entmod ed)
  (vla-move obj
    (vlax-3d-point (nth 0 lst))
    (vlax-3d-point (nth 2 lst))
  )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

DanB

  • Bull Frog
  • Posts: 367
Re: Multileader Move Insertions
« Reply #11 on: November 19, 2007, 01:52:55 PM »
I think this is just what we needed.

Thank You.

Would it be too much trouble adding in a selection set prompt rather than an individual selection? The drawing sample was just a small portion of the area he needs to revise. I think this involves:   (setq ss (ssget))  (setq len (sslength ss)) (repeat len...) or some such but I do not know how to pass your function to each entity in the selection??

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Multileader Move Insertions
« Reply #12 on: November 19, 2007, 02:09:51 PM »
Dan,

Give this a try:

Code: [Select]
(defun c:test (/ SS ED ENT LST LST2 OBJ X)
  (setq ss (ssget '((0 . "MULTILEADER"))))
  (if ss
    (progn
      (setq ss (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
      (mapcar '(lambda (ent)
(setq ed  (entget ent)
       obj (vlax-ename->vla-object ent)
)
(mapcar
   '(lambda (x)
      (if (member (car x) '(10))
(setq lst  (cons (list (cadr x) (caddr x) (cadddr x)) lst)
      lst2 (cons x lst2)
)
      )
    )
   ed
)
(setq lst  (reverse lst)
       lst2 (reverse lst2)
)
(setq ed (mapcar
    '(lambda (x)
       (if
(equal x (nth 2 lst2) 0.0001)
  (nth 0 lst2)
  x
       )
     )
    ed
  )
)
(entmod ed)
(vla-move obj
   (vlax-3d-point (nth 0 lst))
   (vlax-3d-point (nth 2 lst))
)
(setq lst  nil
       lst2 nil
)
       )
      ss
      )
    )
  )
  (princ)
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

DanB

  • Bull Frog
  • Posts: 367
Re: Multileader Move Insertions
« Reply #13 on: November 19, 2007, 02:14:39 PM »
Think we (err..you) got it, again, thank you for your time.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Multileader Move Insertions
« Reply #14 on: November 19, 2007, 02:19:21 PM »
Not a problem. Glad it worked :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC