Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun Point(x y z)
- (list x y z)
- )
- (defun Line (from to)
- (entmakex
- (list
- (cons 0 "line")
- (cons 10 from)
- (cons 11 to)
- )
- )
- )
- (defun Polygon (points / curr_point)
- (entmakex
- (list
- (cons 0 "POLYLINE")
- (cons 10 '(0 0 0))
- )
- )
- (while (setq curr_point (car points))
- (entmakex
- (list
- (cons 0 "VERTEX")
- (cons 10 curr_point)
- )
- )
- (setq points (cdr points))
- )
- (entmakex
- (list (cons 0 "SEQEND"))
- )
- )
- (defun connect_polygons(f_polygon s_polygon)
- (mapcar '(lambda (f_point s_point)
- (Line f_point s_point)
- )
- f_polygon
- s_polygon
- )
- )
- (defun draw_cone(polygon point)
- (mapcar '(lambda (polygon_point)
- (Line polygon_point point)
- )
- polygon
- )
- )
- (defun draw_cylinder(cylinder_b1 cylinder_b2)
- (Polygon cylinder_b1)
- (Polygon cylinder_b2)
- (connect_polygons cylinder_b1 cylinder_b2)
- )
- (defun CIRLCE_BASE(base_point radius vert_count z_value / polygon base_angle curr_point i)
- (setq base_angle (/ (* 2 pi) vert_count))
- (setq i 1)
- (setq curr_point (polar base_point 0 radius))
- (setq curr_point (POINT (car curr_point) (cadr curr_point) z_value))
- (setq polygon (list curr_point))
- (repeat vert_count
- (setq curr_point (polar base_point (* base_angle i) radius))
- (setq curr_point (Point (car curr_point) (cadr curr_point) z_value))
- (setq polygon (append polygon (list curr_point)))
- (setq i (+ i 1))
- )
- (setq polygon polygon)
- )
- (defun c:draw(/ i)
- (setq cylinder_b1 (CIRLCE_BASE '(0 0 0) 20 10 0))
- (setq cylinder_b2 (CIRLCE_BASE '(0 0 0) 20 10 40))
- (setq cone_b (CIRLCE_BASE '(0 0 0) 20 10 40))
- (setq cone_b2 (CIRLCE_BASE '(0 0 0) 20 10 0))
- (Polygon cylinder_b1)
- (Polygon cylinder_b2)
- (connect_polygons cylinder_b1 cylinder_b2)
- (draw_cone cone_b (Point 0 0 70))
- (draw_cone cone_b2 (Point 0 0 -40))
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement