Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

select a line and make it stay dotted through the command

8 REPLIES 8
Reply
Message 1 of 9
cadking2k5
704 Views, 8 Replies

select a line and make it stay dotted through the command

how do you select a line and make it stay dotted throughout the command in autolisp like in the trim and extend command

8 REPLIES 8
Message 2 of 9
Kent1Cooper
in reply to: cadking2k5


@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)

Kent Cooper, AIA
Message 3 of 9
cadking2k5
in reply to: cadking2k5

thanks that did it
Message 4 of 9
cadking2k5
in reply to: cadking2k5

just one more problem if I hit the ESC button it will not redraw it

Message 5 of 9
pbejse
in reply to: cadking2k5


@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)
)

 

Message 6 of 9
BlackBox_
in reply to: pbejse


@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."

Message 7 of 9
pbejse
in reply to: BlackBox_


@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 thumbsup.gif

 

 

Message 8 of 9
BlackBox_
in reply to: pbejse


@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 nil

None taken BlackBox. I shouldv'e check the code before i posted.

 

Cheers thumbsup.gif

 

 


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."

Message 9 of 9
cadking2k5
in reply to: BlackBox_

is there a way to make it where you just pick one object and it automatically goes to the next step

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost