Your so called drawing contains the path to an untitled bitmap file that was not included as part of the file therefore we are unable to view anything. Try posting just the bitmap itself.
Registered forum members do not see this ad.
iam need lsp for trim or erase many lines inside many circle or block circle on one at one time
Your so called drawing contains the path to an untitled bitmap file that was not included as part of the file therefore we are unable to view anything. Try posting just the bitmap itself.
"I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police
Eat brains...gain more knowledge!
lsp for trim line inside many circle
Maybe you did not understand me. Your drawing file is blank. All one sees is the "path" to the untitled bitmap that was NOT included with the DWG file.
Post the actual BMP file not a DWG. Clear?
"I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police
Eat brains...gain more knowledge!
ExTrim.jpg
Let's say you start with what is shown in circle #1. What do you want the results of this custom lisp routine to look like after it is run? Circle #2 or #3?
"I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police
Eat brains...gain more knowledge!
thank you sir
i want lsp that when i select all circle in drawing automiticly trim or erase inside this circle as no.2 in your example
OK. By the way, that was done using the EXTRIM command. I only tried it on a single circle so I can't tell you, at this time, whether or not it would work on multiple circles.
"I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police
Eat brains...gain more knowledge!
Nope, that Express Tool is a lisp command, so you can't even call it from another lisp in multiple instances. Although the actual working function in that file is a normal defun requiring the ename and the point. So this might work:This only works for circles, it's possible to extend for polylines as well - but more difficult.Code:(load "extrim.lsp") (defun c:MExTrim (/ ss n en ed) (prompt "\nSelect Circles: ") (if (setq ss (ssget '((0 . "CIRCLE")))) (progn (setq n (sslength ss)) (while (>= (setq n (1- n)) 0) (setq en (ssname ss n) ed (entget en)) (etrim en (cdr (assoc 10 ed)))))) (princ))
Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!
thank you sir its ok
Registered forum members do not see this ad.
Here is complete MEXTRIM.lsp... Thanks to Irneb, and my previous post for algorithm for randomize picking points inside closed entity I've managed to create complete MEXTRIM command...
M.R.Code:(defun rnd (/ modulus multiplier increment rand) (if (not seed) (setq seed (getvar "DATE")) ) (setq modulus 65536 multiplier 25173 increment 13849 seed (rem (+ (* multiplier seed) increment) modulus) rand (/ seed modulus) ) ) (defun GroupByNum ( lst n / r) (if lst (cons (reverse (repeat n (setq r (cons (car lst) r) lst (cdr lst)) r)) (GroupByNum lst n) ) ) ) (defun ptonline ( pt pt1 pt2 / vec12 vec1p d result ) (setq vec12 (mapcar '- pt2 pt1)) (setq vec12 (reverse (cdr (reverse vec12)))) (setq vec1p (mapcar '- pt pt1)) (setq vec1p (reverse (cdr (reverse vec1p)))) (setq vec2p (mapcar '- pt2 pt)) (setq vec2p (reverse (cdr (reverse vec2p)))) (setq d (distance '(0.0 0.0) vec12) d1 (distance '(0.0 0.0) vec1p) d2 (distance '(0.0 0.0) vec2p)) (if (equal d (+ d1 d2) 1e-8) (setq result T) (setq result nil)) result ) (defun ptinsideent ( pt ent / msp ptt xlin int k kk tst result ) (vl-load-com) (setq msp (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq ptt (vlax-curve-getclosestpointto ent pt)) (setq xlin (vla-addxline msp (vlax-3d-point pt) (vlax-3d-point ptt))) (setq int (GroupByNum (vlax-invoke (if (eq (type ent) 'ENAME) (vlax-ename->vla-object ent)) 'intersectwith xlin acExtendBoth) 3)) (setq int (vl-sort int '(lambda (a b) (< (vlax-curve-getparamatpoint xlin a) (vlax-curve-getparamatpoint xlin b))))) (setq k 0) (while (< (setq k (1+ k)) (length int)) (if (and (eq (rem k 2) 1) (ptonline pt (nth (- k 1) int) (nth k int))) (setq tst (cons T tst)) (setq tst (cons nil tst))) ) (setq tst (reverse tst)) (setq k 0) (mapcar '(lambda (x) (setq k (1+ k)) (if (eq x T) (setq kk k))) tst) (vla-delete xlin) (if kk (if (eq (rem kk 2) 1) (setq result T) (setq result nil)) (setq result nil) ) result ) (load "extrim.lsp") (defun c:MExTrim ( / ss n en ed enA minpt maxpt dx dy pt dxx dyy ) (vl-load-com) (prompt "\nSelect closed entities: ") (if (setq ss (ssget (append (list '(-4 . "<or") '(0 . "CIRCLE") '(-4 . "<and") '(0 . "*POLYLINE") '(70 . 1) '(-4 . "and>") '(-4 . "<and") '(0 . "SPLINE") '(70 . 11) '(-4 . "and>") '(-4 . "<and") '(0 . "ELLIPSE") '(41 . 0.0)) (list (cons 42 (* 2 pi))) (list '(-4 . "and>") '(-4 . "or>"))))) (progn (setq n (sslength ss)) (while (>= (setq n (1- n)) 0) (setq en (ssname ss n) ed (entget en) enA (vlax-ename->vla-object en)) (vla-getboundingbox enA 'minpoint 'maxpoint) (setq minpt (vlax-safearray->list minpoint) maxpt (vlax-safearray->list maxpoint) ) (setq dx (- (car maxpt) (car minpt))) (setq dy (- (cadr maxpt) (cadr minpt))) (setq pt '(0.0 0.0 0.0)) (while (not (ptinsideent pt en)) (setq dxx (* dx (rnd))) (setq dyy (* dy (rnd))) (setq pt (list (+ (car minpt) dxx) (+ (cadr minpt) dyy) 0.0)) ) (etrim en pt) ) ) ) (princ) )![]()
Bookmarks