Message 1 of 2

Not applicable
01-14-2017
04:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
(vl-load-com) (defun c:northernhemisphere (/ 2PI thetad phid pole_rad) ;;get user input to create the spheres dimensions testing with 16 16 1 (setq stacks (getint "Number of stacks:")) (setq latitudes (getint "Number of latitudes:")) (setq radius (getint "Radius distance:")) ;;script locals (setq 2PI (* PI 2)) (setq thetad (/ PI latitudes)) (setq phid (/ 2PI stacks)) (setq pole_rad (/ PI 2)) (setq lspherepoints (list)) (setq latitudesm (- latitudes 2)) ;;A function that uses entmakex to draw a point (defun Point (pt) (entmakex (list (cons 0 "POINT") (cons 10 pt)) ) ) ;;A function that draws a 3DFace. Pass in four xyz point lists (defun 3DFace (p1 p2 p3 p4) (entmakex (list (cons 0 "3DFACE") (cons 10 p1) (cons 11 p2) (cons 12 p3) (cons 13 p4) ) ) ) ;;Convert an index number to a point list (defun itop (i) (setq x (nth (+ i 0) lspherepoints)) (setq y (nth (+ i 1) lspherepoints)) (setq z (nth (+ i 2) lspherepoints)) (list x y x) (princ);; error: bad function: 0 ) ;;Define a function to draw the northern hemisphere (defun nhemisphere (/ curtheta curphi) (setq curtheta 0) ;;A vector (1,0,0) or origin of theta (while (<= curtheta pole_rad) ;Iterate each latitude (setq loncircleradius (* (cos curtheta) radius)) (setq loncircleelev (* (sin curtheta) radius)) (setq curphi 0) (while (<= curphi 2PI) ;;Iterate each longitude (setq x (* (cos curphi) loncircleradius)) (setq y (* (sin curphi) loncircleradius)) ;Instead of drawing a point here how about storing to an array (setq lpush (list x y loncircleelev)) (setq lspherepoints (append lspherepoints lpush)) ;;phid the pie piece is added to curphi each iteration (setq curphi (+ phid curphi)) ) ;;thetad the pie piece is added to curtheta each iteration (setq curtheta (+ thetad curtheta)) ) ) ;;-------------------------------------------------- (nhemisphere) ;;Draw the points first to get our bearings (setq count 0) (while (< count (vl-list-length lspherepoints)) (setq x (nth count lspherepoints)) (setq y (nth (+ count 1) lspherepoints)) (setq z (nth (+ count 2) lspherepoints)) (Point (list x y z)) (setq count (+ count 3)) ) (setq latitudesc 0) (while (< latitudesc latitudesm) (setq latitudesc (+ latitudesc 1)) ) );done
When I set a breakpoint directly after drawing the points and run itop(0) for example in the VLisp console the output I am getting is "error; bad function; 0. My intent is to retrieve a sub-list from lspherepoints which at that point in the code is filled with sphere points. Does anyone know how perhaps it can be done to get itop working?
Thank you!
Solved! Go to Solution.