how do you select a line and make it stay dotted throughout the command in autolisp like in the trim and extend command
@cadking2k5 wrote:how do you select a line and make it stay dotted throughout the command in autolisp like in the trim and extend command
If you mean highlighted, and if 'ent' is the entity name of the Line [such as from something like (setq ent (car (entsel "\nSelect Line: "))) ]:
(redraw ent 3)
It will become unhighlighted if something happens to it such as being broken or trimmed or extended or moved or an endpoint changed. If not, you can unhighlight it with:
(redraw ent 4)
@cadking2k5 wrote:just one more problem if I hit the ESC button it will not redraw it
(Defun c:demo (/ *error* ent) (defun *error* (msg) (redraw ent 4) ) ;_ end_defun (setq ent (Car (entsel))) (redraw ent 3) (getstring "\nWhat the ****: ") (*error*) (princ) )
@pbejse wrote:
@cadking2k5 wrote:just one more problem if I hit the ESC button it will not redraw it
(Defun c:demo (/ *error* ent) (defun *error* (msg) (redraw ent 4) ) ;_ end_defun (setq ent (Car (entsel))) (redraw ent 3) (getstring "\nWhat the ****: ") (*error*) (princ) )
Knowing full well that this above is just intended as an example, be mindful of both:
_$ (redraw nil 3)
; error: bad argument type: lentityp nil
_$ (*error*) ; error: too few arguments
_$ (redraw nil 4)
; error: bad argument type: lentityp nil
... Instead, perhaps:
(defun c:FOO (/ *error* eName eNames) (defun *error* (msg) (if eNames (foreach eName eNames (redraw eName 4))) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (while (setq eName (car (entsel "\nSelect an entity to highlight: "))) (setq eNames (cons eName eNames)) (redraw eName 3) ) (getstring "\nThis is where you would do some work, right? ") (*error* nil) )
"How we think determines what we do, and what we do determines what we get."
@BlackBoxCAD wrote:
Knowing full well that this above is just intended as an example, be mindful of both:
_$ (redraw nil 3)
; error: bad argument type: lentityp nil
_$ (*error*) ; error: too few arguments
_$ (redraw nil 4)
; error: bad argument type: lentityp nil
None taken BlackBox. I shouldv'e check the code before i posted.
Cheers
@pbejse wrote:
@BlackBoxCAD wrote:Knowing full well that this above is just intended as an example, be mindful of both:_$ (redraw nil 3)
; error: bad argument type: lentityp nil
_$ (*error*) ; error: too few arguments
_$ (redraw nil 4)
; error: bad argument type: lentityp nilNone taken BlackBox. I shouldv'e check the code before i posted.
Cheers
Had this been a discussion among others I know to be adept at coding, I never would have mentioned it... Only as a result of the OP (seemingly) being unfamiliar with the Redraw function, and *error* handling, did I feel it prudent to tactfully point out.
Cheers
"How we think determines what we do, and what we do determines what we get."