Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/15/2021 in all areas

  1. (defun c:MontyPytonsFlyingSausages ;;; variable declarations ( / ss angle-degrees point-zero angle-radians circ-ent circ-el circ-cen circ-rad circ-dist circ-ang inside-arc-dist outside-arc-dist inside-arc-LR outside-arc-UL ss->el) (defun ss->el (ss / i l)(setq i 0)(repeat (sslength ss)(setq l (cons (ssname ss i) l) i (1+ i))) l) ;;; main routine (if (and (setq ss (ssget '((0 . "CIRCLE")))) (setq angle-degrees (getreal "\nEnter angle offset : ")) (setq point-zero '(0.0 0.0 0.0)) (setq angle-radians (* pi (/ angle-degrees 180.0)))) (foreach circ-ent (ss->el ss) ;;; get circle elist (setq circ-el (entget circ-ent)) ;;; get circle center point (setq circ-cen (cdr (assoc 10 circ-el))) ;;; get circle radius (setq circ-rad (cdr (assoc 40 circ-el))) ;;; get angle & distance from 0,0 to circle center (setq circ-dist (distance point-zero circ-cen)) ;;; get angle between point-zero and circle (radians) (setq circ-ang (angle point-zero circ-cen)) ;;; compute distances for inside & outside arc (setq inside-arc-dist (- circ-dist circ-rad) outside-arc-dist (+ circ-dist circ-rad)) ;;; compute all arc-points (clockwise) (setq inside-arc-LR (polar point-zero (- circ-ang angle-radians) inside-arc-dist)) ;;; compute all arc-points (clockwise) (setq outside-arc-UL (polar point-zero (+ circ-ang angle-radians) outside-arc-dist)) ;;; draw pline (command ".pline" outside-arc-UL "arc" "CE" point-zero "ang" (- 0 (* angle-degrees 2.0)) inside-arc-LR "CE" point-zero "ang" (* angle-degrees 2.0) "close" ) ) ) ) ;;; shortcut (defun c:t1 ()(c:MontyPytonsFlyingSausages)) J4F (just for fun)
    1 point
  2. Another couple - (defun foo2 ( x l ) (cond ((not l) l) ((= x (car l)) (list x)) ((cons (car l) (foo2 x (cdr l))))) ) (defun foo3 ( x l / f ) (setq f (lambda ( y ) (if (= x y) (not (setq f (lambda ( y ) t)))))) (vl-remove-if '(lambda ( z ) (f z)) l) )
    1 point
×
×
  • Create New...