handasa Posted June 5, 2017 Posted June 5, 2017 hello everyone ... i have a base reference polyline "the white one" and i want to draw another polyline along its path between two points p1 and p2 "the green one" ... any suggestions ... thanks in advance Quote
Lee Mac Posted June 5, 2017 Posted June 5, 2017 How should the program determine the length of the horizontal segments? Quote
handasa Posted June 5, 2017 Author Posted June 5, 2017 How should the program determine the length of the horizontal segments? the two points are selected by user manually ... Quote
Lee Mac Posted June 6, 2017 Posted June 6, 2017 the two points are selected by user manually ... Yes, but how should the program determine the lengths of the two green horizontal segments? The position of the vertical segment appears to be arbitrary. Quote
handasa Posted June 6, 2017 Author Posted June 6, 2017 Yes, but how should the program determine the lengths of the two green horizontal segments? The position of the vertical segment appears to be arbitrary. sorry i don't understand what you mean exactly ... but i can explain the procedure as follow ... the user will select a multi-vertex polyline and then prompted to select two points on this polyline the program should loop through the polyline verticies list and make a new list of verticies points which lies between the two selected points at last after this new list established it can be drawn as a polyline... .... there is a lisp made by curmudgeon this lisp draw a polyline between the intersection of two "lines" with the base polyline but it shows an error when the selection of two lines reversed (defun c:break_pline ( / plne l1 l2 pt_lst it nu_pt_lst nu_pline nu ) ;;;get the polyline and line 1 and line 2 (setq plne (entget (car (entsel "\n Pick your Polyline :"))) l1 (entget (car (entsel "\n Pick your first line to trim from :"))) l2 (entget (car (entsel "\n Pick your other line to trim from :"))) ) ;;;create a list of vertexes (foreach a plne (if (= (car a) 10) (setq pt_lst (append pt_lst (list (cdr a)))) ) ) ;;; remove points from list "before" first intersection (while (not (setq it (inters (list (car (nth 0 pt_lst))(cadr (nth 0 pt_lst)) 0.0 ) (list (car (nth 1 pt_lst))(cadr (nth 1 pt_lst)) 0.0 ) (cdr (assoc 10 l1))(cdr (assoc 11 l1)) ) ) ) (setq pt_lst (cdr pt_lst)) ) (setq pt_lst (subst (list (car it)(cadr it))(car pt_lst) pt_lst) ) ;;; only save points coming "before" second intersection ;;;(setq nu_pt_lst (list (car pt_lst))) (while (not (setq it (inters (list (car (nth 0 pt_lst)) (cadr (nth 0 pt_lst)) 0.0) (list (car (nth 1 pt_lst)) (cadr (nth 1 pt_lst)) 0.0) (cdr (assoc 10 l2)) (cdr (assoc 11 l2)) ) ) ) (setq nu_pt_lst (append nu_pt_lst (list (car pt_lst))) pt_lst (cdr pt_lst) ) ) (setq nu (append nu_pt_lst (list (car pt_lst)) (list (list (car it)(cadr it))))) ;;;remove old polyline (entdel (cdr (assoc -1 plne))) ;;;create new polyline (foreach a nu (setq nu_pline (append nu_pline (list (cons 10 a)))) ) (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") (assoc 8 plne) '(100 . "AcDbPolyline") (cons 90 (- (length nu) 1)) (assoc 70 plne) ) nu_pline ) ) ) Quote
Lee Mac Posted June 6, 2017 Posted June 6, 2017 If I've understood correctly, comment or remove lines 25-32 & 131-133 in this program. Quote
handasa Posted June 6, 2017 Author Posted June 6, 2017 (edited) If I've understood correctly, comment or remove lines 25-32 & 131-133 in this program. yes ... this worked like a charm ... thanks for your patience and your helpful assistance Mr. Lee ... one last question please ... how can the user alerted with the length of the newly created polyline ? Edited June 6, 2017 by handasa Quote
Lee Mac Posted June 6, 2017 Posted June 6, 2017 yes ... this worked like a charm ...thanks for your patience and your helpful assistance Mr. Lee Excellent - you're welcome. ... one last question please ...how can the user alerted with the length of the newly created polyline ? Simply select the newly created polyline and view the length in the Properties Palette. Quote
handasa Posted June 7, 2017 Author Posted June 7, 2017 Excellent - you're welcome. Simply select the newly created polyline and view the length in the Properties Palette. this lisp is a part of a large program that the length of the created polyline must be obtained during the processing of the program ... anyway ... so far so good ... iam very grateful to you and thanks again Quote
BIGAL Posted June 7, 2017 Posted June 7, 2017 Add thes two line just after making pline, (setq len (vla-get-length (vlax-ename->vla-object (entlast)))) (alert (strcat "Length of new line is " (rtos len 2 3))) Quote
handasa Posted June 7, 2017 Author Posted June 7, 2017 Add thes two line just after making pline, (setq len (vla-get-length (vlax-ename->vla-object (entlast)))) (alert (strcat "Length of new line is " (rtos len 2 3))) thanks Mr.Bigal ... this worked for me ... brilliant Quote
Batil Posted March 9, 2021 Posted March 9, 2021 Hello and good day! Can this be applied to multiple polylines? The user inputs would be as follows: 1. Pick 1st point 2. Pick 2nd point 3. Select polylines Please see attached photo. Quote
BIGAL Posted March 10, 2021 Posted March 10, 2021 I dont know how many of these you do but setting osnap to near and intersection then just do PLINE pick the points in order all done. Lots of coding time for a simple manual method. It took me longer to draw all the test lines than to do pline. Osmode 544 then PLINE 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.