Make selection turns all black

Make selection turns all black

johnw
Collaborator Collaborator
975 Views
9 Replies
Message 1 of 10

Make selection turns all black

johnw
Collaborator
Collaborator

Is there a way to turn a "selection" (something you pick) to turn black? I tried changing the "Selectioneffectcolor" variable but it doesn't do what I need it to do.

 

The goal would be to insert a block on top of another block, run a command that changes the selectioneffectcolor to black, then allows me to pick the block overlay, it turns black, and I can see if anything shows through on the block below, so I can see if there are differences in the blocks. Then when escaping, the selectioneffectcolor would go back to what it was originally.

 

Any assistance would be appreciated.

 

Thanks,

 

John

0 Likes
976 Views
9 Replies
Replies (9)
Message 2 of 10

ВeekeeCZ
Consultant
Consultant

How about simple turn those objects off using the HIDEOBJECTS command. Then show it again. 

In LISP you can set the visibility parameter, so it would be much faster then HIDE/UNISOLATE and we can show whichever objects we want, not just all the hidden object.

 

0 Likes
Message 3 of 10

johnw
Collaborator
Collaborator
When I use "hideobjects" and select the block that has been overlaid on another block, the command hides the object and I see the entire object below it. I'm trying to make the object above another object appear to turn black which would hide all items directly below that object.
Back in the day, when you erased something that was on top of another object, all overlapping linework would disappear and not show up until you hit Redraw or regen. That method worked great. Then autocad created the "auto-screen-refresh" (or whatever it is called) and now I cannot replicate this. I thought turning an object black somehow would accomplish the same thing.
0 Likes
Message 4 of 10

ВeekeeCZ
Consultant
Consultant

How about use the fading LAYLOCKFADECTL to max. Is that dark enough?

0 Likes
Message 5 of 10

johnw
Collaborator
Collaborator
It seems to be dark enough but I don't know how to use that setting in a routine that could be assigned to a specific block that I pick??
0 Likes
Message 6 of 10

ВeekeeCZ
Consultant
Consultant

Something simple.

(defun c:Darken ( / *error* ss)
  
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (command-s "_UNDO" "_Back")
    (princ))
  
  (if (setq ss (ssget "_:L"))
    (progn
      (command "_UNDO" "_Mark")
      (setvar 'LAYLOCKFADECTL 90)
      (command "_.LAYER" "_T" "_lockedlayer" "_M" "_lockedlayer" "_Lo" "_lockedlayer" "")
      (command "_.LAYCUR" ss "")
      (getkword "\nFinish Darken? <yes> ")
      (*error* "end"))))
0 Likes
Message 7 of 10

johnw
Collaborator
Collaborator

Worked great the first time i picked it. When I entered the command again and picked it, it selected it but the object below came through and I didn't see anything darkened (the darkened object went below the below object). I then went to draworder and selected the block and put it in FRONT (F) of the object below, then the darken command worked numerous times.

 

Can you revise the code to ensure that the 'picked' object is always on top and/or in front of everything else?

 

That would be awesome!

0 Likes
Message 8 of 10

johnw
Collaborator
Collaborator

One other item:

 

I continued to mess with this routine and I drew some lines and such and tested the overlay. A couple times when I accepted the <yes> prompt, i received another prompt stating that everything would be undone. After hitting Y all my work that i was testing was undone. So I don't know why the Undo Mark that you have in your routine didn't set a new point each time I ran the command. It seems to have done so the first time but then fails to do so again and all work is undone. Not sure why.

0 Likes
Message 9 of 10

ВeekeeCZ
Consultant
Consultant

Hmm, try this then, if that's any better.

 

(vl-load-com)

(defun c:Darken ( / *error* ss lay adoc)
  
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (vla-endundomark adoc)
    (command-s "_UNDO" 1)
    (princ))
  
  (if (setq ss (ssget "_:L"))
    (progn
      (vla-endundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
      (vla-startundomark adoc)

      (setq lay (if (tblsearch "LAYER" "_lockedlayer")
		  (vlax-ename->vla-object (tblobjname "LAYER" "_lockedlayer"))
		  (vla-add (vla-get-layers adoc) "_lockedlayer")))
      (vla-put-lock lay :vlax-true)
      (vla-put-layeron lay :vlax-true)
      (vla-put-freeze lay :vlax-false)
      (setvar 'LAYLOCKFADECTL 90)
      (setvar 'CMDECHO 0)
      
      (command "_.CHPROP" ss "" "_Layer" "_lockedlayer" "")
      (vla-regen adoc acActiveViewport)
      (getkword "\nFinish Darken? <yes> ")
      (*error* "end"))))
Message 10 of 10

johnw
Collaborator
Collaborator
Thanks for the help with all this! I left for vacation tonight and won’t be able to test this until I get back on June 11th. I’ll be sure to test it out! Thanks again for going above and beyond!!!
0 Likes