Jump to content

need help with lisp to break ployline with blocks


Recommended Posts

Posted (edited)

Hi.

is it possible to to break a line\polyline with blocks inserted on to it at every block insetion point?

the idea is to select the line to be broken and then select the blocks to break the line by them.

I've attached a sample drawing.

thanks,

ADZ

break poly with blocks.dwg

 

EDIT:

I got the answer:

I have this lisp that break a polyline with many line objects and I've added INSERT in to the selection line:

 

;;==========================================
;;  Break a single object with many objects 
;;==========================================
(defun c:BreakObject (/ cmd ss1 ss2)

  (command "._undo" "_begin")
  (setq cmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)

  ;;  get objects to break
  (prompt "\nSelect single object to break: ")
  (if (and (setq ss1 (ssget "+.:E:S" '((0 . "LINE,ARC,SPLINE,LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE"))))
           (not (redraw (ssname ss1 0) 3))
           (not (prompt "\n***  Select object(s) to break with & press enter:  ***"))
           (setq ss2 (ssget '((0 . "LINE,ARC,SPLINE,LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE,POINT,INSERT"))))
           (not (redraw (ssname ss1 0) 4)))
     (Break_with ss1 ss2 nil) ; ss2break ss2breakwith (flag nil = not to break with self)
  )

  (setvar "CMDECHO" cmd)
  (command "._undo" "_end")
  (princ)
)

 

Edited by aridzv
Posted

I am glad you found a solution by yourself but in your code there's no (break_with function, could you please post it.

Thanks 

Posted (edited)
2 hours ago, Isaac26a said:

I am glad you found a solution by yourself but in your code there's no (break_with function, could you please post it.

Thanks 

Hi.

see the attached lsp file,credit to Charles Alan Butler (the original author).

ADZ

breakall.lsp

Edited by aridzv
Posted

I'm currently figuring this out myself. It's possible to do if you ssget your blocks sequentially along the polyline, otherwise the code gets messy. 

 

(foreach blk (LM:ss->list (ssget))	;; your blocks selection
	(setq pt (cdr (assoc 10 (entget blk))))
	(command "_BREAK" pline pt pt)
    (setq pline (entlast))
)

 

you can find LM:ss->list in Lee Mac's website: Selection set to list

 

I haven't seen the BreakAll function yet. maybe I can use that. Thanks for sharing.

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