Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/19/2024 in all areas

  1. Quite! but you say: You are within detection limits... Either you agree to have expanded intersections, or you ban them, it's your choice!
    1 point
  2. You can specify APERTURE and OSMODE system variables to desired value prior to running lisp, and GrSnap will recognize where you want to snap if your cursor is near desired snapping entity in range of previously set APERTURE variable...
    1 point
  3. Salut fuccaro The function you are looking for is a logarithmic spiral. Starting in the unit circle, the parametric equations of the spiral are: x(a)=(q^a)*cos(a) y(a)=(q^a)*sin(a) where q= e^(-tan(pi/n)) and q^a is the distance from the center to the mouse and n is the number of mice. The angle a is in range 0...∞ For n=3...∞, q < 1. That means, q^a=0 at a=∞. The mice would never reach the center!!! If k=tan(pi/n), the length of the trajectory is sqrt(k^2+1)/k, which is a finite number!!! Half of the length is reached at r=0.5! Strange enough, for n=10 the length is 2 times the golden ratio. (defun mice ( n / rot a b c q da r l) (defun rot (p a) (list (apply '- (mapcar '* p (list (cos a) (sin a)))) (apply '+ (mapcar '* p (list (sin a) (cos a)))) ) ) (setq b (/ (* 2 pi) n)) (setq q (exp (/ (- (sin (/ b 2))) (cos (/ b 2))))) (setq a 0.0 da (/ pi 180)) (repeat 721 (setq r (expt q a) l (cons (list (* r (cos a)) (* r (sin a)) ) l ) a (+ a da) ) ) (entmakex '((0 . "CIRCLE") (10 0.0 0.0 0.0) (40 . 1.0))) (draw_spline l (setq c 1) ) (repeat (1- n) (draw_spline (setq l (mapcar '(lambda (p) (rot p b)) l)) (setq c (1+ c)) ) ) ) (defun draw_spline (pts color) (entmakex (append (list '(0 . "SPLINE") '(100 . "AcDbEntity") '(100 . "AcDbSpline") (cons 62 color) '(70 . 1064) '(71 . 3) (cons 74 (length pts)) ) (mapcar '(lambda (x) (cons 11 x) ) pts ) ) ) )
    1 point
  4. @AirBall With your request :elevations in vertices Try this for convert your lwpolyline to 3Dpoly with 3Dfaces (defun pt_sum_store (pt? pt_lst / count p1 p2 vtx alpha btw_alpha) (setq alpha 0.0 vtx (car pt_lst) count 1 ) (while (< 1 (length pt_lst)) (setq p1 (car pt_lst) p2 (cadr pt_lst) pt_lst (cdr pt_lst) btw_alpha (q_ang pt? p1 p2) btw_alpha (if (< 180.0 btw_alpha) (- btw_alpha 360.0) btw_alpha ) alpha (+ alpha btw_alpha) ) (setq count (1+ count)) ) (setq btw_alpha (q_ang pt? p2 vtx) btw_alpha (if (< 180.0 btw_alpha) (- btw_alpha 360.0) btw_alpha ) ) (+ alpha btw_alpha) ) (defun q_ang (pt? p1 p2 / alpha beta) (setq beta (angle pt? p1) alpha (angle pt? p2) alpha (- alpha beta) ) (if (< alpha 0) (setq alpha (+ (* 2 pi) alpha)) ) (* (/ (float alpha) pi) 180.0) ) (defun pt_in_poly (pt? pt_lst / ) (if (equal 0.0 (pt_sum_store pt? pt_lst) 0.0001) nil T ) ) (vl-load-com) (defun c:lwpolyto3dpoly ( / js AcDoc Space ename obj pr lst_pt ss nb ent dxf_ent l_pt n X1 X2 X3 Y1 Y2 Y3 Z1 Z2 Z3 E1 E2 E3 E4 Z nw_lst-pt nw_obj) (princ "\nSelect polyline.") (while (null (setq js (ssget "_+.:E:S" (list (cons 0 "*POLYLINE") (cons 67 (if (eq (getvar "CVPORT") 1) 1 0)) (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model")) (cons -4 "<NOT") (cons -4 "&") (cons 70 112) (cons -4 "NOT>") ) ) ) ) ) (setq AcDoc (vla-get-ActiveDocument (vlax-get-acad-object)) Space (if (= 1 (getvar "CVPORT")) (vla-get-PaperSpace AcDoc) (vla-get-ModelSpace AcDoc) ) ) (setq ename (ssname js 0) obj (vlax-ename->vla-object ename) pr -1 ) (repeat (fix (vlax-curve-getEndParam obj)) (setq pr (1+ pr) lst_pt (cons (vlax-curve-GetPointAtParam obj pr) lst_pt) ) ) (setq lst_pt (cons (vlax-curve-GetPointAtParam obj (1+ pr)) lst_pt)) (setq ss (ssget "_F" lst_pt '((0 . "3DFACE")))) (cond (ss (repeat (setq nb (sslength ss)) (setq ent (ssname ss (setq nb (1- nb))) dxf_ent (entget ent) l_pt (list (cdr (assoc 10 dxf_ent)) (cdr (assoc 11 dxf_ent)) (cdr (assoc 12 dxf_ent)) (cdr (assoc 13 dxf_ent)) ) ) (if (equal (car l_pt) (cadr l_pt)) (setq l_pt (list (list (cadr l_pt) (caddr l_pt) (cadddr l_pt)))) (setq l_pt (cons (list (car l_pt) (cadr l_pt) (caddr l_pt)) (list (list (cadr l_pt) (caddr l_pt) (cadddr l_pt))))) ) (mapcar '(lambda (y / n) (foreach e lst_pt (cond ((pt_in_poly e y) (setq n 0) (foreach item '(("X" . "'car") ("Y" . "'cadr") ("Z" . "'caddr")) (mapcar '(lambda (e) (set (read (strcat (car item) (itoa (setq n (1+ n))))) e)) (mapcar (eval (read (cdr item))) (car l_pt)) ) (setq n 0) ) (setq E1 (+ (* X1 (- Y2 Y3)) (* X2 (- Y3 Y1)) (* X3 (- Y1 Y2))) E2 (+ (* Y1 (- Z2 Z3)) (* Y2 (- Z3 Z1)) (* Y3 (- Z1 Z2))) E3 (+ (* Z1 (- X2 X3)) (* Z2 (- X3 X1)) (* Z3 (- X1 X2))) E4 (- (- (* E2 X1)) (* E3 Y1) (* E1 Z1)) Z (- (- (* (/ E2 E1) (car e))) (* (/ E3 E1) (cadr e)) (/ E4 E1)) nw_lst-pt (cons (trans (list (car e) (cadr e) Z) 1 0) nw_lst-pt) ) ) ) ) ) l_pt ) ) (setq nw_obj (vlax-invoke Space 'Add3dPoly (apply 'append nw_lst-pt ) ) ) (vla-put-Layer nw_obj (vla-get-Layer obj)) (vla-put-Color nw_obj (vla-get-Color obj)) (vla-put-Lineweight nw_obj (vla-get-Lineweight obj)) (vla-delete obj) ) ) (prin1) )
    1 point
×
×
  • Create New...