Jump to content

split polyline help...


leonucadomi

Recommended Posts

hello:

I wonder if there is a routine for this?

I have a closed polyline like this

image.png.9a976a3dd6ce7fdfad8819d50d6460e9.png

1.- I would like a routine that asks me for point pt1 and then point pt2

2.-after it asks me for the number of divisions (example 8)

3.- and draw the following...

image.png.a7ba4af53f511bd9b45806bd1ac60b72.png

 

any comment?

thanks

 

 

Link to comment
Share on other sites

13 hours ago, leonucadomi said:

hello:

I wonder if there is a routine for this?

I have a closed polyline like this

image.png.9a976a3dd6ce7fdfad8819d50d6460e9.png

1.- I would like a routine that asks me for point pt1 and then point pt2

2.-after it asks me for the number of divisions (example 8)

3.- and draw the following...

image.png.a7ba4af53f511bd9b45806bd1ac60b72.png

 

any comment?

thanks

 

 

@leonucadomiPlease upload  your sample.dwg

 

Link to comment
Share on other sites

Hi devitg maybe use Xline for the temporary line working out the second point on the ellipse. It auto extends to infinity.

  • Thanks 1
Link to comment
Share on other sites

I found this and it is close to what I need but I would like to modify it so that it lets me select point 2 precisely

so that the grid you draw does not go outside the polyline

 

image.thumb.png.f02de55207a8378f94a5a55532534e3e.png

 

; By RonJonP found @ http://www.theswamp.org/index.php?topic=25575.0

(defun c:detailgrid (/ cnt coldiv columnpts columns ll lr p pt rowdiv rowpts rows ul ur)

 (defun addplineforgrid (pt1 pt2 layer /)
   (vla-update
     (vlax-ename->vla-object
(entmakex (list	'(0 . "LWPOLYLINE")
		'(100 . "AcDbEntity")
		(cons 8 layer)
		'(100 . "AcDbPolyline")
		'(90 . 2)
		'(43 . 0.0)
		(cons 10 pt1)
		(cons 10 pt2)
	  )
)
     )
   )
 )

 (defun rjp-vector_x (pt clr / l bl br ul ur)
   (setq l  (* 0.015 (getvar 'viewsize))
  bl (polar pt 3.926 l)
  br (polar pt -0.785 l)
  ul (polar pt -3.926 l)
  ur (polar pt 0.785 l)
   )
   (grvecs (list clr bl ur br ul))
   (princ)
 )

 (if (and (setq rows (getint "\nEnter number of rows: "))
   (setq columns (getint "\nEnter number of columns: "))
   (setq ul (getpoint "\nSelect upper left corner of grid: "))
   (not (or (<= rows 0) (<= columns 0)))
     )
   (progn
     (while (and (setq p (grread 5)) (= (car p) 5))
(redraw)
(if (setq lr (osnap (cadr p) "_end,_int,_mid,_cen"))
  (rjp-vector_x lr 1)
  (setq lr (cadr p))
)
(setq ur	(list (car lr) (cadr ul))
      ll	(list (car ul) (cadr lr))
      rowdiv	(/ (distance ul ll) rows)
      coldiv	(/ (distance ul ur) columns)
      columnpts	nil
      rowpts	nil
      cnt	0
)
(repeat	(1- rows)
  (setq	cnt (+ cnt rowdiv)
	pt  (polar ul (angle ul ll) cnt)
  )
  (repeat columns
    (setq rowpts (cons (list pt (setq pt (polar pt (angle ul ur) coldiv)))
		       rowpts
		)
    )
  )
  (grvecs (cons 3 (apply 'append rowpts)))
)
(setq cnt 0)
(repeat	(1- columns)
  (setq	cnt (+ cnt coldiv)
	pt  (polar ul (angle ul ur) cnt)
  )
  (repeat rows
    (setq columnpts (cons (list pt (setq pt (polar pt (angle ul ll) rowdiv)))
			  columnpts
		    )
    )
  )
  (grvecs (cons 5 (apply 'append columnpts)))
)
(grtext	-2
	(strcat "Row: " (rtos rowdiv) "  X  Column: " (rtos coldiv))
)
     )
   )
 )
 (redraw)
 (foreach x rowpts
   (addplineforgrid (car x) (cadr x) "gridline")
 )
 (foreach x columnpts
   (addplineforgrid (car x) (cadr x) "gridline")
 )
 (princ)
)

help please

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...