Jump to content

Q. vl-sort without removing (& a for loop question)


Recommended Posts

Posted

Hey,

 

The first question (EDIT) was my mistake which ronjonp brought to light.

 

The second question I have is alternatives to for loops. I frequently have a list of entities/objects where I want to find objects with two or more particular properties. This I can achieve with a few for loops, one for each property but it seems messy. I was trying to think of other ways and I thought of using vl-position and this will work if there's only one object I'm after:

(setq obj (nth (vl-position '<something> (mapcar 'vla-get-<something> objlst)) objlst)

Have you got any better ways of finding multiple objects that have multiple properties in a list of objects?

 

Ofcourse the best alternative is the quickest. I'm assuming ssget is the quickest filter and I will use that initially.

Posted

Will this not work for you?

 

(vl-sort yourpointlist (function (lambda (x1 x2) (> (car x1) (car x2)))))

Posted

Hi, thanks for replying. Your right! I'm sorry my mistake, it is somewhere else in my code I am losing entities. I automatically assumed vl-sort was the culprit.

 

 

 

If anyone can help with my other question that'd be great.

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...