Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/12/2023 in all areas

  1. Sorry deleted the Window title that was the error.
    2 points
  2. Hi SLW This one works OK with LINEAR gradients, but for some reason, it doesn't match exactly the Cylindrical ones. I tried various interpolation methods, but none seems accurate. ;Replace gradient Hatch with lines ;Stefan M - 12.08.2023 (defun c:gradline ( / *error* o ss i e a col1 col2 en l c x1 x2 c1 c2 rgb r m ) ;;; (setq *error* (err)) (setq o (vlax-3d-point 0.0 0.0 0.0)) (or *spacing* (setq *spacing* 0.1)) (or *del* (setq *del* "No")) (if (and (setq ss (ssget "_:L" '((0 . "HATCH") (450 . 1) (470 . "LINEAR,CYLINDER,INVCYLINDER")))) (progn (initget 6) (setq *spacing* (cond ((getdist (strcat "\nSpecify line spacing <" (rtos *spacing*) ">: "))) (*spacing*) ) ) ) (progn (initget "Yes No") (setq *del* (cond ((getkword (strcat "\nDelete original hatch [Yes/No] <" *del* ">: "))) (*del*) ) ) ) ) (repeat (setq i (sslength ss)) (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))) a (vla-get-gradientangle e) col1 (vla-get-gradientcolor1 e) col2 (vla-get-gradientcolor2 e) ) (setq en (entlast) l nil) (setq c (vla-copy e)) (vla-rotate c o (- a)) (vla-getboundingbox c 'x1 'x2) (setq x1 (car (vlax-safearray->list x1)) x2 (car (vlax-safearray->list x2)) ) (if (> (- x2 x1) *spacing*) (progn (vla-put-HatchObjectType c acHatchObject) (vla-setpattern c acHatchPatternTypeUserDefined "_USER") (vla-put-patternangle c (/ pi 2)) (vla-put-patternscale c *spacing*) (setq c1 (mapcar '(lambda (p) (vlax-get col1 p)) '(red green blue)) c2 (mapcar '(lambda (p) (vlax-get col2 p)) '(red green blue)) ) (if (eq (vla-get-gradientname e) "INVCYLINDER") (mapcar 'set '(c1 c2) (list c2 c1)) ) (vla-put-truecolor c col1) (command "_explode" (vlax-vla-object->ename c)) (while (setq en (entnext en)) (setq l (cons (list (car (vlax-curve-getstartpoint en)) (vlax-ename->vla-object en) ) l ) ) ) (foreach x l (if (eq (vla-get-gradientname e) "LINEAR") (setq rgb (mapcar '(lambda (c1 c2) (fix (+ 0.5 c1 (/ (* (- c2 c1) (- (car x) x1)) (- x2 x1)))) ) c1 c2 ) ) (progn (setq r (/ (- x2 x1) 2.0) m (/ (+ x2 x1) 2.0) rgb (mapcar '(lambda (c1 c2 / q u) (setq q (abs (- m (car x))) u (atan (/ (sqrt (- (* r r) (* q q))) q)) ) (fix (+ 0.5 c1 (/ (* (- c2 c1) 2 u) pi))) ) c1 c2 ) ) ) ) (vla-setrgb col1 (car rgb) (cadr rgb) (caddr rgb)) (vla-put-truecolor (cadr x) col1) (vla-rotate (cadr x) o a) ) (if (eq *del* "Yes") (vla-delete e)) ) ) ) ) ;;; (*error* nil) (princ) )
    1 point
  3. With comparing you have to pick the long list. Made a simple function that will output the entity names that are in both. just feed it the selection set names. Then its just ssadd to an new selecton set. (setq sspoly (ssget)) (setq ss (ssget)) ... (setq ssb (ssadd)) (setq lst (MH:SSI SSpoly SS)) (while lst (ssadd (car lst) ssb) (setq lst (cdr lst)) ) SSI.lsp
    1 point
  4. :button { is_default=true; alignment=centered; fixed_width=true; width=12; label="Ok"; key="my_ok_button";} key element is statement 'is_default=true
    1 point
  5. Had trouble getting the message working, had to change it to this format: (ACET-UI-MESSAGE "\nDo you want to Run Script Now?" "Title" 52)
    1 point
×
×
  • Create New...