reza Posted July 11, 2016 Posted July 11, 2016 Dear Every one, I have a problem with CAD and I was hoping you could help me out with it. As part of a work, there is this polygon whose all sides are single polylines; This polygon also surrounds several points which are supposed to be assigned to one of these polylines based on their distances (Point X will be assigned to Side Y /indicated by changing into a specific color/, if respective distance is the least amount among distances from all sides). I was wondering if there is a Routine or Lisp which can perform such a routine. I do appreciate your time and attention in advance. PS: Attached you can find a DWG as a sample of my work. Drawing2.dwg Quote
marko_ribar Posted July 11, 2016 Posted July 11, 2016 You need to set color and to green pipe LWPOLYLINE to be green like other SIDE LWPOLYLINES... Here test it on my DWG... (defun c:colptsbysidepolys ( / sslw sspts lwl dl ) (vl-load-com) (prompt "\nSelect colored LWPOLYLINE entities - SIDES...") (setq sslw (ssget '((0 . "LWPOLYLINE")))) (prompt "\nSelect inside POINT entities to color them by SIDES...") (setq sspts (ssget '((0 . "POINT")))) (foreach pt (vl-remove-if 'listp (mapcar 'cadr (ssnamex sspts))) (foreach lw (setq lwl (vl-remove-if 'listp (mapcar 'cadr (ssnamex sslw)))) (setq dl (cons (distance (cdr (assoc 10 (entget pt))) (vlax-curve-getclosestpointto lw (cdr (assoc 10 (entget pt))))) dl)) ) (setq dl (reverse dl)) (setq dl (vl-sort-i dl '<)) (entupd (cdr (assoc -1 (entmod (if (assoc 62 (entget pt)) (subst (cons 62 (cdr (assoc 62 (entget (nth (car dl) lwl))))) (assoc 62 (entget pt)) (entget pt)) (append (entget pt) (cons 62 (cdr (assoc 62 (entget (nth (car dl) lwl))))))))))) (setq dl nil) ) (princ) ) Regards... Drawing2.dwg Quote
reza Posted July 26, 2016 Author Posted July 26, 2016 Dear marko_ribar this thread is only to inform you that i have found your comments useful and of course effective. i do appreciate your time and concern sincerely Reza Monemi Quote
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.