TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ribarm on June 30, 2015, 07:23:14 AM

Title: Modelling error - snub dodecahedron modeling
Post by: ribarm on June 30, 2015, 07:23:14 AM
Here is situation... If you have 20+ minutes, please watch this video :
https://www.youtube.com/watch?v=hOO-y1R3HgU

It shows my geometric construction of pretty difficult POLYHEDRON called SNUB DODECAHEDRON... This construction is the most closest to exact precise solution and I don't know any better... (If you know please help me - it's not a task but only pleasure to make us more wise and smart...) ... Anyway, after watching this video, near its ending I tried both UNION command and SURFSCULPT command on bounding REGIONS but I failed to obtain unique 3DSOLID entity... As addition to this post, I'll attach this version of MODEL - constructed with shown geometry procedure to save you time and I'll post a code for scaling regions by their centroid points - I thought this will make model watertight, but I was wrong... So my question : Is after all possible to construct this MODEL as 3DSOLID entity using this geometry concept? If you know any better solution for constructing starting rotation angle of first edge adjacent triangle pyramid, but without math result (knowing ratio of Radius of sphere of snub dodecahedron and one its edge - you can google this), please give us that info...

Here is the code and attachment DWG :
Code - Auto/Visual Lisp: [Select]
  1. (defun c:scaleregsbycentroids ( / *error* *adoc* v^v unit ucs ucsf ss scf i reg n x y p ce )
  2.  
  3.  
  4.   (defun *error* ( msg )
  5.     (while (not (eq (getvar 'worlducs) 1))
  6.       (command "_.UCS" "_P")
  7.     )
  8.     (if ucsf (command "_.UCS" "_P"))
  9.     (vla-endundomark *adoc*)
  10.     (if msg (prompt msg))
  11.     (princ)
  12.   )
  13.  
  14.   (defun v^v ( u v )
  15.     (mapcar '(lambda ( s1 s2 a b ) (+ ((eval s1) (* (nth a u) (nth b v))) ((eval s2) (* (nth a v) (nth b u))))) '(+ - +) '(- + -) '(1 0 0) '(2 2 1))
  16.   )
  17.  
  18.   (defun unit ( v )
  19.     (mapcar '(lambda ( x ) (/ x (distance '(0.0 0.0 0.0) v))) v)
  20.   )
  21.  
  22.   (vla-startundomark *adoc*)
  23.   (if (eq (getvar 'worlducs) 0)
  24.     (progn
  25.       (command "_.UCS" "_W")
  26.       (setq ucsf t)
  27.     )
  28.   )
  29.   (prompt "\nSelect regions for scale by their cetroids")
  30.   (setq ss (ssget "_:L" '((0 . "REGION"))))
  31.   (initget 6)
  32.   (setq scf (getdist "\nPick or specify scale factor <1.1> : "))
  33.   (if (null scf) (setq scf 1.1))
  34.   (if ss
  35.     (repeat (setq i (sslength ss))
  36.       (setq reg (ssname ss (setq i (1- i))))
  37.       (setq n (vlax-safearray->list (vlax-variant-value (vla-get-normal (vlax-ename->vla-object reg)))))
  38.       (if (equal (v^v n '(0.0 0.0 1.0)) '(0.0 0.0 0.0) 1e-6)
  39.         (setq x '(1.0 0.0 0.0) y '(0.0 1.0 0.0))
  40.         (setq x (unit (v^v n '(0.0 0.0 1.0))) y (unit (v^v n x)))
  41.       )
  42.       (command "_.explode" reg)
  43.       (while
  44.         (> (getvar 'cmdactive) 0)
  45.         (command "")
  46.       )
  47.       (command "_.undo")
  48.       (while
  49.         (> (getvar 'cmdactive) 0)
  50.         (command "")
  51.       )
  52.       (setq ucs (vla-add (vla-get-usercoordinatesystems *adoc*) (vlax-3d-point p) (vlax-3d-point (mapcar '+ p x)) (vlax-3d-point (mapcar '+ p y)) "{ UCS }"))
  53.       (vla-put-activeucs *adoc* ucs)
  54.       (command "_.UCS" "_D" "{ UCS }")
  55.       (vlax-release-object ucs)
  56.       (setq ce (trans (vlax-safearray->list (vlax-variant-value (vla-get-centroid (vlax-ename->vla-object reg)))) 1 0))
  57.       (while (not (eq (getvar 'worlducs) 1))
  58.         (command "_.UCS" "_P")
  59.       )
  60.       (command "_.SCALE" reg "" "_non" ce scf)
  61.       (while
  62.         (> (getvar 'cmdactive) 0)
  63.         (command "")
  64.       )
  65.     )
  66.   )
  67.   (*error* nil)
  68. )
  69.  
  70. (defun c:scregs-cent nil (c:scaleregsbycentroids))
  71.  

Thanks for reading and watching video, M.R.
Title: Re: Modelling error - snub dodecahedron modeling
Post by: ribarm on July 02, 2015, 01:44:34 AM
To obtain real 3DSOLID entity, you'll have to be even more precise... So you'll have to scale RED CIRCLE by factor : 0.999966385 (it's easy to remember at least for me...)

M.R.
Title: Re: Modelling error - snub dodecahedron modeling
Post by: ribarm on July 03, 2015, 01:36:49 PM
The same issue with SNUB CUBOCTAHEDRON...

VIDEO :
https://youtu.be/Hw-zp-80lkw

To obtain real 3DSOLID entity, you'll have to be even more precise... So you'll have to scale RED CIRCLE by factor : 1.000180852

M.R.