leonucadom Posted 15 hours ago Posted 15 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 4 hours ago Posted 4 hours 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 4 hours ago by Emmanuel Delay Quote
Tsuky Posted 1 hour ago Posted 1 hour ago If I understood the request correctly... This could be a design start, it uses the oblique block of the dimension. (vl-load-com) (defun circle2lw (e / dxf_ent pt_cen radius fst_pt opp_pt) (setq dxf_ent (entget e) pt_cen (cdr (assoc 10 dxf_ent)) radius (cdr (assoc 40 dxf_ent)) fst_pt (polar pt_cen 0.0 radius) opp_pt (polar pt_cen pi radius) ) (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") (assoc 67 dxf_ent) (assoc 410 dxf_ent) (assoc 8 dxf_ent) (if (assoc 6 dxf_ent) (assoc 6 dxf_ent) '(6 . "BYLAYER")) (if (assoc 62 dxf_ent) (assoc 62 dxf_ent) '(62 . 256)) (if (assoc 370 dxf_ent) (assoc 370 dxf_ent) '(370 . -3)) (if (assoc 48 dxf_ent) (assoc 48 dxf_ent) '(48 . 1.0)) '(100 . "AcDbPolyline") '(90 . 2) '(70 . 1) (cons 43 0.0) (cons 38 (caddr fst_pt)) (if (assoc 39 dxf_ent) (assoc 39 dxf_ent) '(39 . 0.0)) (cons 10 (list (car fst_pt) (cadr fst_pt))) '(40 . 0.0) '(41 . 0.0) '(42 . 1.0) (cons 10 (list (car opp_pt) (cadr opp_pt))) '(40 . 0.0) '(41 . 0.0) '(42 . 1.0) (assoc 210 dxf_ent) ) ) (entdel e) (entlast) ) (defun c:Mybreak ( / ent obj_brk pt_brk vlaobj pr deriv alpha) (setvar "DIMBLK" "oblique") (while (setq ent (entsel "\nBreak point: ")) (setq obj_brk (car ent)) (cond ((member (cdr (assoc 0 (entget obj_brk))) '("POLYLINE" "LWPOLYLINE" "LINE" "ARC" "CIRCLE" "ELLIPSE" "SPLINE" "XLINE" "RAY")) (setq pt_brk (cadr ent)) (if (eq (cdr (assoc 0 (entget obj_brk))) "CIRCLE") (setq obj_brk (circle2lw obj_brk))) (setq vlaobj (vlax-ename->vla-object obj_brk)) (initget 1) (setq pt_brk (vlax-curve-getClosestPointTo vlaobj (trans pt_brk 1 0) nil ) pr (vlax-curve-GetParamAtPoint vlaobj pt_brk) deriv (vlax-curve-getFirstDeriv vlaobj pr) alpha (atan (cadr deriv) (car deriv)) ) (command "_.break" obj_brk "_none" pt_brk "_none" pt_brk) (initget 1) (command "_.-insert" "_oblique" "_scale" (distance (trans pt_brk 0 1) (getpoint (trans pt_brk 0 1))) (trans pt_brk 0 1) (angtos alpha (getvar "AUNITS") 13)) ) (T (princ "\nThis object can't be break!")) ) ) (princ) ) 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.