motee-z Posted June 25, 2015 Share Posted June 25, 2015 Hello friends I want help to Align vertices of polyline on another one and mark this vertices as in attached drawing thanks alignpoly.dwg Quote Link to comment Share on other sites More sharing options...
CAD89 Posted June 27, 2015 Share Posted June 27, 2015 Hello motee-z, here you go: (defun c:proftodist (/ sourcepl targetpl vlpl polydata verli hdist cnt pointlst) (vl-load-com) (setq sourcepl (car (entsel "\nSelect source polyline: ")) ; Get source polyline targetpl (car (entsel "\nSelect target polyline: ")) ; Get target polyline vlpl (vlax-ename->vla-object targetpl) ; Convert target polyline data to vla-object polydata (entget sourcepl) ; Get source polyline data verli (list) ; Define an empty list for vertices ) (foreach v polydata ; Append vertices from source polyline (if (= 10 (car v)) (setq verli (append verli (list (cdr v)))) ) ) (setq verli (vl-sort verli (function (lambda (x1 x2) (< (car x1) (car x2)))) ) ; Sort vertices in ascending order on x axis hdist (list) ; Create an empty list for horizontal distances cnt 0 ) ; Set up a counter (while (/= cnt (1- (length verli))) ; Append cumulated horizontal distances (if (= cnt 0) (setq hdist (append hdist (list (- (car (nth (1+ cnt) verli)) (car (nth cnt verli)))) ) ) (setq hdist (append hdist (list (+ (- (car (nth (1+ cnt) verli)) (car (nth cnt verli))) (last hdist) ) ) ) ) ) (setq cnt (1+ cnt)) ) (setq pointlst (list)) ; Create an emplty list for the resulting vertices (foreach d hdist (setq pointlst (append pointlst (list (vlax-curve-GetpointatDist vlpl d)))) ) (foreach p pointlst ; Create the points along the target polyline (entmake (list '(0 . "POINT") '(100 . "AcDbEntity") '(62 . 256) (cons 8 "markchainage") '(100 . "AcDbPoint") (cons 10 p) ) ) ) (princ) ) Let me know if this is what you are looking for! With regards CAD89 Quote Link to comment Share on other sites More sharing options...
motee-z Posted June 27, 2015 Author Share Posted June 27, 2015 thanks cad89 for your reply thats good job but can be creat polyline with vertices in addition to points thanks 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.