Jump to content

BREAK AND SHORTEN (-LENGTHEN)


Thonyb

Recommended Posts

Hi guys,

 

Im new here and i've been searching and even asking chatgpt to help me out but it doesnt seem to work properly. Im working on a SLD (Single Line Diagram) for an electrical project and when wires cross on the diagram, it needs to have a gap on one of the 2 lines. I've tried this lisp command that ChatGPT gave me but with little to no success;

 

(defun c:BreakAndShorten ( / pt line break_length startpt1 endpt1 startpt2 endpt2)
  (setq break_length 2.5) ; Set your desired shorten length here (2.5 mm in this case)
  (setq line (car (entsel "\nSelect the line to break: ")))
  (setq pt (getpoint "\nSelect the break point: "))

  (if (and line pt)
    (progn
      (setq startpt1 (polar pt (angle pt (vlax-curve-getStartPoint line)) (- break_length)))
      (setq endpt1 pt)
      (setq startpt2 pt)
      (setq endpt2 (polar pt (angle pt (vlax-curve-getEndPoint line)) break_length))

      (command "BREAK" line startpt1 endpt2)
      
      (setq line1 (car (entsel "\nSelect the first segment to shorten: ")))
      (setq line2 (car (entsel "\nSelect the second segment to shorten: ")))
      
      (if line1 (command "LENGTHEN" "DE" (- break_length) line1))
      (if line2 (command "LENGTHEN" "DE" (- break_length) line2))
    )
    (alert "You must select a line and a break point.")
  )
  (princ)
)


 

In sum, I want to break one line at a point and then shorten the 2 segments by 2.5mm so it has a 5mm gap without using multiple command everytime

 

image.png.bb8eed0d6f6cbf0321c99dedee1aff85.png

Edited by SLW210
Added Code Tags!
Link to comment
Share on other sites

Please use Code Tags for your code. (<> in the editor toolbar)

 

There are a few break LISPs around.

Link to comment
Share on other sites

This has been asked before you can have jump overs or a gap, with a gap its better to use a wipeout or similar rather than break as pline etc is still continous then. Do a Google or a search here found some solutions. "show gap crossing lines autocad lisp"

Edited by BIGAL
Link to comment
Share on other sites

"Breakall.lsp" by CAB on the last post there is an update by 3dwannab

 

Here is an updated version by marko_ribar BreakObjects.lsp - Programs and Scripts - AutoCAD Forums (cadtutor.net)

 

As mentioned by BIGAL, there are some around for wipeouts and placing arcs, etc.

 

Here is a start as well as Lee Mac's Automatic Block Break | Lee Mac Programming (lee-mac.com)

  • Like 1
Link to comment
Share on other sites

Thank you so much guys for everything. The "BreakObjects.lsp" by marko_ribar worked just like I wanted !

 

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