Better yet use a block with a mask and draw your lines to the insertion points :wink:The drawings are from other software, because the diameter of the circle is fixed at the beginning, and the later labor needs to modify the diameter of the circle to make the line extend and cut.
; defun trim inside circles
; By Alan H May 2019 AlanH Consulting
; www.alanh.com.au
(defun aH:trimcircles (/ ss ang rad oldsnap oldaunits obj lay)
(setq oldsnap (getvar "osmode"))
(setq oldaunits (getvar 'aunits))
(setq lay (cdr (assoc 8 (entget (car (entsel "Pick circle"))))))
(setq ss (ssget (list (cons 0 "Circle") (cons 8 lay))))
(setvar 'osmode 0)
(setvar 'aunits 3)
(repeat (setq x (sslength ss))
(setq obj (entget (ssname ss (setq x (- x 1)))))
(setq rad (cdr (assoc 40 obj)))
(setq cenpt (list (nth 1 (assoc 10 obj)) (nth 2 (assoc 10 obj))))
(setq ent (cdr (assoc -1 obj)))
(setq rad (- rad 3))
(setq lst '())
(setq ang 0.0)
(repeat 10
(setq lst (cons (polar cenpt ang rad) lst))
(setq ang (+ ang 0.62831853))
)
(command "trim" ent "" "fence")
(while (= (getvar "cmdactive") 1)
(repeat (setq y (length lst))
(command (nth (setq y (- y 1)) lst))
)
(command "" "")
)
)
(setvar 'osmode oldsnap)
(setvar 'aunits oldaunits)
)
(aH:trimcircles)
(defun c:trci () (aH:trimcircles))
Nice 8-)Code - Auto/Visual Lisp: [Select]
Thanks,roy_043!Code - Auto/Visual Lisp: [Select]
(defun KGA_Conv_Pickset_To_ObjectList (ss / i ret)
(if ss
(repeat (setq i (sslength ss))
(setq ret (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ret))
)
)
)
(vl-load-com)
(defun c:Test ( / cen cirLst doc linLst radNew radOld ss)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vla-endundomark doc)
(vla-startundomark doc)
(if
(and
(setq ss (ssget '((0 . "LINE,CIRCLE"))))
(setq radNew (getreal "\nNew radius: "))
)
(progn
(foreach obj (KGA_Conv_Pickset_To_ObjectList ss)
(if (= "AcDbLine" (vla-get-objectname obj))
(setq linLst
(vl-list*
(list (vlax-get obj 'startpoint) T obj)
(list (vlax-get obj 'endpoint) nil obj)
linLst
)
)
(setq cirLst (cons obj cirLst))
)
)
(foreach cir cirLst
(setq cen (vlax-get cir 'center))
(setq radOld (vla-get-radius cir))
(vla-put-radius cir radNew)
(foreach sub linLst
(if (equal radOld (distance cen (car sub)) 1e-8)
(progn
(vlax-put
(caddr sub)
(if (cadr sub) 'startpoint 'endpoint)
(vlax-curve-getclosestpointto cir (car sub))
)
(setq linLst (vl-remove sub linLst))
)
)
)
)
)
)
(vla-endundomark doc)
(princ)
)
But some CAD is a streamlined version, and a VL-function needs to add a line of code when it runs.Code - Auto/Visual Lisp: [Select]
But some CAD is a streamlined version, and a VL-function needs to add a line of code when it runs.Code - Auto/Visual Lisp: [Select]
That is really nit-picking. Most people who run customisation have the function call in one of theit start-up files.