Author Topic: Flagging Leaders with more than 2 vertices  (Read 5554 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
Flagging Leaders with more than 2 vertices
« on: April 07, 2008, 12:44:20 PM »
Hey guys,

It's been brought to my attention that some leaders in our drawings have the tail manually drawn creating an extra vertice. What I am looking for is a a routine that would flag the ones that contain the extra vertice. It would be nice to be able to remove the middle vertice as well. Has anyone ever done something like this? See the attached drawing.

Guest

  • Guest
Re: Flagging Leaders with more than 2 vertices
« Reply #1 on: April 07, 2008, 01:07:49 PM »
Have a look at this.

Code: [Select]
(defun get_Leaderpts (elst / np ptlst)
   (while (setq np (assoc 10 elst))
      (setq elst  (cdr (member np elst))
            ptlst (cons (cdr np) ptlst)
      )
   )
   ptlst
   (length ptlst)
)

ELOQUINTET

  • Guest
Re: Flagging Leaders with more than 2 vertices
« Reply #2 on: April 07, 2008, 01:43:17 PM »
matt i'm lookin and i have a vague understanding but not sure how to build upon this?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Flagging Leaders with more than 2 vertices
« Reply #3 on: April 07, 2008, 05:41:54 PM »
Dan,
Both leaders have 3 points, the top one is NOT associated with the text.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

FengK

  • Guest
Re: Flagging Leaders with more than 2 vertices
« Reply #4 on: April 08, 2008, 04:10:27 AM »
Dan, based on the dxf reference:
75 Hookline flag: 0 = No hookline; 1 = Has a hookline

(setq ss (ssget "X" (list (cons 0 "LEADER") (cons 75 0))))
(sssetfirst nil ss)

The code above should highlight those leaders with the extra vertex that was manually added.
 
 

ELOQUINTET

  • Guest
Re: Flagging Leaders with more than 2 vertices
« Reply #5 on: April 08, 2008, 02:07:48 PM »
cab i'm not sure what you mean. when i select the top one it has 3 grips whereas when i select the bottom one it has 2 grips? when i select them both it says they are not associative so i don't get what you are saying. Kelie When I input this onto the command line it does highlight the leader in question. I think this would work for what I want to do. I would basically like to be able to run it on a directory of drawings and have it flag them so I can easily see the incorrect ones. I need it to work across layout tabs because we notate in paper space. It would be a bonus to have it report which drawings contain incorrect leaders so I don't have to open each and check each layout.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Flagging Leaders with more than 2 vertices
« Reply #6 on: April 08, 2008, 03:39:33 PM »
Dan,
The bottom leader is associative in that it points to the Mtext & the Mtext points to the leader and the reactor is set up in both.
When you move the text does the leader not react to the move?

In the entity list of the Leaders, both leaders have 3 points. In the bottom leader the HookLine is set to 1 as Kelie said.
With that option the middle leader point is not shown as it is not modifiable by the user.
It appears to me that to turn that option on the leader must be made associative. Or this may be a bug in ACAD2000.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Re: Flagging Leaders with more than 2 vertices
« Reply #7 on: April 08, 2008, 04:05:10 PM »
Well I put together a macro which seems to do what I want but the problem is I need to run it on multiple layouts and drawings like I said. I'm giving this macro to our VBA guy who said he can write a routine to run a macro across multiple layouts and drawings. This is where I stand with this for now.

^C^C(setq var (getvar "clayer"));-layer;m;"Bad Leader";c;White;(setq ss (ssget "X" (list (cons 0 "LEADER") (cons 75 0))))^M;(sssetfirst nil ss)^M;;change;p;;p;layer;"Bad Leader";;(setvar 'clayer var);

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Flagging Leaders with more than 2 vertices
« Reply #8 on: April 08, 2008, 05:09:11 PM »
Dan,

(ssget "x" does get all objects regardless of space.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Flagging Leaders with more than 2 vertices
« Reply #9 on: April 08, 2008, 05:22:52 PM »
But Dan is using the COMMAND's to make changes. I don't think that will work with objects that are in another space. I could be wrong though.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Flagging Leaders with more than 2 vertices
« Reply #10 on: April 08, 2008, 05:33:39 PM »
It won't change them when using command...just tested it out.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Flagging Leaders with more than 2 vertices
« Reply #11 on: April 08, 2008, 05:43:50 PM »
Here's a quickie:

Code: [Select]
(defun c:badleader (/ ss l)
  (if (setq ss (ssget "X" '((0 . "LEADER") (75 . 0))))
    (foreach l (mapcar 'cadr (ssnamex ss))
      (entmod (subst (cons 8 "badleader")
     (assoc 8 (entget l))
     (entget l)
      )
      )
    )
  )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ELOQUINTET

  • Guest
Re: Flagging Leaders with more than 2 vertices
« Reply #12 on: April 09, 2008, 10:59:59 AM »
I just tested that Ron and it only selects bad leaders on one layout tab, is that what you meant? What I'm looking for is a way of reporting which drawings have the problem so I don't have to open them all and look at each layout. I'm getting ahead of myself I know we need to get it working internally first.  :laugh:

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Flagging Leaders with more than 2 vertices
« Reply #13 on: April 09, 2008, 11:08:13 AM »
Dan,

It should select all "bad" leaders in the drawing. If the layer is locked that the leader resides on, then it will not change the layer of the leader.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Flagging Leaders with more than 2 vertices
« Reply #14 on: April 09, 2008, 11:40:06 AM »
Iit occurred to me that you could try to reattach the mtext by using the leader tail for direction
and ssget to see if there is any Mtext there. The text must be visible of course and the leader
attachment point may also be a problem. I guess you could move the Mtext. It may be a bit
complicated.
Just my thoughts. I don't have time to tackle it though.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.