Frozen certain color object and print drawing

Frozen certain color object and print drawing

Bin2009
Advocate Advocate
1,242 Views
12 Replies
Message 1 of 13

Frozen certain color object and print drawing

Bin2009
Advocate
Advocate

Hello, I started learn Autolisp,

I have batch of drawings, need do the same process for turn off some red marks for print clean drawing:

 Select all the labels the color is 255,0,0

Put all selected object on layer defpoints

Turn off the layer defpoints

Print the drawing

Some times, I need turn on those red marks for checking purpose:

Turn on the layer defpoints

Select all the labels the color is 255,0,0

Put all selected object on layer TEXT-1

Print the drawing

I hope can create one lisp with two command, can do those two operation.

Is anyone can help me out? Thank in advance.

0 Likes
Accepted solutions (2)
1,243 Views
12 Replies
Replies (12)
Message 2 of 13

john.uhden
Mentor
Mentor

Why not just put all those color 255 objects on a noplot layer?

John F. Uhden

Message 3 of 13

Kent1Cooper
Consultant
Consultant

To elaborate on @john.uhden's suggestion:  The use of the DEFPOINTS Layer for non-plotting stuff dates from a time [pretty long ago now] when that was the only Layer that didn't plot.  That, of course, means that in the procedure you describe, you don't have to turn that Layer off.  But for a very long time now, you've been able to designate any Layer you want to not plot, so do it that way -- make yourself a non-plotting comments Layer, and instead of giving your labels a specific color override, just put them on that Layer [you can use that color for the Layer, if it helps you differentiate such comments from other text].  You won't have to change anything's Layer or turn anything off, or reverse any of that, to have those things not come out in your plots.

Kent Cooper, AIA
Message 4 of 13

john.uhden
Mentor
Mentor

Now there's a thorough explanation.  Well said!

John F. Uhden

0 Likes
Message 5 of 13

Bin2009
Advocate
Advocate

Thank very much for your suggestion.

 

We didn't create a new layer for those labels, because base on the client standard, we are not allowed create extra layer, we only have one no-plotting layer can put temporary stuff,  that layer already have full of different objects from survey. so we decide use specific color to show those labels,  which one sometimes need print out, sometimes need to hide.

 

Right now, I use quickselect to select all the color 255,0,0 labels, then change the layer.

 

Also, now we already have few hundreds drawing with this kind of label setting on defpoint layer, if now create a new no-plotting layer for all drawings, still lots of work.

 

I just get tired everyday repeat select, change layer, play with those labels, so hope can get one command solution.

 

Bin

 

 

0 Likes
Message 6 of 13

Kent1Cooper
Consultant
Consultant
Accepted solution

Forget DEFPOINTS and changing Layers and all -- if you have a new-enough version of AutoCAD [I don't know when this came in] use HIDEOBJECTS on them to make them disappear for Plotting.  Then use UNISOLATEOBJECTS to bring them back.

 

Unfortunately, there doesn't seem to be a way of filtering for TrueColor values rather than ordinary color values in (ssget) to directly find only such objects.  But you can find all "candidate" objects, and step through and put the ones with the right color into a selection set for hiding.

 

Both commands here include the setting up of the visibility of such objects and the calling up of a PLOT command.  On the assumption that all the "labels" are either Text or Mtext objects, these seem to work in very limited testing:

 

(defun C:H25500P (/ textss H25500 n ent entTC); = Hide color-255,0,0 labels and Plot
  (if (setq textss (ssget "_X" '((0 . "*TEXT"))))
    (progn
      (setq H25500 (ssadd)); initially empty
      (repeat (setq n (sslength textss))
        (setq
          ent (ssname textss (setq n (1- n)))
          entTC (vla-get-TrueColor (vlax-ename->vla-object ent))
        ); setq
        (if
          (and
            (= (vla-get-Red entTC) 255)
            (= (vla-get-Green entTC) 0)
            (= (vla-get-Blue entTC) 0)
          ); and
          (ssadd ent H25500); put it in the set
        ); if
      ); repeat
      (if (> (sslength H25500) 0); found any
        (command "_.hideobjects" H25500 ""); then
      ); if
(initdia) (command "_.plot") ); progn ); if ); defun (defun C:P25500 (); = Plot with color-255,0,0 labels on (command "_.unisolateobjects") (initdia) (command "_.plot") ); defun

That second command assumes that if any of the labels are currently not visible, it is because they were hidden with HIDEOBJECTS, not because the Layer they're on is turned off or frozen.  If they're already visible, it won't matter, unless you have used HIDEOBJECTS or ISOLATEOBJECTS on other things and want that status maintained -- if that's ever the case, these commands are not for you.

 

If the "labels" include other object types [Leaders? Boxes of some kind around things? Dimensions? etc.], add the possibilities to the (ssget) filter list entity-type entry.

Kent Cooper, AIA
Message 7 of 13

john.uhden
Mentor
Mentor

A brilliant but pathetic workaround.  He oughta straighten up his client or fire him.

John F. Uhden

0 Likes
Message 8 of 13

Bin2009
Advocate
Advocate

Thank so much for your lisp! 

0 Likes
Message 9 of 13

Bin2009
Advocate
Advocate

Thank for your suggestion, I think use layer to control plot/unplot stuff is a good way.

Bin

0 Likes
Message 10 of 13

scot-65
Advisor
Advisor
Another direction one might consider is to assign a color
that does not plot, that is if one employs a CTB file.

Select the desired pen (for instance color 10) and set
Grayscale to "On". Next set Screening to 0.

It will not matter if the layer's bylayer is color 10 or the objects
are forced that color, these will not show up when plotting.

No need to hide these objects from view when plotting...

We use color 11 to do this. Our layer called "Defpoints" also
has this same color assignment, so as to not confuse anyone
(they will associate the color that does not plot).

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 11 of 13

Bin2009
Advocate
Advocate

Thanks!

0 Likes
Message 12 of 13

Bin2009
Advocate
Advocate

Hello Kent, your lisp works great for text, but my label is Multileader, please see the attached image for detail, sorry I didn’t mention this before.

I try to modify the lisp to work for Multileader, but I can’t could you please help me again.

Thank very much!

Bin

0 Likes
Message 13 of 13

Kent1Cooper
Consultant
Consultant
Accepted solution

@Bin2009 wrote:

... your lisp works great for text, but my label is Multileader, ....


I'm at my older-version location right now, so I can't test this, but it should work to simply change this line:

 

(if (setq textss (ssget "_X" '((0 . "*TEXT"))))

to this:

 

(if (setq textss (ssget "_X" '((0 . "*TEXT,MULTILEADER"))))

 

If you want to be picky about terminology, you could change that textss variable name to something like labelss [not just in that line but also wherever it appears elsewhere].

Kent Cooper, AIA