autolisp routine

autolisp routine

Anonymous
Not applicable
158 Views
8 Replies
Message 1 of 9

autolisp routine

Anonymous
Not applicable
Hello,
I work at fier-optics fascility; and I'm interested in autolisp
information that would make my job much easier. I'm trying to figure
out a lisp routine that will do the following: FILTER OUT A SELECTED
COLOR; THEN SELECTS FILTERED OUT ITEMS AND PUTS THEM ON A SELECTED LAYER
W/OUT INTERUPTED STEPS Any help would be much appreciated.

Sincerely,
Derek
0 Likes
159 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
Derek,

I could probably put together something for that, although filtering items
by color is a fairly easy thing to do. Let me know your thoughts.

--
Eugene N. Kilmer
Owner/Mag Drafting
0 Likes
Message 3 of 9

Anonymous
Not applicable
(defun color_to_layer (color layer)
(SETQ LAYT NIL)
(SETQ LAYT (TBLSEARCH "LAYER" layer))
(IF (NOT LAYT)
(COMMAND "LAYER" "NEW" layer "")
)
(setq ss (ssget "x" (list (cons 62 color))) )
(if ss
(command "chprop" ss "" "la" layer "")
)
The subroutine above could be used by passing the required arguments to the
function like what is shown below.
(color_to_layer 2 "yellow")

I would suggest that you take this one step further by obtaining the color
by selection.
perhaps.
(setq color_obj (entsel "\nSelect objects to set color filter..."))
(if color_obj
(setq color (cdr (assoc 62 (entget (car color_obj)))))
)

Please note that these are merely suggestion that do not take into account
the what if's of you programs conditions.

I have written several hundred programs like these and have found it to
always be best to allow the user to visually select rather than type. I
can't seem to figure out why Autocad prefers to ignore this format?

Hope I was helpful
Rodney Estep
www.homestead.com/designpro/main.html

TONY RICCINI wrote in message
news:38D1590E.B8A8A5E7@USELECTRIC.NET...
> Hello,
> I work at fier-optics fascility; and I'm interested in autolisp
> information that would make my job much easier. I'm trying to figure
> out a lisp routine that will do the following: FILTER OUT A SELECTED
> COLOR; THEN SELECTS FILTERED OUT ITEMS AND PUTS THEM ON A SELECTED LAYER
> W/OUT INTERUPTED STEPS Any help would be much appreciated.
>
>
> Sincerely,
> Derek
>
>
0 Likes
Message 4 of 9

Anonymous
Not applicable
"Eugene N. Kilmer" wrote:

> Derek,
>
> I could probably put together something for that, although filtering items
> by color is a fairly easy thing to do. Let me know your thoughts.
>
> --
> Eugene N. Kilmer
> Owner/Mag Drafting

Yes. You are correct it is an easy thing to do once or twice. But, I'm
working on hundreds of drawings; where saving one or two steps is like saving
a hundred or two steps. Many drawings I deal with have different colors, but
the colors are not set to a layer. If I could figure out a way to set the
different colors to selected layers in one step it would save much time. I
have already made a button to set the layers. I want avoid going in and out
of filter to set each color to a layer. The buttom I made:
EX; LA;NEW;CABLE;C;3;CABLE;;.....ETC for as many layers as I want.
I would very like to expand on this with a lisp routine.
Your help would be much appreciated.

Sincerely DEREK.
0 Likes
Message 5 of 9

Anonymous
Not applicable
Here is a routine that scans the drawing for entities that are not color
bylayer. Layers are created to match the color number of each of these
entities and they are put on the appropriate layer and set to color bylayer.

Let me know if you have any trouble with this.

==============================
Michael Weaver
By day: Charles Bettisworth & Co.
mweaver@bettisworth.com
By night: AlasCAD
alascad@go.com
AOL Instant messenger screen name:
AlasCAD
AUGI #w2170
==============================

"TONY RICCINI" wrote in message
news:38D1590E.B8A8A5E7@USELECTRIC.NET...
> Hello,
> I work at fier-optics fascility; and I'm interested in autolisp
> information that would make my job much easier. I'm trying to figure
> out a lisp routine that will do the following: FILTER OUT A SELECTED
> COLOR; THEN SELECTS FILTERED OUT ITEMS AND PUTS THEM ON A SELECTED LAYER
> W/OUT INTERUPTED STEPS Any help would be much appreciated.
>
>
> Sincerely,
> Derek
>
>
0 Likes
Message 6 of 9

Anonymous
Not applicable
To create the initial selection set doesn't it make more sense to employ ...

(setq ss (ssget"x" '((-4 . ""))))

rather than cycling thru all entities?

________________________________

puckettm@bantrel.com
> Not < an AutoDESK classroom monitor
Imagination makes all things possible
________________________________

Michael Weaver wrote in message <8b8d9i$48l36@adesknews2.autodesk.com>...

Here is a routine that scans the drawing for entities that are not color
bylayer ...

0 Likes
Message 7 of 9

Anonymous
Not applicable
You are right, Michael, much better. I seldom use this routine and haven't
tweaked it since I first created it six or seven years ago. Time to tweak
it now.

Thanks,
Mike

"Michael Puckett" wrote in message
news:8b8dkk$48426@adesknews2.autodesk.com...
> To create the initial selection set doesn't it make more sense to employ
...
>
> (setq ss (ssget"x" '((-4 . ""))))
>
> rather than cycling thru all entities?
>
> ________________________________
>
> puckettm@bantrel.com
> > Not < an AutoDESK classroom monitor
> Imagination makes all things possible
> ________________________________
>
> Michael Weaver wrote in message <8b8d9i$48l36@adesknews2.autodesk.com>...
>
> Here is a routine that scans the drawing for entities that are not color
> bylayer ...
>
>
>
>
0 Likes
Message 8 of 9

Anonymous
Not applicable
Done.

Here's the modified routine.

Mike

"Michael Weaver" wrote in message
news:8b8ig3$6td4@adesknews2.autodesk.com...
> You are right, Michael, much better. I seldom use this routine and
haven't
> tweaked it since I first created it six or seven years ago. Time to tweak
> it now.
>
0 Likes
Message 9 of 9

Anonymous
Not applicable
...or

(setq ss (ssget "x" '((-4 . "/=")(62 . 256))))
__
"Michael Puckett" wrote in message
news:8b8dkk$48426@adesknews2.autodesk.com...
> To create the initial selection set doesn't it make more sense to
employ ...
>
> (setq ss (ssget"x" '((-4 . ""))))
>
> rather than cycling thru all entities?
0 Likes