Following a bug report from over at CADTutor, I have updated the code in the first post to Version 2.8
However I cannot seem resolve a bug in which the user aligns 'object A', then aligns 'object B' to the same curve.
Then, if the user realigns 'object A' to the same curve again, 'object B' is used
Any advice on this bug is welcome.
Lee
First time I look at your coding style.
Did a quick review to your code, and the problem appears to be in this segment and in there it is flipping the handles - don't have much time to look in deep:
(foreach obj (vlr-owners *DCurve$Align$Reactor*)
(if (not (vlax-erased-p obj))
(progn
(vla-GetXData obj app 'typ 'val)
(if (and typ val)
(progn
(setq xDat (vl-remove-if-not
(function
(lambda (lst)
(entget (handent (car lst)))))
(read
(vlax-variant-value
(cadr
(vlax-safearray->list val))))))
(if (vl-position Hnd (mapcar (function car) xDat))
(progn
(putxDat obj app
(vl-prin1-to-string
(vl-remove-if
(function
(lambda (x) (eq Hnd (car x)))) xDat))))))))
(vlr-owner-remove *DCurve$Align$Reactor* obj)))
It might a good idea to place some temp string tags to display the first value, the second and third one, to verify your findings like:
( (eq 'ENAME (type rslt))
(setq *Mac$Str* (vla-get-TextString
(setq tObj (vlax-ename->vla-object rslt)))
tSze (vla-get-Height tObj)
Hnd (vla-get-Handle tObj))
(princ "\nHandle selected: ")
(princ Hnd) (princ)
And here:
(princ (setq msg (strcat "\n[+] or [-] for [O]ffset, [P]erpendicularity Toggle"
"\n[M]irror Text, [S]tyle Settings"
(if (eq "AcDbText" oNme) "" ", [B]ackground Mask"))))
(setq handleStart (vla-get-handle tObj))
(princ "\nBefore while: ")
(princ handleStart) (princ)
(while
(progn
(setq gr (grread t 15 0) code (car gr) data (cadr gr))
And:
( (= 25 code) nil)
(t ))))
(setq handleEnd (vla-get-handle tObj))
(princ "\nEnd of while: ")
(princ handleEnd) (princ)
(vla-EndUndoMark doc)
(redraw)
And if I may.-
1. I see that you want to keep all code clean and formatted, but I won't place my general functions inside of my main one and even in between important calls it is break by a place of a function, I know it is a preference style, but outside can be more useful, just use your own prefix_ to mark it.
2. Why call or set at the end your local variables to nil? if that it is done by autolisp ?
Hope that you won't mind, my 0.0002 cts.