Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Trim inside a circle - any autolisp for it here?

460 views
Skip to first unread message

ab

unread,
May 8, 1999, 3:00:00 AM5/8/99
to
what I'm in need of is a simple lips routine that i can use to draw a small
circle
at an end or intersection then trim anylines inside the circle
I'm drawing loads of propert and plumbing / sewerage diagrams and it would
speed up the process, and to date when I'm really pushed I have to leave the
little circles out and the dwg's dont look as professional.
contact me... if youi like or post it here if you can help I'm greatful
midi...@hotmail.com

Lincoln Bauman

unread,
May 10, 1999, 3:00:00 AM5/10/99
to
Hi,

Here is a program I wrote to "punch holes" in a drawing
by selecting a circle, it results in entities that cross
into or are contained by the circle to be trimmed/deleted as
needed to "clear out" the circle. It seems that the entire
circle needs to be visible for it to work correctly.
You would first have to draw your circles, and then go back
and trim out the objects with the routine.

Regards, Lincoln

(defun c:ctrim ( / circ_pts lst ang inc tmp seg pt ent
ctrim_err x f_pts svd_os svd_cmd svd_err)

(defun ctrim_err (s)
(if(/= s "Function cancelled")
(princ(strcat "\n\n" s)) )
(setvar "cmdecho" svd_cmd)
(setvar "osmode" svd_os)
(setq *error* svd_err)
)

(defun circ_pts (enm)
(setq lst (entget enm)
ang (* pi 2)
inc (/ ang 64)
tmp '()
seg 65
)
(repeat seg
(setq pt (polar(cdr(assoc 10 lst))ang
(-(cdr(assoc 40 lst))0.01))
ang (+ inc ang)
)
(setq tmp(cons pt tmp))
)
tmp
)


(setq ent (car(entsel "\nSelect circle: "))
svd_err *error*
*error* ctrim_err
svd_os (getvar "osmode")
svd_cmd (getvar "cmdecho")
)
(setvar "cmdecho" 0)
(setvar "osmode" 0)
(if(and ent
(=(cdr(assoc 0(entget ent)))"CIRCLE")
)
(progn
(setq f_pts(circ_pts ent))
(command "trim" ent "" "f") ;run twice in case the same
(foreach x f_pts(command x)) ;object intersects circle twice
(command "" "")
(command "trim" ent "" "f")
(foreach x f_pts(command x))
(command "" "")
(if(setq x(ssget "wp" f_pts))
(command "erase" x "")
)
)
)
(setvar "cmdecho" svd_cmd)
(setvar "osmode" svd_os)
(setq *error* svd_err)
(princ)
)

0 new messages