The way to reorder

The way to reorder

Anonymous
Not applicable
2,118 Views
15 Replies
Message 1 of 16

The way to reorder

Anonymous
Not applicable

Hello Community, Happy New Year.

 

Are there some ways to reorder objects?

I mean that I will select the number of objects at the same time and then work it whatever in REPEAT lisp function.

But the selected objects in Repeat works sequentially by creation order.

I want to reorder it.

 

Could you give me some examples or show me the ways?.

 

0 Likes
Accepted solutions (1)
2,119 Views
15 Replies
Replies (15)
Message 2 of 16

cadffm
Consultant
Consultant

"But the selected objects in Repeat works sequentially by creation order."

By creation-order only if you dont used a specific selection-order (for example you used a windows-selection with multiple objects),

if you select only one by one (even which selection mode), the selectionset stores your selection-order.

 

"I want to reorder it."

What do you really mean with that? For what do you want that?

 

Re-order, if you like to change the creation order, the only way is to create object NEW.

So, if you used windows-selection (for example), which order should acad knew you want?

 

Or do you talk about the drawORDER? But the question is the same, the answer possible not.

Sebastian

Message 3 of 16

Anonymous
Not applicable

The only way is to create "New". << This is What I'm Looking for.

But I have many lines to use in Lisp.

To create lines again as new, Do you have ideas?.

0 Likes
Message 4 of 16

cadffm
Consultant
Consultant

Ok, you talk about reorder the creation-order, the answer is to create the objects new in the order you want.

 

"Do you have ideas?." -> vla-copy or entmake and delete the source objects

 

But this can not the only problem here.

 

So, if you used windows-selection (for example), how should acad knew which order you want?

 

 

(if (setq ss (ssget)) ; select objects by pick-selection

    (foreach i (mapcar 'cadr (ssnamex ss))

        (if (= 'ename (type i))

            (progn (entmake (entget i)) (entdel i))

        )

    )

)

Sebastian

Message 5 of 16

Ranjit_Singh
Advisor
Advisor

I agree with @cadffm. I cannot possibly think of any function where you would want the repeat loop to follow a certain sequence. If the entity is a simple entity then you can use entmakex below to create a new one.

(entmakex (entget entityename))

This creates a new entity which should now be entlast. Then you can delete old one

(entdel entityename)

 

Message 6 of 16

john.uhden
Mentor
Mentor

What @Ranjit_Singh offered in post #5 is the best direct answer..  It is the same as what I used to do before DRAWORDER came along.

But I doubt that you really want to "reverse" the order.  It should be a conscious choice of what to make "newer" whether using DRAWORDER or copy and delete.  I used to call it the ham and cheese sandwich approach.  Do you want the cheese on top of the ham or vice versa?

Okay, maybe that's a bad analogy since I doubt that Jersey Mike's uses AutoCAD to design its submarine sandwiches.  But you probably want text on top of hatches, for example.  With that in mind, you might want to develop a company standard using layers and disregarding the order in which individual entities are created.

Which reminds me of my LAYERORDER.lsp command to do just that, in bulk...

 

LayerOrder.jpg

John F. Uhden

0 Likes
Message 7 of 16

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

The only way is to create "New". << This is What I'm Looking for.

But I have many lines to use in Lisp.

To create lines again as new, Do you have ideas?.


I'm still not sure what you're after.  By "lines," do you mean AutoCAD Line entities?  If so, do you want to select many of them and simply make them all newer than everything else in the drawing, ignoring the order among themselves?  If so, and if the selection is saved to a 'ss' variable:

 

(command "_.copy" ss "" "0,0" "0,0" "_.erase" "_previous" "")

 

If re-ordering is supposed to be within or among the selected objects, we would need to know more about how the order is to be determined, before we can really suggest anything useful.

Kent Cooper, AIA
Message 8 of 16

ActivistInvestor
Mentor
Mentor

@Ranjit_Singh wrote:

I agree with @cadffm. I cannot possibly think of any function where you would want the repeat loop to follow a certain sequence. If the entity is a simple entity then you can use entmakex below to create a new one.

(entmakex (entget entityename))

This creates a new entity which should now be entlast. Then you can delete old one

(entdel entityename)

 


Trying to copy an entity via (entmake (entget/x ...)) is what led to millions of corrupt drawing files (with the infamous "multiply-owned object" errors that are detected by AUDIT). If ignored, the drawing eventually becomes partially or entirely unrecoverable.

 

You cannot copy an entity via that means, for at least three major reasons. First, if the entity being copied has an extension dictionary, the extension dictionary is a separate object unto itself, which does not get copied when you copy the entity that owns it using entget/entmake. So, the result of (entmake (entgetx ...)) on an object with an extension dictionary is two entities that both own the same extension dictionary, which means the drawing is corrupt, and will only get worse if it is ignored.

 

Second, attempting to copy an entity using entget+entmake does not always produce an exact copy. For example, a non-existent color in the result of (entget) means the entity's color is BYLAYER. If you pass that same list unmodified to (entmake) without a color group, (entmake) interprets that to mean use the current value of CECOLOR , not BYLAYER. Ditto for linetypes, etc.

 

Thirdly, many custom objects from AutoCAD verticals do not fully-support (entmake) and do not always render a complete representation of themselves via (entmake). Entget and Entmake are essentially a way to do a DXFOUT and DXFIN, on an object-by-object basis. Custom objects from verticals do not support DXF any longer, so trying to copy them using entget+entmake may not always be possible.

 

You can use vla-Copy or vla-CopyObjects (or the COPY command) to correctly and safely copy one or more entities.

 

There are various other problems that will result from trying to do your own draworder by copying and deleting. For example, we have what are known as "inter-object references", which is where one or more entities have a reference to another object stored in their data (or their extension dictionary). A familiar example is a field that references the area of a polyline or other closed curved. The field object (which is in an extension dictionary that would not be copied by entget/entmake) holds a reference to the polyline whose area it displays. When you try to copy the polyline and delete the original, the field now references a deleted object. That would not happen if you used the COPY command, or vla-CopyObjects, and both the field and the polyline it references were copied together. In that case, the resulting copy of the field will reference the resulting copy of the polyline.

 

That's just a few of many problems with trying to use entgetx and entmake to copy objects, and copying and erasing to establish draw-order. If possible, use AutoCAD's DRAWORDER functionality, since you're paying the price for it (in terms of performance) anyways.

 

 

Message 9 of 16

john.uhden
Mentor
Mentor

I hope I'm not offending you, but I agree that copying is totally better than entmaking in this situation.

John F. Uhden

0 Likes
Message 10 of 16

john.uhden
Mentor
Mentor

I forgot to mention that I grew up with the original Mike's Submarines in Point Pleasant, NJ.  Mike Sorrento, and his main submariners Mickey, Claude, and Bob Morris had a thriving business, with the waiting line going out the door, down the street, and around the corner.  A #1 (now a #11 not on the menu) went for $0.50.  Looking to retire, Mike sold the business to one of his later assemblymen who incorporated it as Jersey Mike's with franchises all over the US.  Bob Morris followed in his father's footsteps and grew up to be a Land Surveyor.  I helped him with his AutoCAD/DCA/Softdesk/Land Desktop setup for decades.  My favorite was that they sold Briar's Bark Brewed Birch Beer bottled by the Best Brand Beverage Corporation (no longer in existence today).

John F. Uhden

0 Likes
Message 11 of 16

ActivistInvestor
Mentor
Mentor

Back in the '90's we used to pick up 3 or 4 subs at Mikes late in the day, before heading out of the Manasquan at 2:00 AM in our 29 BlackFin. I usually put away a half a sub on the way out to the Mud Hole.

 


@john.uhden wrote:

I forgot to mention that I grew up with the original Mike's Submarines in Point Pleasant, NJ.  


 

 

0 Likes
Message 12 of 16

john.uhden
Mentor
Mentor

If it was the 90's you probably went to one of the franchise stores, either on Route 70, or up by Blockbuster on Route 35, immediately north of the A&P (which is now an Acme).  The world is kinda tiny, eh?  Did you ever get a burger and dog from Pete Skokos' in Point Beach?  It's gone now, replaced by condos after grandson Bobby got sick of the work and sold it and retired.  My father had sold the property with building to Pete in 1941.  Boy how I miss that place.  They had the best Manhattan clam chowder too.

John F. Uhden

0 Likes
Message 13 of 16

ActivistInvestor
Mentor
Mentor

@john.uhden wrote:

If it was the 90's you probably went to one of the franchise stores, either on Route 70, or up by Blockbuster on Route 35, immediately north of the A&P (which is now an Acme).  The world is kinda tiny, eh?  Did you ever get a burger and dog from Pete Skokos' in Point Beach?  It's gone now, replaced by condos after grandson Bobby got sick of the work and sold it and retired.  My father had sold the property with building to Pete in 1941.  Boy how I miss that place.  They had the best Manhattan clam chowder too.


We've gotten them from several locations, including the one on 35, but I wasn't the only one that picked up. Others in the party would get them when it was their turn to buy, and I think one of the guys that came from up from the south went to one in or near Point Pleasant.  Never got burgers in Point Beach. After a long day we were pretty tired, so as soon as got in, we'd often just tie up at the docks outside one of the places on the river (Red's Lobster Pot, Jack Baker's, Spike's or Harpoon Willy's). If we had a good day (there were no limits back then), we'd sometimes barter our excess catch for a good meal at one of those places. Sometimes we'd drive up to Tony's Cheese Steaks in Asbury Park, I was also a big fan of Fratelli's Pizza in Red Bank, The Wind Mill, and a few other local spots.

0 Likes
Message 14 of 16

john.uhden
Mentor
Mentor

Ah.  The Jersey Shore is the best.  In spite of the ridiculous property taxes I don't see how I could ever move away.  In fact, after 22 years away, we are rejoining the Manasquan River Yacht club.  I used to sail Barnegat Bay Sneakboxes and M Scows and did my time as Treasurer, Rear Commodore, and Vice Commodore, but I just learned that these days they have a growing fleet of Sunfishes.  Plus I think there's a decent fleet of them down the Bay.  Thery're cheap, easy to car-top, and get up on a good plane on a breezy reach.  And like a Laser, if you tip one over you can pop it back up and keep on racing.

John F. Uhden

0 Likes
Message 15 of 16

Anonymous
Not applicable

I agree to decide order to create Line again.

But The order that I want to set is both complicate and difficult to say.

I need more time to explain.

Thank you for following way.

 

0 Likes
Message 16 of 16

john.uhden
Mentor
Mentor

Take your time and gather your thoughts.  We've seen plenty of complicated situations before.  It's just another challenge to conquer.

The more you put into it, the more you will get out of it.

John F. Uhden