Is there a way to put a temporary "X" where you pick in a routine.

Discussion in 'AutoCAD' started by Tom, Jul 14, 2003.

  1. Tom

    Tom Guest

    I want to put a temporary "X" where the user picks. I could create a block
    and insert it then delete it but I was hoping there was something that
    wouldn't remain if the routine was escaped from.
    Thanks,
    Tom
     
    Tom, Jul 14, 2003
    #1
  2. Tom

    Tom Guest

    I thought of both of these but I was hoping to get something that would not
    be left if the routine was escaped out of.
    Tom
     
    Tom, Jul 14, 2003
    #2
  3. AH! a use for BLIPMODE <g>.
     
    Jason Piercey, Jul 14, 2003
    #3
  4. Create the block, just use an error handler to delete it
    if the user hits escape.
     
    Jason Piercey, Jul 14, 2003
    #4
  5. Tom

    Paul Turvill Guest

    (grvecs...) could be used as well.
    ___
     
    Paul Turvill, Jul 14, 2003
    #5
  6. Tom

    Kevin Nehls Guest

    Nah, just a good place to use (grvecs) or (grdraw) as Paul T. suggested.
    <g>
     
    Kevin Nehls, Jul 14, 2003
    #6
  7. Way back when, at one of my first CAD jobs, I used them quite a bit. We
    drew everything with snap set a 2". The blips made it easy to eyeball
    alignment points. Of course we made heavy use of the screen menu back then
    also....
    --
    Bobby C. Jones
    www.AcadX.com

     
    Bobby C. Jones, Jul 14, 2003
    #7
  8. Tom

    Doug Broad Guest

    Aside from the exact picture that you asked for (blips are plus symbols),
    a redraw will get rid of them and they are the simplest. If you need the
    exact shape of an X, then what Paul proposed is best.

    Blips are a built in feature, that most users turn off, but which can be
    useful as feedback.

    If you need something to snap to, then the first suggestion of a block
    could be useful.

    You might look into points also which you can snap to, easily erase
    by selection set filtering, and can make invisible when you need them.
     
    Doug Broad, Jul 14, 2003
    #8
  9. Tom

    David Bethel Guest

    Here are a few variations on the theme. John U. did the LED charachters.

    ;;;TEMPORARY VECTOR SHAPES

    ;;;GRDRAW X -> pt color flag
    (defun grx (p c f / size)
    (setq size (/ (getvar "VIEWSIZE") 33))
    (grdraw (polar p (* pi 1.25) size)
    (polar p (* pi 0.25) size) c f)
    (grdraw (polar p (* pi 1.75) size)
    (polar p (* pi 0.75) size) c f))

    ;;;GRDRAW PLUS -> pt color flag
    (defun grp (p c f / size)
    (setq size (/ (getvar "VIEWSIZE") 46.6))
    (grdraw (polar p (* pi 1.00) size)
    (polar p (* pi 0.00) size) c f)
    (grdraw (polar p (* pi 1.50) size)
    (polar p (* pi 0.50) size) c f))

    ;;;GRDRAW BOX -> pt color
    (defun grb (p c / size)
    (setq size (/ (getvar "VIEWSIZE") (getvar "PICKBOX") 16))
    (grdraw (polar p (* pi 0.25) size)
    (polar p (* pi 0.75) size) c)
    (grdraw (polar p (* pi 0.75) size)
    (polar p (* pi 1.25) size) c)
    (grdraw (polar p (* pi 1.25) size)
    (polar p (* pi 1.75) size) c)
    (grdraw (polar p (* pi 1.75) size)
    (polar p (* pi 0.25) size) c))

    ;;;GRDRAW BOX WITH X -> pt color
    (defun grbx (p c / size)
    (setq size (/ (getvar "VIEWSIZE") (getvar "PICKBOX") 16))
    (grdraw (polar p (* pi 0.25) size)
    (polar p (* pi 0.75) size) c)
    (grdraw (polar p (* pi 0.75) size)
    (polar p (* pi 1.25) size) c)
    (grdraw (polar p (* pi 1.25) size)
    (polar p (* pi 1.75) size) c)
    (grdraw (polar p (* pi 1.75) size)
    (polar p (* pi 0.25) size) c)
    (grdraw (polar p (* pi 1.25) size)
    (polar p (* pi 0.25) size) c)
    (grdraw (polar p (* pi 1.75) size)
    (polar p (* pi 0.75) size) c))

    ;;;GRDRAW RECTANGLE -> pt color flag
    (defun grr (ll ur c f / ul lr)
    (setq ul (list (car ll) (cadr ur))
    lr (list (car ur) (cadr ll)))
    (grdraw ll lr c f)
    (grdraw lr ur c f)
    (grdraw ur ul c f)
    (grdraw ul ll c f))

    ;;;GRDRAW POLYGON -> pt color flag
    (defun grpg (ll lr ul ur c f / ul lr)
    (grdraw ll lr c f)
    (grdraw lr ur c f)
    (grdraw ur ul c f)
    (grdraw ul ll c f))

    ;;;GRDRAW RECTANGLE WITH X -> pt color flag
    (defun grrx (ll ur c f / ul lr)
    (setq ul (list (car ll) (cadr ur))
    lr (list (car ur) (cadr ll)))
    (grdraw ll lr c f)
    (grdraw lr ur c f)
    (grdraw ur ul c f)
    (grdraw ul ll c f)
    (grdraw ll ur c f)
    (grdraw ul lr c f))

    ;; DIGITAL.LSP (01-07-2002), John F. Uhden, Cadlantic
    ;; Dedicated to David Bethel
    ;; Does not look good with rotated UCSs or ViewTwists
    ;; Add your own character functions as needed.

    ;;| Modified 01-10-2002 DDB
    Add Value Checking
    Use Color 0 To Black Out
    Change To GRLED
    |;

    ;;;ARG -> 'INT mid_pt_list color_number
    (defun grled (number midp clr / p i fun bar #0 #1 #2 #3 #4 #5 #6 #7 #8 #9
    str hgt)

    (if (and (numberp number)
    (not (minusp number))
    (= (type number) 'INT)
    (listp midp)
    (< (length midp) 4)
    (numberp (car midp))
    (numberp (cadr midp))
    (numberp clr)
    (not (minusp clr))
    (< clr 255)
    (= (getvar "WORLDUCS") 1)
    (equal (getvar "VIEWDIR") '(0 0 1) 1e-14))
    (setq str (itoa number)
    hgt (/ (getvar "VIEWSIZE") 16.667)
    midp (list (car midp) (cadr midp) 0))
    (and (princ "\nInvalid Setting or Argument In Digital")
    (exit)));;; END Of DDB

    (defun bar (p hgt clr dir / ph n t- t+ b- b+ d++ d+-)
    (setq p (list (car p)(cadr p))
    hgt (* hgt 0.5)
    ph (/ (getvar "viewsize")(cadr (getvar "screensize"))) ;
    pixel hgt
    n (max 1 (fix (/ hgt 6 ph)))
    hgt (- hgt (* ph (sqrt n))))
    (if (= dir "UP")
    (setq t- (mapcar '+ p (list 0.0 hgt))
    b- (mapcar '- p (list 0.0 hgt))
    d++ (list ph ph)
    d+- (list ph (- ph)))
    (setq t- (mapcar '+ p (list hgt 0.0))
    b- (mapcar '- p (list hgt 0.0))
    d+- (list (- ph)(- ph))
    d++ (list ph (- ph))))
    (setq t+ t- b+ b-)
    (grvecs (list clr t- b-))
    (repeat n
    (grvecs
    (list
    clr
    (setq t- (mapcar '- t- d++))
    (setq b- (mapcar '- b- d+-))))
    (grvecs
    (list
    clr
    (setq t+ (mapcar '+ t+ d+-))
    (setq b+ (mapcar '+ b+ d++))))))

    (defun #0 (midp hgt clr / h 1/4h 1/2h)
    (setq 1/2h (* hgt 0.5)
    1/4h (* hgt 0.25)
    midp (list (car midp)(cadr midp)))
    (bar (mapcar '+ midp (list 0.0 1/2h)) 1/2h clr nil)
    (bar (mapcar '+ midp (list 1/4h 1/4h)) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 1/4h (- 1/4h))) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 0.0 (- 1/2h))) 1/2h clr nil)
    (bar (mapcar '+ midp (list (- 1/4h)(- 1/4h))) 1/2h clr "UP")
    (bar (mapcar '+ midp (list (- 1/4h) 1/4h)) 1/2h clr "UP"))

    (defun #1 (midp hgt clr / h 1/4h 1/2h)
    (setq 1/2h (* hgt 0.5)
    1/4h (* hgt 0.25)
    midp (list (car midp)(cadr midp)))
    (bar (mapcar '+ midp (list 0.0 1/4h)) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 0.0 (- 1/4h))) 1/2h clr "UP"))

    (defun #2 (midp hgt clr / h 1/4h 1/2h)
    (setq 1/2h (* hgt 0.5)
    1/4h (* hgt 0.25)
    midp (list (car midp)(cadr midp)))
    (bar midp 1/2h clr nil)
    (bar (mapcar '+ midp (list 0.0 1/2h)) 1/2h clr nil)
    (bar (mapcar '+ midp (list 1/4h 1/4h)) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 0.0 (- 1/2h))) 1/2h clr nil)
    (bar (mapcar '+ midp (list (- 1/4h)(- 1/4h))) 1/2h clr "UP"))

    (defun #3 (midp hgt clr / h 1/4h 1/2h)
    (setq 1/2h (* hgt 0.5)
    1/4h (* hgt 0.25)
    midp (list (car midp)(cadr midp)))
    (bar midp 1/2h clr nil)
    (bar (mapcar '+ midp (list 0.0 1/2h)) 1/2h clr nil)
    (bar (mapcar '+ midp (list 1/4h 1/4h)) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 1/4h (- 1/4h))) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 0.0 (- 1/2h))) 1/2h clr nil))

    (defun #4 (midp hgt clr / h 1/4h 1/2h)
    (setq 1/2h (* hgt 0.5)
    1/4h (* hgt 0.25)
    midp (list (car midp)(cadr midp)))
    (bar midp 1/2h clr nil)
    (bar (mapcar '+ midp (list 1/4h 1/4h)) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 1/4h (- 1/4h))) 1/2h clr "UP")
    (bar (mapcar '+ midp (list (- 1/4h) 1/4h)) 1/2h clr "UP"))

    (defun #5 (midp hgt clr / h 1/4h 1/2h)
    (setq 1/2h (* hgt 0.5)
    1/4h (* hgt 0.25)
    midp (list (car midp)(cadr midp)))
    (bar midp 1/2h clr nil)
    (bar (mapcar '+ midp (list 0.0 1/2h)) 1/2h clr nil)
    (bar (mapcar '+ midp (list 1/4h (- 1/4h))) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 0.0 (- 1/2h))) 1/2h clr nil)
    (bar (mapcar '+ midp (list (- 1/4h) 1/4h)) 1/2h clr "UP"))

    (defun #6 (midp hgt clr / h 1/4h 1/2h)
    (setq 1/2h (* hgt 0.5)
    1/4h (* hgt 0.25)
    midp (list (car midp)(cadr midp)))
    (bar midp 1/2h clr nil)
    (bar (mapcar '+ midp (list 0.0 1/2h)) 1/2h clr nil)
    (bar (mapcar '+ midp (list 1/4h (- 1/4h))) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 0.0 (- 1/2h))) 1/2h clr nil)
    (bar (mapcar '+ midp (list (- 1/4h)(- 1/4h))) 1/2h clr "UP")
    (bar (mapcar '+ midp (list (- 1/4h) 1/4h)) 1/2h clr "UP"))

    (defun #7 (midp hgt clr / h 1/4h 1/2h)
    (setq 1/2h (* hgt 0.5)
    1/4h (* hgt 0.25)
    midp (list (car midp)(cadr midp)))
    (bar (mapcar '+ midp (list 0.0 1/2h)) 1/2h clr nil)
    (bar (mapcar '+ midp (list 1/4h 1/4h)) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 1/4h (- 1/4h))) 1/2h clr "UP"))

    (defun #8 (midp hgt clr / h 1/4h 1/2h)
    (setq 1/2h (* hgt 0.5)
    1/4h (* hgt 0.25)
    midp (list (car midp)(cadr midp)))
    (bar midp 1/2h clr nil)
    (bar (mapcar '+ midp (list 0.0 1/2h)) 1/2h clr nil)
    (bar (mapcar '+ midp (list 1/4h 1/4h)) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 1/4h (- 1/4h))) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 0.0 (- 1/2h))) 1/2h clr nil)
    (bar (mapcar '+ midp (list (- 1/4h)(- 1/4h))) 1/2h clr "UP")
    (bar (mapcar '+ midp (list (- 1/4h) 1/4h)) 1/2h clr "UP"))

    (defun #9 (midp hgt clr / h 1/4h 1/2h)
    (setq 1/2h (* hgt 0.5)
    1/4h (* hgt 0.25)
    midp (list (car midp)(cadr midp)))
    (bar midp 1/2h clr nil)
    (bar (mapcar '+ midp (list 0.0 1/2h)) 1/2h clr nil)
    (bar (mapcar '+ midp (list 1/4h 1/4h)) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 1/4h (- 1/4h))) 1/2h clr "UP")
    (bar (mapcar '+ midp (list (- 1/4h) 1/4h)) 1/2h clr "UP")
    (bar (mapcar '+ midp (list 0.0 (- 1/2h))) 1/2h clr nil))

    (setq midp (list (car midp)(cadr midp) 0)
    p (polar midp pi (* hgt 0.4 (1- (strlen str))))
    i 1)
    (repeat (strlen str)
    (if (eval (setq fun (read (strcat "#" (substr str i 1)))))
    (eval (list fun (quote p) hgt clr)))
    (setq p (polar p 0.0 (* hgt 0.8))
    i (1+ i)))
    (prin1))

    ;;;GRLED TEST BEDS
    ;(setq *error* nil)
    ;(foreach i '(5 6 7 8 9 10 11 12 13 14)
    ; (grled i (list (+ 1 (* (- i 5) (/ (getvar "VIEWSIZE") 8.))) 12) 4))
    ;(setq i 0)
    ;(while (< i 100)
    ; (grled i '(16 16) 4)
    ; (grled i '(16 16) 0)
    ; (setq i (1+ i)))


    -David
     
    David Bethel, Jul 14, 2003
    #9
  10. Tom

    Scribble Guest

    (defun DrawCross (siz loc /)
    (grvecs '(256 (-1 0) (1 0) (0 1) (0 -1))
    (list (list siz 0.0 0.0 (car loc))
    (list 0.0 siz 0.0 (cadr loc))
    (list 0.0 0.0 1.0 0.0)
    (list 0.0 0.0 0.0 1.0)
    );list
    )
    );defun DrawCross


    --
    Cheers
    Steve

    I can walk on water,
    but I stagger on alcohol.
     
    Scribble, Jul 15, 2003
    #10
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.