Link to home
Start Free TrialLog in
Avatar of stefanaichholzer
stefanaichholzerFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Send selected objects to layers

I have an AutoCAD R14 drawing with a lot of objects (lines, arc, circles, polygons) distributed around the space.

Now I need to have the user input a range for X,Y from a given starting point and I need to get all the objects in that square and send the to separeate layers. Send circles to a layer called circles, arcs to a layer called arcs, and so on. Got the picture?? I'll try to illustrate this.

    x
    |             line                           circle                ----
    |  arc                                circle                        |
    |                         line                                        |
    |              circle                                                | User given x value
    |  polygon                       line                             |
    |                     polygon                                      |
    |      line                                          line          ----
    |                       circle
y--|---------------------------------------------
    |

    |-------- User given y value ----------|

 If you notice there's now a virtual square made of both user given values. OK, now I need to select all objects inside that square and send them to the layers as mentioned above.

 I hope this is not too complicated.

 Thank you!!! Please help me urgently!

 P.S. 430 points is all I have now. I would give 1000 if possible!
Avatar of stefanaichholzer
stefanaichholzer
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

To get a better idea, you can download the drawing here:

 http://www.cuencaweb.com/drwg.zip

 Thanks
To change the layer of an object

Select the objects whose layer you want to change.
On the Layers toolbar, click the Layer control.
Select the layer that you want to assign to the objects
Thank you. I forgot to mention, this need to be done in AutoLISP, call a function and the do all of that.

;)
does it have to be in lisp or can it be in vba?
Lisp, please.

Thanx!
norrin:

After working with autocad for two years about 10 years ago, I just bought a book for 2004 which I have. The book came with an e book! Fantastic since I can us it with Adobe Acrobat Pro. It allows me to underline and comment. I give myself 6 months to be up to speed. I had been a project engineer and the last two years worked with acad without any training! Anyway, I had been traveling for 15 years (gon for 6 months of the year) and no one wanted to fly with me since I had too many close calls. Having been retired for 10 years (I quit when I was 50), I have time to feed my brain. Thus I am now working with another e-book for xp pro.
Oh, if you want about 300 URLs for xp pro, go to my bio and e-mail me.

Joe
Why do you need lisp when the following is simple?
Make a layer for the objects to be selected including color
click on each object
Goto Properties display
Click on layer
Choose layer
Ckick ok The objects will take on automatically the characterists of the layer.
First, with all the resptect you guys deserve. I asked this question because I need to get it done in Lisp, else I could do it by clicking an object at a time and sending it to a layer. Imagine I have 1000 objects I need to get into layers, it would take one day to complete the task. That´s why I need Lisp.

Second, this is a question and all posts should be related with it, if you guys (gonzal13, norrin) need some space for your personal conversations, you can always use the forum here at EE, or create blog or use e-mail.

If none of you is capable of provinding accurate input, please let me know and I'll request a cancel for this question.

Thanks.
hey stefanaichholzer,
I didnt post anything that was not related to your post. I just asked if it you had to have it in lisp and not in vba.
Because I could have probably already come up with something in vba to help you. I'll be the first to admit that my lisp knowledge is very weak, I can do it, but I figured somebody else could do it alot faster.  So I did not respond any further, hoping that somebody else that has that knowledge would jump in, in a timely mannerI am sorry that hasnt happend yet, but that is out of my control. I do understand that you wanted it in lisp (and why you wanted it programmically) and that should be what you get.

To be honest I dont know why gonz posted that at all let alone to me (no offense joe)

radd
.Norin:

Sometimes I become wordy and off the subject. It is caused  ADD.

Joe
Avatar of techn125
techn125

Without using a lisp routine, there's something you can do that would speed it up alot. Are your users familiar with the command Filter?

Using it it they could select, at once, all the Arcs, Circles, Lines or Polylines, then put them on the wished layer. A Lisp could be made to run the filter command multiple times for each type of objects, but i dont know how to do those. Manually, using Filter, all or most of your objects could be cleaned in 5-6 commands depending how many different objects type you have.

>Filter
>Select filter in the pull down (arcs, circles, lines ect)
>Click 'Add to List'
>Select it in the list
>Apply
>Selection Window (user given x & y coords)
>Enter

Now your filtered items are selected (all arcs or circles ect.) using the Noun/Verb mode. In Acad14 i beleive, you must use the property dialog box to put them on another layer.

Repeat for every type of objects you want to separate.
Not a lisp, but its get it done without too much hassle.

I've tried it with your test dwg and it works good.
Just need to repeat the command for each type of object. So in a similar dwg, all objects could be changed layer in less than 5 mins.

Only one thing, you need to delete the previously used filter each time (not sure why).
The answer i provided did not include a Lisp routine, as demanded by the asker in a posterior post. Given the nature of the commands involved, i do not beleive the creation of a Lisp routine for it to be a simple task.
My answer provided a solution i see as simple, relatively fast given the task at hand and useable as is, in the line of thoughs of "Please help me urgently!"

I only wish for the asker to give the suggestion a fair try, even if it is not 100% complying with what was asked for as solution. If stefanaichholzer dont find value in it then, so be it and refund as requested or whatelse the moderators see fit.
It is wonderful when a client provides feed back. Without it one is pulling straws from the air. Ad W.E. Deming said in one of his books "In GOD we trust, all others bring data"

Joe
I requested the close because I can't find the solution to my request. I needed LISP and that's it, I have been playing around with AutoCAD and found a few functions I could use to move objects to layers.
But I'm no AutoCAD guru, so it would take ages to complete the task and most of the time I get only crap when searching on google for the functions I need. The AutoCAD help files are too damn crappy as well, as it's mostly VB to complete certain tasks.

So if the admin sees fit to accepts my request, please do so, I'd appreciate it. If not, go agead and hand out the points to anyone who posted here. I don't mind. (If techn125 thinks he deserves the points and needs the so badly, then go ahead!)

Thanks
Hey, its just that the command 'filter' would do what you are looking to do. Run it once to clear the circles, once to clear the lines, once to clear the arcs, once to clear the PLines. The same command, 4 times and its done. It was suggested to get you going right away, as there was no Lisp offered.

I concur, its not an automated command using Lisp. Its only the next best thing :oP
Also a solution that is appropriate to your problem, i beleive it would help you much.

Have you tried it?
I'm not in your boots, i assume you tried it at least and there must be reasons why the proposed solution is not cutting it for you.

Mods, please go ahead with the refund to stefanaichholzer. I have no further objections.
If you still need a Lisp, here's a start:

; Get corner points
(Setq p2 (Getcorner (Setq p1 (Getpoint))))
;Make selection set, here the Circles kind
(Setq ss-circles (ssget "W" p1 p2 '((0 . "CIRCLE")))
;Use AutoCAD command CHANGE to switch layers
(Command "CHANGE" ss-circles "" "p" "LA" "CirclesLayer" "")
;Repeat for LINEs etc.

Have to break for a one Week vacation, someone else maybe can fill in the blanks for Lines etc.

Hth, kjellhensman

ASKER CERTIFIED SOLUTION
Avatar of RomMod
RomMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial