aaryan Posted July 3, 2012 Share Posted July 3, 2012 Hi all, As i am new to the programming my skill is too less to sort out my problem and after a lot of try (with no success) i came to you all. Just give me a hint. I have a polyline (Route) drawn with the circles (location) besides it. Just want to know how can i sort those circles as if it is a right hand side of polyline (positive) and if it is a left hand side of polyline (negative). Attach drawing is a reference to understand. Sample.dwg Please give me a solution. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted July 3, 2012 Share Posted July 3, 2012 This could be a start for you (defun C:TEST ( / cross_prod ss1 ss2 e1 e2 p1 p2 i v tg) (defun cross_prod (a b) (list (- (* (cadr a) (caddr b)) (* (caddr a) (cadr b))) (- (* (caddr a) (car b)) (* (car a) (caddr b))) (- (* (car a) (cadr b)) (* (cadr a) (car b))) ) ) (if (and (setq ss1 (ssget ":E:S" '((0 . "LWPOLYLINE,SPLINE")))) (setq ss2 (ssget '((0 . "CIRCLE")))) ) (progn (setq e1 (ssname ss1 0)) (repeat (setq i (sslength ss2)) (setq e2 (ssname ss2 (setq i (1- i))) p2 (cdr (assoc 10 (entget e2))) p1 (vlax-curve-GetClosestPointTo e1 p2) v (mapcar '- p1 p2) tg (vlax-curve-GetFirstDeriv e1 (vlax-curve-GetParamAtPoint e1 p1)) ) (vla-put-Color (vlax-ename->vla-object e2) (if (minusp (caddr (cross_prod v tg))) acRed acYellow)) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
aaryan Posted July 3, 2012 Author Share Posted July 3, 2012 Thank You So Much Stefan BMR. Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted July 3, 2012 Share Posted July 3, 2012 You're welcome. FWIW, also works on line, circle, arc and ellipse Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.