leonucadom Posted 12 hours ago Posted 12 hours ago hello : I'm wondering if this command can be used from lsp, as I'd like to interact with it. for example by giving the default size and position of the break symbol Any information you have is welcome. thanks Quote
Emmanuel Delay Posted 1 hour ago Posted 1 hour ago (edited) Command CBL: puts the Breakline symbol 4.0 units from the start, the breakline symbol is 1.0 units wide, and the tip is 0.4 units up or down the line. Obviously feel free to change those values. command CBLU: Same, except the user must give all the values. ;; Custom Breakline ;; @params ;; ps: start point ;; pe: end point ;; gap: gap between the two halves of the lines ;; loc: location of the center of the gap ;; tip: vertical size of the tip of the breakline symbol (default there's is 70° angle, but we'll give tip size) (defun CustomBreakLine ( ps pe gap loc tip / angl dst pline pl pd pm pu pr ) (setq angl (angle ps pe)) ;; angle (setq dst (distance ps pe)) ;; distalce of the line (without the breakline symbol) (setq pm (polar ps angl loc)) ;; mid point of the gap (setq pl (polar ps angl (- loc (/ gap 2.0)))) ;; left point of the breakline symbol (setq pr (polar ps angl (+ loc (/ gap 2.0)))) ;; right point of the breakline symbol ;; down tip of the breakline symbol (setq pd1 (polar pl angl (/ gap 4.0))) (setq pd (polar pd1 (- angl (d2r 90.0) ) tip)) ;; up tip of the breakline symbol (setq pu1 (polar pm angl (/ gap 4.0))) (setq pu (polar pu1 (+ angl (d2r 90.0) ) tip)) (setq pl (drawLWPoly (list ps pl pd pu pr pe) 0)) ) ;; degree to rad (defun d2r (d / ) (/ (* pi d) 180.0) ) ;; Returns the middle of two points (defun mid-pt (p1 p2) (polar p1 (angle p1 p2) (/ (distance p1 p2) 2.) ) ) ;; makes a polyline object with entmakex (defun drawLWPoly (lst cls) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) (cons 70 cls)) (mapcar (function (lambda (p) (cons 10 p))) lst))) ) ;;;;;;;;;;; ;; Custom BreakLine, User input values (defun c:cblu ( / ps pe gap loc tip ) (CustomBreakLine (setq ps (getpoint "\nStart pont: ")) (setq pe (getpoint ps "\nEnd pont: ")) (setq gap (getdist "\nGap distance: ")) (setq loc (getdist "\nLocation of the gap center (enter value, or select two points: start point + point of the gap): ")) (setq tip (getdist "\nTip height: ")) ) (princ) ) ;; Custom BreakLine, preset values (defun c:cbl ( / ps pe gap loc tip ) (CustomBreakLine (setq ps (getpoint "\nStart pont: ")) (setq pe (getpoint ps "\nEnd pont: ")) (setq gap 1.0) (setq loc 4.0) (setq tip 0.4) ) (princ) ) (princ "\nCommand CBL for Custom BreakLine: ") (princ) Happy with this? Edited 1 hour ago by Emmanuel Delay 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.