Jump to content

LISP for breaking multiple polyline at 'insertion point' of multiple Blocks (AUTOCAD 2026)


Recommended Posts

Posted

I have multiple blocks(10 to 20) placed on multiple polylines in my map. I need to break the polylines of a huge map at the insertion point and join the vertices at the insertion point of the block.
Is there any LISP available to break the polylines exactly at the insertion point ?
I saw LEE MAC's LISP does something similar, but it trims the polylines at the border of the blocks. Shown in the picture (LEE MAC written)

image.png

image.png

image.png

Posted (edited)

Something like this!?

 

; *****************************************************************************************************
; Functions     :  PLBRJ
; Description   :  Breaking POLYLINE at blocks insertation points and joined into the one POLYLINE
; Author        :  Saxlle
; Date          :  January 19, 2026
; *****************************************************************************************************

(prompt "\nTo run a LISP type: PLBRJ")

(princ)

(defun c:PLBRJ ( / ent joinList ptlist ss len spt ept i breakPoint)
 
  (setq ent (car (entsel "\nSelect the POLYLINE:"))
	joinList (list)
	ptlist (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent)))
	ss (ssget "_F" ptlist (list (cons 0 "INSERT")))
	len (sslength ss)
	spt (vlax-curve-getStartPoint (vlax-ename->vla-object ent))
	ept (vlax-curve-getEndPoint (vlax-ename->vla-object ent))
	joinList (append (list spt) joinList)
	i 0
	)
  
  (while (< i len)
    
    (setq breakPoint (cdr (assoc 10 (entget (ssname ss i)))))
    
    (command "_.BREAK" breakPoint "_f" breakPoint breakPoint)
    
    (setq joinList (append (list breakPoint) joinList))
    
    (setq i (1+ i))
    
    )
  
  (setq joinList (reverse (append (list ept) joinList))
	ss (ssget "_F" joinList (list (cons 0 "LWPOLYLINE")))
	)
  
  (command-s "_PEDIT" "m" ss "" "j" "" "")
  
  (prompt "\nThe POLYLINE was broken at blocks insert points and joined into the one POLYLINE!")
  
  (princ)
  
  )

 

image.thumb.png.4b26a503fbf3ba84591e31da665e523d.png

Edited by Saxlle
Something strange is happening. Don't use it.

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...