Jump to content

Alter draw order of selection set on different layers


cletero

Recommended Posts

Hi guys, here's the thing:

I have this LISP which draws objects in a specific order on two diferent layers. I have another LISP that needs to process the objects in the exact same order they were drawed, however, if I use select all, the selection set seems to contain all objects on LAYER1 first and then all objects on LAYER2. Is there any way around this?

 

Ex: I draw: obj1 on layer 2, obj2 and obj3 on layer1, then obj4 on layer2, obj5 and obj6 on layer1 and finally obj7 on layer 2. Select all returns list as (obj 6, 5, 3, 2, obj 7, 4, 1)

 

I know a selection set lists the last drawed object first, so I use a decreasing counter to overcome this, but am out of ideas regarding how to deal with the layers issue.

 

Thanks for any thoughts

Edited by cletero
Link to comment
Share on other sites

Sorry guys, got this figured out, I was drawing objects incorrectly, if someone can tell me how to delete this thread I would appreciate it very much.

Thanks.

Link to comment
Share on other sites

Hi Tharwat, although as I said I already solved the "draw order" issue I will try to explain my goal just in case you ofr someone else has a better approach to obtain the same results.

 

If you are familiar with gcode and CNC machines, what I'm try to do is generate toopaths that fill the inside of a polyline, generating a pocket inside it.

 

I start from a polyline which is offset to the inside until it can't be offset any more (the polyline is not neccesarily closed, but its start and end points are the same). Obviously, the CNC machine has to cut in reverse order, from the smallest offset to the biggest, this is easy to do, I just reverse the list of objects which where drawn by the offset, several lines are drawn in between to connect each offset and to connect the last offset with the first, as well as connecting each depth level of the pocket with the next. So far, I have achieved this.

 

Now, I have another program which will take each vertex of all the polylines and lines and write them to a file, hence generating the desired g-code. This program, however, must go through all the objects in the reverse order of how they were drawn. Now, turning all other layers off and using select all I have overcome this by using a backward counter on the selection set.

 

So, as conclusion, I have now been able to draw and process all objects in the correct order, but am afraid of things that might happen between the moment they are drawn and the moment they are processed that might alter things.

 

I attach a dwg of a tipical toolpath as an example.

example.dwg

Edited by cletero
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...