leaders slightly intelligently

leaders slightly intelligently

neam
Collaborator Collaborator
765 Views
1 Reply
Message 1 of 2

leaders slightly intelligently

neam
Collaborator
Collaborator

Hi everyone:

Is it possible to direction and alignment of leaders slightly intelligently?

0 Likes
Accepted solutions (1)
766 Views
1 Reply
Reply (1)
Message 2 of 2

Kent1Cooper
Consultant
Consultant
Accepted solution

Partway there, though all on the same side of the Polyline:  replace this line:

 

(command "leader" (car ptlist) (polar (car ptlist) (dtor 135) dis) "" "" "" mt "")

 

with this:

 

(command "leader"
  (car ptlist)
  (polar (car ptlist)
    (+
      (angle
        '(0 0)
        (vlax-curve-getFirstDeriv pl
          (vlax-curve-getParamAtPoint pl (car ptlist))
        ); ...Deriv
      ); angle
      (/ pi 2)
    ); +
    dis
  ); polar
  "" "" "" mt ""
); command

 

Which produced this in your sample drawing:

Kent1Cooper_0-1719229785445.png

But to get it to go toward the outside of the local bending or curving direction at each location would be a challenge.  It's a question of determining whether the + at line 4 should be - instead, based on the way the direction changes at the vertex.  It would likely mean a different way of stepping through the 'ptlist' variable, to retain access to the previous vertex for an angle comparison, but maybe there's a way around that.  And when the change in direction crosses the 0° direction, which happens several times in the example, things need to be calculated differently.

Kent Cooper, AIA