TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: cmwade77 on July 12, 2018, 06:36:57 PM

Title: Sorting Issue
Post by: cmwade77 on July 12, 2018, 06:36:57 PM
Ok, I know I have to be missing something obvious, I want this to sort the text from the top down based on the order in the NoteTypes variable when using the "NT" command. I can't seem to find a way to do this yet.

Any help us greatly appreciated.

EDIT: I post and then I get it to work, but the text occasionally doesn't place correctly, any ideas?
Title: Re: Sorting Issue
Post by: CAB on July 12, 2018, 09:45:16 PM
Perhaps you should post an example of what fails to sort correctly.This keeps the reader form having to fully test your lisp.

Title: Re: Sorting Issue
Post by: roy_043 on July 13, 2018, 04:14:09 AM
After a cursory check I think this may be the problem:
You are using a counter to access a selection set.
The initial value of the counter is 0 and you are counting up.
But in the while loop you are deleting entities from the set. This causes indices to shift.
Example: if you delete the ct=2 item from the set its place will be occupied by what was the ct=3 item. And ct=3 will find what was the ct=4 item.

Counting down instead of up may be the solution.
Title: Re: Sorting Issue
Post by: cmwade77 on July 13, 2018, 11:31:43 AM
Perhaps you should post an example of what fails to sort correctly.This keeps the reader form having to fully test your lisp.
As I said, I got that part fixed. It is now the placement of the text doesn't go in the upper right corner.

If I can duplicate it, I am going to try and post what happens, but so far I can't get it to do it again, so go ahead and ignore for now, sorry about that.