Lisp to set circles at each end point on mutiple polylines and trim lines inside

Anonymous

Lisp to set circles at each end point on mutiple polylines and trim lines inside

Anonymous
Not applicable

Dears,

recently i have been started using the Lisps, and i need your help to make a Lisp to set circles at all lines\Arc's end  points for multiple Polylines(around 100 PLine) selected and trim the lines\Arc's inside the circles without deleting circles, lines, Arc's.

below is sample 

Autodesk AutoCAD 2017 - [SFG.jpg

 

 

regards

 

0 Likes
Reply
1,696 Views
6 Replies
Replies (6)

TerryDotson
Mentor
Mentor

Why destroy perfectly good geometry for this visual effect (afterwards they will list incorrect distances).  Instead build a block definition with a circle and a wipeout, then insert that block on top of the polyline vertices!

 

Patchy
Mentor
Mentor

There are many already floating around.

01.JPG02.JPG

0 Likes

ronjonp
Advisor
Advisor

 


@TerryDotson wrote:

Why destroy perfectly good geometry for this visual effect (afterwards they will list incorrect distances).  Instead build a block definition with a circle and a wipeout, then insert that block on top of the polyline vertices!

 


Using this method, give this a try 🙂

(defun c:foo (/ _chk a b p r s)
  ;; RJP » 2018-07-26
  ;; Inserts a mask block on vertices of objects
  (defun _chk (p l) (null (vl-some '(lambda (x) (equal p x 1e-8)) l)))
  (if (null (tblobjname "block" "_circle"))
    (progn (entmake '((0 . "BLOCK")
		      (100 . "AcDbEntity")
		      (67 . 0)
		      (8 . "0")
		      (100 . "AcDbBlockReference")
		      (2 . "_circle")
		      (10 0.0 0.0 0.0)
		      (70 . 0)
		     )
	   )
	   (entmake '((0 . "LWPOLYLINE")
		      (100 . "AcDbEntity")
		      (67 . 0)
		      (8 . "0")
		      (62 . 7)
		      (420 . 16777215)
		      (100 . "AcDbPolyline")
		      (90 . 2)
		      (70 . 129)
		      (43 . 0.5)
		      (38 . 0.0)
		      (39 . 0.0)
		      (10 -0.25 0.0)
		      (40 . 0.5)
		      (41 . 0.5)
		      (42 . 1.0)
		      (91 . 0)
		      (10 0.25 0.0)
		      (40 . 0.5)
		      (41 . 0.5)
		      (42 . 1.0)
		      (91 . 0)
		     )
	   )
	   (entmake '((0 . "CIRCLE")
		      (100 . "AcDbEntity")
		      (67 . 0)
		      (8 . "0")
		      (62 . 5)
		      (100 . "AcDbCircle")
		      (10 0.0 0.0 0.0)
		      (40 . 0.5)
		     )
	   )
	   (entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0")))
    )
  )
  (cond	((and (setq b (cond ((getdist "\nEnter block size: <1.0>"))
			    (1.0)
		      )
	      )
	      (setq s (ssget '((0 . "arc,line,lwpolyline"))))
	 )
	 (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	   (setq a (vlax-curve-getstartparam e))
	   (cond ((wcmatch (cdr (assoc 0 (entget e))) "ARC,LINE")
		  (and (_chk (setq p (vlax-curve-getstartpoint e)) r) (setq r (cons p r)))
		  (and (_chk (setq p (vlax-curve-getendpoint e)) r) (setq r (cons p r)))
		 )
		 ((repeat (1+ (fix (vlax-curve-getendparam e)))
		    (setq p (vlax-curve-getpointatparam e a))
		    (setq a (1+ a))
		    (and (_chk p r) (setq r (cons p r)))
		  )
		 )
	   )
	 )
	 (foreach p r
	   (entmakex (list '(0 . "insert")
			   '(8 . "DonutsYum")
			   '(2 . "_circle")
			   (cons 10 p)
			   (cons 41 b)
			   (cons 42 b)
			   (cons 43 b)
		     )
	   )
	 )
	)
  )
  (princ)
)
(vl-load-com)

Anonymous
Not applicable

thank you sir
but this lisp didn't trim the lines inside, it's adding a hatched cirecles 

if you can modify and provide the new lisp i'll be thankfull

 

regards

0 Likes

ronjonp
Advisor
Advisor

@Anonymous wrote:

thank you sir
but this lisp didn't trim the lines inside, it's adding a hatched cirecles 

if you can modify and provide the new lisp i'll be thankfull

 

regards


Why is it so important that the circles are trimmed? A masked block will provided a similar effect with less destruction. Look into draworder and also if you print using a color table, the mask within the block (255 255 255) should print white.

0 Likes

Anonymous
Not applicable

mmm ... yes sir i really got your point, but in my work ( preparing area maps ) those lines inside the circles must be trimmed, this is the followed procedure for all, we cant replace it with this block unfortunately, so if you can help me to get this lisp it will be great, in the one drawing at least i have to add and trim 1000 circles and its take too much time and effort, i thik using this lisp at least we can save the effort that spent to do the trims.

 

thanks in advance

0 Likes