Jump to content

Changing leaders throughout drawing with LISP


K Baden

Recommended Posts

Good afternoon all!

 

I am looking for a code that will replace leaders of one style with a leader of a different style. See attached test drawing for clarity.

 

As you can see the top leader is a 2 point leader, but with a set leg. This is how i want all my leaders to be.

 

Just below that is a leader with 3 points, I DO NOT want this on my drawings anymore. moving text around with this type of leader drags the leg with the text, but has anotherpoint that stays. This is endlessly infuriating. I've done a bunch of searches but have had no luck. can anyone help me out?

 

leaderTESTdrawing.dwg

Link to comment
Share on other sites

This seems to fix the 3 point leader .. limited testing.

(defun c:foo (/ ss)
 (if (setq ss (ssget ":L" '((0 . "leader"))))
   (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
     (entmod (mapcar '(lambda (x)
		 (cond ((= 75 (car x)) '(75 . 1))
		       ((= 40 (car x)) '(40 . 0.0))
		       ((= 41 (car x)) '(41 . 0.0))
		       (x)
		 )
	       )
	      (entget x)
      )
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

This is AWESOME!

Is there any way i can get it to select all the leaders automatically?

 

Change:

(setq ss (ssget ":L" '((0 . "leader"))))

to

(setq ss (ssget [b][color="red"]"_X"[/color] [/b]'((0 . "leader"))))

Link to comment
Share on other sites

the only problem im encountering with this is that certain leaders go to 2 point leaders without the little leg out. Any idea how to mend that? I hate that all leaders in autocad are described as "Leader" regardless of these things. Not sure how to even pinpoint. basically, this works great on 3 vertex leaders that maintain the leg when you move it. This does not work on 3 point leaders that the leg is dependent on the position of the second and third point, and if one moves, the leg does not automatically generate. Not sure if im being clear. Hopefully I am. I can probably post another test drawing if you need it with the leaders im talking about

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...