Identify Leader Direction?

Discussion in 'AutoCAD' started by pkirill, Feb 28, 2005.

  1. pkirill

    pkirill Guest

    I'm trying to create a routine that will draw a leader and insert a block tag at the end. I've pretty much got it working (thanks to several other threads in this NG!) except when a user draws the leader to the left. Can someone show me a clean way to identify which direction a leader is drawn so I can insert a block with a right or left insertion point?
     
    pkirill, Feb 28, 2005
    #1
  2. Compare the X coord of the first point with the X coord of the last point?
    Less than, the leader points to the right, greater than, the leader points to the left.
    Of course all that depends upon how many segments there are. If there are multiple segments
    compare the last to the second to last maybe.
    I'm trying to create a routine that will draw a leader and insert a block tag at the end. I've pretty much got it working (thanks to several other threads in this NG!) except when a user draws the leader to the left. Can someone show me a clean way to identify which direction a leader is drawn so I can insert a block with a right or left insertion point?
     
    Allen Johnson, Mar 1, 2005
    #2
  3. pkirill

    pkirill Guest

    That's pretty much what i was thinking. I was hoping someone could show me that in an example. Points are arrays and array are a mental block for me. I have some kind of brain damage that makes arrays something I can't seem to keep my head around...
    Compare the X coord of the first point with the X coord of the last point?
    Less than, the leader points to the right, greater than, the leader points to the left.
    Of course all that depends upon how many segments there are. If there are multiple segments
    compare the last to the second to last maybe.
    I'm trying to create a routine that will draw a leader and insert a block tag at the end. I've pretty much got it working (thanks to several other threads in this NG!) except when a user draws the leader to the left. Can someone show me a clean way to identify which direction a leader is drawn so I can insert a block with a right or left insertion point?
     
    pkirill, Mar 1, 2005
    #3
  4. Point lists in VBA are one dimensional arrays whose array size is 3 times the number of points.
    (You'd think they'd come up with a more sophisticated method! Someone posted a point class here once, you might do a search for that.)

    So if you have a 3 point list p0, p1, p2 stored in the array p()

    the first point (p0) coordinates are (x,y,z) = p(0),p(1),p(2)
    the second (p1) is p(3),p(4),p(5)
    and the third (p2) is p(6),p(7),p(8)

    so the number of point sets in the array can be found by

    np = (ubound(p)+1)/3-1
    'yields 2 for the example above (assuming you number them 0,1,2)

    the x,y,z coordinate of each point (p0, p1, p2) is
    for i = 0 to np
    x = p(i*3)
    y = p(i*3+1)
    z = p(i*3+2)
    next

    So to compare the first and last x coordinates

    if p(0)<p(np*3) then .....




    That's pretty much what i was thinking. I was hoping someone could show me that in an example. Points are arrays and array are a mental block for me. I have some kind of brain damage that makes arrays something I can't seem to keep my head around...
     
    Allen Johnson, Mar 1, 2005
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.