Struggling with multiple break lisp

Discussion in 'AutoCAD' started by Gordon Stephens, Nov 10, 2004.

  1. Hi there,

    Its been a while since I wrote any lisp, and I wasn't very good when I did,
    but I'm trying to write a multiple break utility as I often have to break a
    number or parallel lines at the same points. I know I'm trying to do
    something daft here, but I can't seem to find the appropriate hints in the
    help files.

    Here it is so far

    ;;;brkmultiple.lsp

    Code:
    (defun c:brkmultiple (/ selset bmpt1 bmpt2 count nme)
    (prompt "\nSelect parallel lines to break...")
    (setq selset (ssget))
    (prompt "\nPick first break point")
    (setq bmpt1 (getpoint))
    (prompt "\nPick second break point")
    (setq bmpt2 (getpoint))
    
    (setq count 0) ; set count to zero
    (if (/= selset nil)
    (while (< count (sslength selset)) ; while count < number of lines
    (setq nme (ssname selset count)) ; extract text string
    (command "break" (entget nme) "f" bmpt1 bmpt2)
    (setq count (1+ count)) ; go to next line
    ) ; end while
    ) ; end if
    
    (defun c:bm () (c:brkmultiple))
    (princ)
    )
    
    Any help would be gratefully received.

    TIA.
    Gordon Stephens.
     
    Gordon Stephens, Nov 10, 2004
    #1
  2. message <SNIP>

    Not too sure why I got absolutely no response whatsoever, maybe its not an
    interesting enough problem, but I found a solution that works so here it
    is - just in case anyone has the faintest inclination to look:-

    ;;;brkmultiple.lsp

    Code:
    (defun c:bm (/ selset bmpt1 bmpt2 count nme)
    (prompt "\nSelect parallel lines to break...")
    (setq selset (ssget))
    (prompt "\nPick first break point")
    (setq bmpt1 (getpoint))
    (prompt "\nPick second break point")
    (setq bmpt2 (getpoint))
    
    (setq count 0) ; set count to zero
    (if (/= selset nil)
    (while (< count (sslength selset)) ; while count < number of lines
    (setq nme (ssname selset count)) ;extract text string
    (command "break" nme bmpt1 bmpt2)
    (setq count (1+ count)) ; go to next line
    ) ; end while
    ) ; end if
    (princ)
    )
    
     
    Gordon Stephens, Nov 11, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.