Author Topic: Color for "grdraw"  (Read 2275 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 654
Color for "grdraw"
« 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?
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Color for "grdraw"
« Reply #1 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)
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Peter2

  • Swamp Rat
  • Posts: 654
Re: Color for "grdraw"
« Reply #2 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).
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Color for "grdraw"
« Reply #3 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
« Last Edit: February 07, 2014, 04:13:26 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Peter2

  • Swamp Rat
  • Posts: 654
Re: Color for "grdraw"
« Reply #4 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.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Lee Mac

  • Seagull
  • Posts: 12916
  • London, England
Re: Color for "grdraw"
« Reply #5 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).

Peter2

  • Swamp Rat
  • Posts: 654
Re: Color for "grdraw"
« Reply #6 on: February 10, 2014, 09:46:47 AM »
Thanks to all

I'm on my way now.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23