AutoCAD - Change the polyline into a rectangle of the same length(unroll polyline)

AutoCAD - Change the polyline into a rectangle of the same length(unroll polyline)

daivce
Explorer Explorer
3,477 Views
11 Replies
Message 1 of 12

AutoCAD - Change the polyline into a rectangle of the same length(unroll polyline)

daivce
Explorer
Explorer

Please forgive my poor English. Anyone can help me. I want to change the polyline into a rectangle of the same length. The height can be set freely .At the polyline intersection to form an inner rectangle. Thank you

 

[ The subject line of this post has been edited for clarity by @handjonathan Original: Change the polyline into a rectangle of the same length(unroll polyline) ]

0 Likes
3,478 Views
11 Replies
Replies (11)
Message 2 of 12

Kent1Cooper
Consultant
Consultant

I can't spend time on that now, but in case it gives anyone a start, I attach my StretchPolylinesStraight.lsp routine [command name: SPS].  That will give a basis for the red parts in your results, but getting the rest will be more of a challenge....

Kent Cooper, AIA
0 Likes
Message 3 of 12

nilesh.bhosale
Advocate
Advocate

i tested this but SPS lisp but it is not enough ....i need to identify only curves as i shown in my sample drawing i have many drawings so will this lisp get modify it  for only convert curves to horizontal lines with dimensions as shown in my sample drawing???

0 Likes
Message 4 of 12

Kent1Cooper
Consultant
Consultant

@nilesh.bhosale wrote:

i tested this but SPS lisp but it is not enough ....i need to identify only curves as i shown in my sample drawing i have many drawings so will this lisp get modify it  for only convert curves to horizontal lines with dimensions as shown in my sample drawing???


Go back to the other topic [where your sample drawing is].  Answer the question in Message 2.  And clarify what you mean by "identify" -- the sample drawing includes the line segment lengths in the straightened result, including dimensions, not just the curves.

Kent Cooper, AIA
0 Likes
Message 5 of 12

nilesh.bhosale
Advocate
Advocate

Identify means = when i will select polyline by using lisp.... then the lisp should generate rectangles equal to  curve length in horizontal position

 

PLEASE REFER ANOTHER SKETCH FOR BETTER UNDERSTANDING

0 Likes
Message 6 of 12

daivce
Explorer
Explorer

No, I need to form a rectangle at the top of a long polyline. The middle rectangle is a rectangle formed by the intersection of short lines and long polylines. Their lengths should be one-to-one

0 Likes
Message 7 of 12

Kent1Cooper
Consultant
Consultant

Looking back at this, I see a condition that could make it very difficult to develop a routine to do what you want.  Some of the "length" spaces are between independent single intersections of separate crossing Polylines with the "path" Polyline, but some of them are between two intersections of the same intersecting Polyline with the path.  Can the intersecting ones all be made to have the same kind of relationship to the path?

Kent Cooper, AIA
0 Likes
Message 8 of 12

schulz8NPAP
Advocate
Advocate

Hello,

could this be a step to sole your problem?

(Please notice, I used 3D-polylines, i.e. I changed the arcs into linear segmented 3d-polylines.)

Regards

Jochen

www.black-cad.de

0 Likes
Message 9 of 12

ВeekeeCZ
Consultant
Consultant

@nilesh.bhosale wrote:
 

Identify means = when i will select polyline by using lisp.... then the lisp should generate rectangles equal to  curve length in horizontal position

 

PLEASE REFER ANOTHER SKETCH FOR BETTER UNDERSTANDING

 

Try this. It should do the trick.

 

(vl-load-com)

(defun c:PlStraightening ( / i e p dl bl c)
  
  (if (and (setq e (car (entsel "\nSelect a polyline: ")))
	   (or (= "LWPOLYLINE" (cdr (assoc 0 (entget e)))) (prompt "\nNot a lwpolyline."))
	   (setq p (getpoint "\nPlace straightened profile: "))
	   )
    (repeat (setq i (1+ (fix (getpropertyvalue e "EndParam"))))
      (setq i (1- i)
	    dl (cons (vlax-curve-getdistatparam e i) dl)
	    bl (cons (getpropertyvalue e "Vertices" i "Bulge") bl))))
  
  (if dl (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(70 . 0) (cons 90 2))
			  (mapcar '(lambda (d) (list 10 (+ d (car p)) (cadr p)))
				  (list (car dl) (last dl))))))
  (setq c 0)
  (mapcar '(lambda (d1 d2 b)
	     (and (not (zerop b))
		  (setq ps (list (list 10 (+ d1 (car p)) (cadr p))
				 (list 10 (+ d1 (car p)) (+ 17000 (cadr p)))
				 (list 10 (+ d2 (car p)) (+ 17000 (cadr p)))
				 (list 10 (+ d2 (car p)) (cadr p))))
		  (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(8 . "0") '(90 . 4) '(70 . 1)) ps))
		  (entmake (list '(0 . "TEXT") '(10 0 0 0) (list 11 (+ (car p) d1 (/ (- d2 d1) 2))  (+ 17000 (cadr p))) '(40 . 12600) '(72 . 1) '(73 . 1)
				 (cons 1 (strcat "CURVE NO-" (itoa (setq c (1+ c)))))))))
	  dl (cdr dl) bl)
  (princ)
  )

 

0 Likes
Message 10 of 12

Kent1Cooper
Consultant
Consultant

Be aware that @nilesh.bhosale is not the originator of this Topic.  They were looking for something different from @daivce who originated this Topic.  They have their own Topic over >here<, asking for the same, where they have already accepted a Solution.

Kent Cooper, AIA
0 Likes
Message 11 of 12

daivce
Explorer
Explorer

Thanks,but it Missing function.

  erro: no function definition: GETPROPERTYVALUE

0 Likes
Message 12 of 12

Kent1Cooper
Consultant
Consultant

@daivce wrote:

Thanks,but it Missing function.

  erro: no function definition: GETPROPERTYVALUE


What version are you using?

Kent Cooper, AIA
0 Likes