Author Topic: Highlighting the line  (Read 4239 times)

0 Members and 1 Guest are viewing this topic.

paulmcz

  • Bull Frog
  • Posts: 202
Highlighting the line
« on: November 24, 2005, 08:41:15 PM »
Is there a way that the line selected for this line of code would get highlighted on the screen and stay highlighted?

(setq a (car (entsel "\n Select line: ")))

Thanks, Paul.

LE

  • Guest
Re: Highlighting the line
« Reply #1 on: November 24, 2005, 09:38:16 PM »
Look for the function REDRAW

(redraw a 3)

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Highlighting the line
« Reply #2 on: November 24, 2005, 09:43:59 PM »
Code: [Select]
(setq a (car (entsel "\n Select line: ")))
(vl-cmdf "_select" a "")
(setq b (ssget "_P"))
(sssetfirst nil b)
(alert "line selected")
Keep smile...

LE

  • Guest
Re: Highlighting the line
« Reply #3 on: November 24, 2005, 10:19:28 PM »
Code: [Select]
(setq a (car (entsel "\n Select line: ")))
(vl-cmdf "_select" a "")
(setq b (ssget "_P"))
(sssetfirst nil b)
(alert "line selected")

The function redraw is designed for the purpose of highlight an entity, the other form is to use (vlax-highlight obj :vlax-true)

paulmcz

  • Bull Frog
  • Posts: 202
Re: Highlighting the line
« Reply #4 on: November 24, 2005, 10:35:43 PM »
You guys are the best!
(redraw a 3)
did the trick.

Thanks,
Paul.

paulmcz

  • Bull Frog
  • Posts: 202
Re: Highlighting the line
« Reply #5 on: November 26, 2005, 01:11:56 PM »
Here is, what I was working on, when I needed the highlighting resolved. For someone who does a lot of converting to polylines and joining, it could come handy as it saves you a few clicks.

Fatty

  • Guest
Re: Highlighting the line
« Reply #6 on: November 26, 2005, 02:42:53 PM »
Hi Paul

I did try to go another way
Maybe this likes you:

Code: [Select]
(defun c:tsx (/ a b closed_flag en flag i ss)
  (setq a nil
b nil
  )
  (setvar "pickfirst" 0);to clear previous selset
  (setvar "cmdecho" 0)

  (if
    (setq ss (ssget '((0 . "LINE,ARC,LWPOLYLINE")))
  i  -1
    )
     (progn
       (while (setq en (ssname ss (setq i (1+ i))))
(if (eq (cdr (assoc 0 (entget en))) "LWPOLYLINE")
   (setq flag t)
   nil
)
(if (= (cdr (assoc 70 (entget en))) 1)
   (setq closed_flag t)
   nil
)
       )
     )
  )
  (if (not closed_flag)
    (progn
      (if flag

(command "pedit" ss "j" ss "" "")
(command "pedit" ss "y" "j" ss "" "")
      )
    )
    (alert "\n You can't join anything with closed polyline!")
  )
  (setvar "cmdecho" 1)
  (setvar "pickfirst" 1)
  (princ)
)

Thank you

Fatty

paulmcz

  • Bull Frog
  • Posts: 202
Re: Highlighting the line
« Reply #7 on: November 26, 2005, 05:55:08 PM »
Hi Fatty,
Very nice.
One more click saved!
Would you know, how to make it display, "x segments added to polyline", on the command line when the function finishes?
Paul.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Highlighting the line
« Reply #8 on: November 26, 2005, 06:21:50 PM »
Here's a way to deal with selection sets.

Code: [Select]
(defun ssredraw ( ss mode / i )
    (if (eq 'pickset (type ss))
        (repeat (setq i (sslength ss))
            (redraw
                (ssname ss (setq i (1- i)))
                mode
            )
        )
    )
)

;;  hide 'em

(ssredraw ss 2)

;;  show 'em

(ssredraw ss 1)

;;  highlight

(ssredraw ss 3)

;;  unhighlight

(ssredraw ss 4)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

paulmcz

  • Bull Frog
  • Posts: 202
Re: Highlighting the line
« Reply #9 on: November 26, 2005, 09:38:48 PM »
Selection in response to 'ssget' always gets highlited, it's the 'entsel' that for some reason doesn't trigger it. Then, one sometimes needs to deal with it somehow.

This good to know.
Thanks MP.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Highlighting the line
« Reply #10 on: November 26, 2005, 09:42:05 PM »
Selection in response to 'ssget' always gets highlited ...

Careful Paul, depends on the highlight variable setting --

e.g.

(setvar "highlight" 0)

(ssget)

(setvar "highlight" 1)

(ssget)


:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

paulmcz

  • Bull Frog
  • Posts: 202
Re: Highlighting the line
« Reply #11 on: November 26, 2005, 09:54:44 PM »
That's true, absolutely!