Thonyb Posted June 27 Posted June 27 (edited) 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 Edited June 27 by SLW210 Added Code Tags! Quote
SLW210 Posted June 27 Posted June 27 Please use Code Tags for your code. (<> in the editor toolbar) There are a few break LISPs around. Quote
BIGAL Posted June 27 Posted June 27 (edited) 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 June 27 by BIGAL Quote
SLW210 Posted June 28 Posted June 28 "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) 1 Quote
Thonyb Posted June 28 Author Posted June 28 Thank you so much guys for everything. The "BreakObjects.lsp" by marko_ribar worked just like I wanted ! Quote
Recommended Posts
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.