Author Topic: LEADER PROBLEM  (Read 11737 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
LEADER PROBLEM
« on: October 21, 2003, 10:30:48 AM »
Hey all i have a question concerning leaders. i like to create my leaders as 2 point so when i move the text anywhere the leader follows. my problem is i am working with another persons drawing. he creates his leaders with 3 points so if i move the text like i want to be able to the tail just gets longer. is there an easy way to convert all leaders in a drawing to 2 point? does this question make sense? thanks

dan

daron

  • Guest
LEADER PROBLEM
« Reply #1 on: October 21, 2003, 10:43:51 AM »
The only way I can think to do that is to copyclip the text and re-create the leader and text yourself, programmatically or manually.

hendie

  • Guest
LEADER PROBLEM
« Reply #2 on: October 21, 2003, 10:56:25 AM »
can you programatically delete a vertice from a leader ? I mean without deleting the entity and rewriting it ?
I have an old lisp which repositions one of the vertices on a selected set of leaders. so if it's possible to delete a vertice then it could be easily modified

daron

  • Guest
LEADER PROBLEM
« Reply #3 on: October 21, 2003, 11:30:29 AM »
Well here's the goods on it. First, activeX dump:
Quote
Command: dumpit

Select object:
; IAcadLeader: AutoCAD Leader Interface
; Property values:
;   Annotation = #<VLA-OBJECT IAcadMText 02ef0934>
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00a88728>
;   ArrowheadBlock = "ldrblk"
;   ArrowheadSize = 0.0625
;   ArrowheadType = 20
;   Color = 256
;   Coordinate = ...Indexed contents not shown...
;   Coordinates = (1402.72 238.071 0.0 1450.57 285.921 0.0 ... )
;   DimensionLineColor = 256
;   DimensionLineWeight = -2
;   Document (RO) = #<VLA-OBJECT IAcadDocument 0108e50c>
;   Handle (RO) = "12D6"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 02ef0814>
;   Layer = "0"
;   Linetype = "BYLAYER"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Normal (RO) = (0.0 0.0 1.0)
;   ObjectID (RO) = 1077959792
;   ObjectName (RO) = "AcDbLeader"
;   OwnerID (RO) = 1074641936
;   PlotStyleName = "Normal"
;   ScaleFactor = 48.0
;   StyleName = "arch"
;   TextGap = 0.03125
;   Type = 2
;   VerticalTextPosition = 1
;   Visible = -1
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   Delete ()
;   Evaluate ()
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()

Command:

Next, dxf dump:
Quote

Command: ent


Select Object:
Data for selected entity:

(-1 . <Entity name: 40405c70>)
(0 . "LEADER")
(330 . <Entity name: 400dbc10>)
(5 . "12D6")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(380 . 2)
(100 . "AcDbLeader")
(3 . "arch")
(71 . 1)
(72 . 0)
(73 . 0)
(74 . 0)
(75 . 1)
(40 . 3.0)
(41 . 3.88929)
(76 . 5)
(10 1402.72 238.071 0.0)
(10 1450.57 285.921 0.0)
(10 1505.14 300.542 0.0)
(10 1541.61 261.068 0.0)
(10 1544.61 261.068 0.0)
(340 . <Entity name: 40405c78>)
(211 1.0 0.0 0.0)
(210 0.0 0.0 1.0)
(212 0.0 0.0 0.0)
(213 0.0 0.0 0.0)

Command:

Finally, can you pedit the leader?:
Quote

Command: pedit Select polyline or [Multiple]:
Object selected is not a polyline
Select polyline or [Multiple]:  Select polyline or [Multiple]: *Cancel*

Apparently not. So, can you get rid of any Coordinates or (10 . ####)? Not easily, if at all.

Moving the vertice, I feel would only move the vertice, not make it update with the vertice it is under, but who knows, I haven't tried it. Have fun.

hendie

  • Guest
LEADER PROBLEM
« Reply #4 on: October 21, 2003, 11:37:33 AM »
well... it appears to work

this was actually done to move a point on the leader to a selected point on a line.
I haven't got time to adapt it as I'm about to shoot off home. can someone adapt it ? or if I get time tomorrow I'll try to get around to it
Code: [Select]

(Defun C:MoveLeaders (/ INDEX LNEW LOLD LSET N NEWPOINT OLDPOINTS PTLINE PTLIST)
     (setq Ptline   (entsel "\n Please pick START point of line: ")
      Ptlist   (entget (car Ptline))
      Newpoint (assoc 10 Ptlist)
     ) ;_ end of setq
     (prompt "\n Now please pick Leaders")
     (setq Lset    (ssget '((0 . "leader")))
      n    (sslength Lset)
      index 0
     ) ;_ end of setq
     (repeat n
     (setq   Lold     (entget (ssname Lset index))
      Oldpoints (nth 19 Lold)
      Lnew     (subst Newpoint Oldpoints Lold)
     ) ;_ end of setq
     (entmod Lnew)
     (setq index (1+ index))
     ) ;_ end of repeat
     (setq Lset NIL)
) ;_ end of Defun


but what damage it deos underneath... well...

hendie

  • Guest
LEADER PROBLEM
« Reply #5 on: October 21, 2003, 11:47:42 AM »
oh bugger.... here it is..

this one will move the middle vertex to the startpoint of the leader. You can select all the leaders at once which makes it a bit easier

and it "appears" to delete the vertice !?!?!?

Code: [Select]
(Defun C:MoveLeaders (/ INDEX LNEW LOLD LSET N OLDPOINTS START )
  (prompt "\nPlease pick Leaders")
  (setq Lset  (ssget '((0 . "leader")))
n     (sslength Lset)
index 0
  ) ;_ end of setq
  (repeat n

    (setq Lold    (entget (ssname Lset index))
 Start    (nth 18 lold)
 Oldpoints (nth 19 Lold)
 Lnew    (subst Start Oldpoints Lold)
    ) ;_ end of setq
    (entmod Lnew)
    (setq index (1+ index))
  ) ;_ end of repeat
  (setq Lset NIL)
  (princ)
) ;_ end of Defun


ELOQUINTET

  • Guest
LEADER PROBLEM
« Reply #6 on: October 21, 2003, 11:59:09 AM »
thank you so much guys i haven't tried it out yet, as i've run into another problem (see other post). ah how i loathe working with someone elses drawing. anyway i'll give it a shot and give feedback. thanks

dan

daron

  • Guest
LEADER PROBLEM
« Reply #7 on: October 21, 2003, 12:07:34 PM »
Now there's something I never knew about leaders. Using Hendie's routine and beginning with a leader with 8 vertices:
Quote
(10 37.5977 23.9946 0.0)
(10 28.8449 32.7474 0.0)
(10 11.8635 32.215 0.0)
(10 3.46232 39.8166 0.0)
(10 -8.47622 33.9828 0.0)
(10 -14.496 44.4093 0.0)
(10 -15.3751 42.1696 0.0)
(10 -18.3751 42.1696 0.0)

After using the routine multiple times:
Quote

(10 37.5977 23.9946 0.0)
(10 -15.3751 42.1696 0.0)
(10 -18.3751 42.1696 0.0)

The routine moved the vertices, but the leader's reactors removed them. I then tested it on a polyline with six vertices and got it down to two, but a dxf dump revealed 6 vertices. Leaders/reactors are pretty interesting.

ELOQUINTET

  • Guest
LEADER PROBLEM
« Reply #8 on: October 21, 2003, 12:07:57 PM »
:D  :D  :D YEEEEEESSSSS

that's exactly what i want you guys are the greatest thank you thank you thank you.

dan

daron

  • Guest
LEADER PROBLEM
« Reply #9 on: October 21, 2003, 12:21:08 PM »
All the thanks go to Hendie. He did the work, I just poked and prodded and tested. Good work Hendie. The only issue I have with it is getting the 18 and 19 nth value. What if, for some reason the first 10 isn't the 18 nth value? It won't work right. Kenny has a great tutorial on how to access the points here

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
LEADER PROBLEM
« Reply #10 on: October 21, 2003, 08:08:20 PM »
Here is a late offering.

Code: [Select]
;;this one will delete all but the first & last vertex
;;
;;   USE AT YOUR OWN RISK
;;   One Line Leader.

(Defun C:OLL (/ INDEX LNEW LOLD LSET N OLDPOINTS START)
  (prompt "\nPlease pick Leaders")
  (setq Lset  (ssget '((0 . "leader")))
n     (sslength Lset)
index 0
  ) ;_ end of setq
  (repeat n ; step through the selection set
    (setq Lold (entget (ssname Lset index))
 Lnew (append nil (list (car Lold)))
 Lold (cdr Lold)
 NoVert (cdr (assoc 76 Lold)) ; Number of Vertex
 add  0
    )
    (foreach pr Lold  ; step through the entity

      (cond
((and (= (car pr) 10) (= add 0))
(setq Lnew (append Lnew (list pr)) ; save first vertex
      add  1
)
)

((and (= (car pr) 10) (= add 1))
(setq prHold pr ; save this vertex in case it is the last vertex
)
)
((= add 1) ; first pair after 10
(setq Lnew (append Lnew (list prHold pr)) ; save the last vertex
      add  0
)
)

(T
(setq Lnew (append Lnew (list pr)))
)
      )
    ) ; end for
    (setq target (cons 76 NoVert)
 Lnew (subst (cons 76 2) target Lnew)
    )
    (setq NewL (entmod Lnew))
    (setq index (1+ index))
  ) ;_ end of repeat
  (setq Lset NIL)
  (command "regen")
  (princ)
) ;_ end of Defun
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.

hendie

  • Guest
LEADER PROBLEM
« Reply #11 on: October 22, 2003, 04:02:45 AM »
Quote from: Daron
The only issue I have with it is getting the 18 and 19 nth value. What if, for some reason the first 10 isn't the 18 nth value?


I agree totally.
As I mentioned, it was an old Lisp, created way back when I knew what I was doing even less than I do now.
I dug it out, did a quick test and it appeared to work for what was required... plus I was just about to finish for the day and I wanted to get home.  :P

thanks for the thanks  :oops: