Yes, it's one of the painful aspects of only using portions of the Express tools. You could always allow for such things by saving the value of Highlight and the restoring it at the end of the function.
I.e. something like this:Edit: Oh and BTW, thanks marko - that works great even on polylines!Code:(defun c:MExTrim (/ highlight *error* ss n en ed enA minpt maxpt dx dy pt dxx dyy) (vl-load-com) (setq highlight (getvar "HighLight")) (defun *error* (msg) (if highlight (setvar "HighLight" highlight)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (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)))) (*error* nil))





Reply With Quote


Bookmarks