double arrow leader

Discussion in 'AutoCAD' started by molokaiboy, Jul 2, 2004.

  1. Or, do you always WANT it to snap to nearest and perpendicular, to put this
    kind of thing perpendicularly from one line/pline over to another parallel
    one, or something? If so, and you're doing it by having Nea & Per set as
    running Osnap modes, I think Nea is always going to win out over Per (the
    Nearest point on the line/pline will always be closer to the pick location
    than the point that's Perpendicular from the previous point, unless they
    happen to be the same).

    [The one exception would be if you're picking a little beyond the end of the
    line/pline but its endpoint is still within the Osnap target -- then Per
    COULD win out over Nea, but only if the resulting perpendicular location
    falls beyond that endpoint. (And not TOO far beyond that endpoint, or the
    endpoint itself will be Nearer.) That's one of the VERY few situations in
    which Nea wouldn't win out over virtually any other Osnap option, so I don't
    know that it's ever much good to set Nearest as a running Osnap mode, unless
    it's the only one you have running. (There ARE very few such situations,
    but not none. If you had Nea and Ins running, and picked around a piece of
    text, Nea would lose, because there's no such thing as the Nearest point on
    a piece of text. And Nea could lose out to Cen on a circle or arc if the
    Osnap target was big enough in relation to the radius that the target could
    pick up the curve with the pick location actually closer to the center.)]

    If that's what you want, you could do the following, with running Osnap
    disabled one way or another:

    (setq arrowhead1 (getpoint "Pick one Endpoint: ") "nea")
    (setq arrowhead2 (getpoint "Pick other Endpoint: ") "per")
    (command "LEADER" arrowhead1 arrowhead2 "" "" "N")
    (command "LEADER" arrowhead2 arrowhead1 "" "" "N")

    The last line should also be replaceable by

    (command "LEADER" "@" arrowhead1 "" "" "N")

    Or without disabling Osnap, maybe:

    (setq arrowhead1 (getpoint "Pick one Endpoint: "))
    (setq arrowhead2 (getpoint "Pick other Endpoint: "))
    (command "LEADER" "nea" arrowhead1 "per" arrowhead2 "" "" "N")
    (command "LEADER" "@" "nea" arrowhead1 "" "" "N")

    Kent Cooper, AIA


    osnaps set to nearest and perpendicular?
     
    Kent Cooper, AIA, Jul 2, 2004
    #21
  2. See my second response to your previous message (we crossed in the mail) --
    I suspect Nea is beating out Per.

    Kent Cooper, AIA


    perpendicular point which is not perpendicular to the first point selected.
    Any ideas?
     
    Kent Cooper, AIA, Jul 2, 2004
    #22
  3. I take part of it back. Use the first version.

    In the second version,
    (command "LEADER" "@" "nea" arrowhead1 "" "" "N")
    could go wrong because the first leader would now be there, and the "nea"
    point to the arrowhead1 pick-location might be on that leader, not on the
    line where the first end (i.e., the arrowhead point) of that leader would
    now be.

    Kent Cooper, AIA
     
    Kent Cooper, AIA, Jul 2, 2004
    #23
  4. molokaiboy

    molokaiboy Guest

    I just need the line to be parallel from the first point that I selected. Which one should I go with?

    Collin
     
    molokaiboy, Jul 2, 2004
    #24
  5. If you mean PERPENDICULAR (to something) from the first point you selected,
    without any Nearest part muddying up the first point, this should work, with
    Osnap disabled one way or another:

    (setq arrowhead1 (getpoint "Pick one Endpoint: "))
    (setq arrowhead2 (getpoint "Pick other Endpoint: ") "per")
    (command "LEADER" arrowhead1 arrowhead2 "" "" "N")
    (command "LEADER" arrowhead2 arrowhead1 "" "" "N")


    Kent Cooper, AIA


    ...
     
    Kent Cooper, AIA, Jul 2, 2004
    #25
  6. molokaiboy

    molokaiboy Guest

    I still need to have the user select a point using the nearest osnap, then perpendicular to that first point selected.

    Collin
     
    molokaiboy, Jul 2, 2004
    #26
  7. molokaiboy

    molokaiboy Guest

    I got it to work. I have to do a series of turning off osnaps.

    Thanks

    Collin
     
    molokaiboy, Jul 2, 2004
    #27
  8. molokaiboy

    Joe Burke Guest

    Following is sort of a generic solution. Sometimes I need an arrow on the end of an
    arc or open pline.

    Joe Burke

    ;; JB 7/16/2003
    ;; Place an arrow (solid) at one end of the object types
    ;; listed below. Arrow is placed on the same layer as
    ;; the selected object. Arrow size is based on dimscale.
    ;; Note: closed objects and short segments are rejected.

    (defun c:ArrowEnd ( / Doc Mspace Pspace Space TypLst Ent Vobj
    PkPt DimScl StPt EnPt Len Dist CurvePt
    Ang p1 p2 p3 Solid )

    (vl-load-com)
    (setq Doc (vla-get-ActiveDocument (vlax-get-acad-object))
    Mspace (vla-get-ModelSpace Doc)
    Pspace (vla-get-PaperSpace Doc)
    DimScl (getvar "dimscale")
    )
    (if (= 1 (vlax-get Doc 'ActiveSpace))
    (setq Space Mspace)
    (setq Space Pspace)
    )
    (setq TypLst '("AcDbLine" "AcDbArc" "AcDbPolyline" "AcDb2dPolyline"
    "AcDbSpline" "AcDbEllipse"))
    (sssetfirst)

    (while
    (or
    (not (setq Ent (entsel "\nSelect object near end to place arrow: ")))
    (not (setq Vobj (vlax-ename->vla-object (car Ent))))
    (not (vl-position (vlax-get Vobj 'ObjectName) TypLst))
    (if (vlax-property-available-p Vobj 'Closed)
    (= -1 (vlax-get Vobj 'Closed))
    )
    )
    (princ "\nWrong object type or closed object selected. ")
    )

    (setq PkPt (trans (cadr Ent) 1 0))
    (setq Len
    (vlax-curve-getDistAtParam Vobj
    (vlax-curve-getEndParam Vobj)
    )
    )
    (setq StPt (vlax-curve-getStartPoint Vobj))
    (setq EnPt (vlax-curve-getEndPoint Vobj))
    (if (< (distance StPt PkPt) (distance EnPt PkPt))
    ;from start point
    (setq Dist (* DimScl 0.15625) p1 StPt)
    ;from end point
    (setq Dist (- Len (* DimScl 0.15625)) p1 EnPt)
    )
    (setq CurvePt (vlax-curve-getPointAtDist Vobj Dist))
    (if CurvePt
    (progn
    (setq Ang (angle p1 CurvePt))
    (setq p2 (polar CurvePt (+ Ang (/ pi 2)) (* DimScl 0.02604)))
    (setq p3 (polar CurvePt (- Ang (/ pi 2)) (* DimScl 0.02604)))
    (setq Solid (vlax-invoke Space 'AddSolid p1 p2 p3 p3))
    (vlax-put Solid 'Layer (vlax-get Vobj 'Layer))
    )
    (princ "\nCannot place arrow on object. ")
    )
    (princ)
    ) ;end
     
    Joe Burke, Jul 3, 2004
    #28
  9. molokaiboy

    CAB2k Guest

    I like the LEADER method, here is my offering.
    Code:
    ;;;    dubleader.lsp
    ;;;    C. Alan Butler  July 4, 2004
    ;;;    Draw a double headed leader, 2 point or 4 point
    ;;;    Creates two leader objects, via LEADER command
    ;;;
    ;;;    Pick p1 p2 Enter  for 2 point leader
    ;;;    Pick p1 p2 p3 p4  for 4 point leader
    (defun c:dbl(/ usercmd useros useror p1 p2 p3 p4)
    (setq usercmd (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (setq useros (getvar "osmode"))
    (setvar "osmode" 0) ; osnaps off
    (setq useror (getvar "orthomode"))
    (setvar "orthomode" 0) ; trun ortho off for segment p1 p2
    (if (and (setq p1 (getpoint "\n*-Pick arrow point."))
    (null(initget 32))
    (setq p2 (getpoint p1 "\n**-Pick arrow point or 2nd point of 4 point arrow."))
    (null(grdraw p1 p2 7 1))
    (setvar "orthomode" 1) ; trun ortho on for segment p2 p3
    )
    (if (and (null(initget 32))
    (setq p3 (getpoint p2 "\n***-Pick 3rd point or enter for 2 point arrow."))
    (null(grdraw p2 p3 7 1))
    (null(initget 32))
    (setvar "orthomode" 0) ; trun ortho off for segment p3 p4
    (setq p4 (getpoint p3 "\n****-Pick last arrow point."))
    )
    (progn ;  4 point arrow
    (setvar "osmode" 0) ; osnaps off
    (command "leader" p1 p2 p3 "" "" "n")
    (command "leader" p4 p3 p2 "" "" "n")
    (redraw)
    )
    (progn ;  2 point arrow
    (setvar "osmode" 0) ; osnaps off
    (command "leader" p1 p2 "" "" "n")
    (command "leader" p2 p1 "" "" "n")
    (redraw)
    )
    ); endif
    ); endif
    (setvar "cmdecho" usercmd)
    (setvar "osmode" useros)
    (setvar "orthomode" useror)
    ); defun
    
     
    CAB2k, Jul 4, 2004
    #29
  10. molokaiboy

    Casey Guest

    Or just put '\H' as the prefix and the text is not displayed.
     
    Casey, Jul 5, 2004
    #30
  11. Interesting thought, but it didn't work for me. It only removed the first
    character of the default text. I tried it both as an override prefix before
    the default (giving it an override text value of "\H<>") [which is much more
    complicated than giving it a plain old space anyway], and as a prefix in the
    Primary Units part of the dimension style definition. Both had the same
    result. How do you apply that to make it cause the text not to be
    displayed?

    (My trials were in Architectural units, with the default text consisting of
    feet-inches-fractions. I tried it in both 2000 & 2004.)

    Kent Cooper, AIA
     
    Kent Cooper, AIA, Jul 6, 2004
    #31
  12. I abandoned you last Friday at a quarter to six because, hey, it was a
    holiday weekend, and I assume you're in Hawaii or something (what's that,
    about six hours earlier than we are on the east coast?).

    Because of your still needing to turn off osnaps to make it work, I wondered
    about the syntax of using them within lisp code, so I looked back at some
    other routines I've done to compare. I find I might have (heaven forbid!)
    steered you wrong there, and maybe with it done right you can go into it
    with any running Osnap modes you want, so you don't have to turn them off.
    I think the correct way to say it is to change

    (setq arrowhead1 (getpoint "Pick one Endpoint: ") "nea")
    (setq arrowhead2 (getpoint "Pick other Endpoint: ") "per")

    to

    (setq arrowhead1 (osnap (getpoint "Pick one Endpoint: ") "nea"))
    (setq arrowhead2 (osnap (getpoint "Pick other Endpoint: ") "per"))

    I haven't tested it. The other routines I looked at are in macro
    screen/tablet/pull-down format rather than command-defun format, i.e.

    <...preceding stuff...>+
    (setq arrowhead1 (osnap (getpoint "Pick one Endpoint: ") "nea")) \+
    (setq arrowhead2 (osnap (getpoint "Pick other Endpoint: ") "per")) \+
    <...etc...>

    so I'm not positive the same explicit osnap call is right for the
    command-defun format. But see if changing that makes it work for you even
    WITH running Osnap modes on.

    Kent Cooper, AIA


    ...
     
    Kent Cooper, AIA, Jul 6, 2004
    #32
  13. molokaiboy

    Casey Guest

    Oh yeah...don't use architectural units, use decimal or something else...

    Casey


     
    Casey, Jul 6, 2004
    #33
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.