TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Peter2 on February 07, 2014, 11:15:52 AM

Title: Color for "grdraw"
Post by: Peter2 on February 07, 2014, 11:15:52 AM
Hi

I have this simple code,
Code: [Select]
(setq startpunkt (getpoint "\nClick startpoint: ")
      endpunkt (getpoint startpunkt "\nClick endpoint: "))
where I create a "rubber band line" (sorry, I don't know the correct English word) between startpoint and cursor.

How can I set the color (and the lineweight??) of this line?
Title: Re: Color for "grdraw"
Post by: ronjonp on February 07, 2014, 11:36:18 AM
Here's for color:
Code: [Select]
(and (setq startpunkt (getpoint "\nClick startpoint: "))
     (setq endpunkt (getpoint startpunkt "\nClick endpoint: "))
     ;; start end color
     (grdraw startpunkt endpunkt 5)
)
Title: Re: Color for "grdraw"
Post by: Peter2 on February 07, 2014, 03:43:41 PM
Hi ronjonp

thanks, but you misunderstood (or I described it wrong ..). I don't need a grdraw after clicking the endpoint, I need it before clicking the endpoint (as grdraw or as modification of the getpoint line).
Title: Re: Color for "grdraw"
Post by: ronjonp on February 07, 2014, 04:09:50 PM
Here is a quick example:
Code: [Select]
(defun c:foo (/ p p1 p2)
  (if (setq p1 (getpoint "\nPick a point: "))
    (while (and (setq p2 (grread 5)) (= (car p2) 5)) (redraw) (grdraw p1 (setq p2 (cadr p2)) 1))
  )
  (list p1 p2)
)


And here are a few examples of GRREAD
http://www.theswamp.org/index.php?topic=12813.msg156555#msg156555
Title: Re: Color for "grdraw"
Post by: Peter2 on February 07, 2014, 04:12:48 PM
Thanks. Now I see that there must be a full grdraw-function and no modification of getpoint.
Title: Re: Color for "grdraw"
Post by: Lee Mac on February 08, 2014, 07:08:54 AM
Thanks. Now I see that there must be a full grdraw-function and no modification of getpoint.

This is pretty much the only modification of the rubber-band you can make with getpoint:
Code: [Select]
(defun c:test ( / p )
    (if (setq p (getpoint "\nStart: "))
        (progn
            (initget 32)
            (getpoint p "\nEnd: ")
        )
    )
    (princ)
)

Otherwise, a grread/grdraw/grvecs combination must be used (as Ron has demonstrated), however, the use of grread sacrifices all standard drawing aids (such as Object Snap / Orthomode / Tracking etc).
Title: Re: Color for "grdraw"
Post by: Peter2 on February 10, 2014, 09:46:47 AM
Thanks to all

I'm on my way now.