# In launching the same program, different surface results

• I can't understand, I tried to force mas and lin, but it doesn't work, sometimes it's right. If you're built separately, it's all right.

``````    ;//////////////////////////////////////////////////////////////
;//Функція визначення координати точки кривої Бізьє 2 порядку//
;//point1 перша точка                                        //
;//point2 друга точка                                        //
;//point3 третя точка                                        //
;//temp параметр (0 <= temp <= 1)                            //
;//////////////////////////////////////////////////////////////
(defun bez2(point1 point2 point3 temp)
(setq xx (+ (* (car point1) (expt (- 1 temp) 2)) (* 2 (car point2) temp (- 1 temp)) (* (car point3) temp temp)))
(setq yy (+ (* (cadr point1) (expt (- 1 temp) 2)) (* 2 (cadr point2) temp (- 1 temp)) (* (cadr point3) temp temp)))
(setq zz (+ (* (caddr point1) (expt (- 1 temp) 2)) (* 2 (caddr point2) temp (- 1 temp)) (* (caddr point3) temp temp)))
(setq ptr (list xx yy zz))
)
;//////////////////////////////////////////////////////////////
;//Функція побудови сітки поверхні                           //
;//mas_point масив точок знайдений за формулою Кунса         //
;//////////////////////////////////////////////////////////////
(defun my3DMesh (mas_point)
(setq N (length mas_point)
M (length (car mas_point))
)
(Command "3dmesh" M N)
(setq n1 0)
(repeat N
(setq m1 0)
(repeat M
(Command (nth m1 (nth n1 mas_point)))
(setq m1 (+ m1 1))
)
(setq n1 (+ n1 1))
)
)
;//////////////////////////////////////////////////////////////
(defun kyns(r1 r2 r3 r4)
(setq r00 (car r1)
r01 (car r3)
r10 (car r2)
)
(setq v 0)
(setq mas nil)
(setq h 0.1)
(repeat 11
(setq u 0)
(setq lin nil)
(repeat 11
(setq x (-
(+
(* (car (bez2 (car r4) (cadr r4) (caddr r4) v)) (- 1 u))
(* (car (bez2 (car r1) (cadr r1) (caddr r1) u)) (- 1 v))
)

(+
(* (car r00) (- 1 u) (- 1 v))
(* (car r01) (- 1 u) v)
(* (car r10) u (- 1 v))
(* (car r11) u v)
)
)
)
(setq y (-
(+
)

(+
(* (cadr r00) (- 1 u) (- 1 v))
(* (cadr r01) (- 1 u) v)
(* (cadr r10) u (- 1 v))
)
)
)
(setq z (-
(+
)

(+
(* (caddr r00) (- 1 u) (- 1 v))
(* (caddr r01) (- 1 u) v)
(* (caddr r10) u (- 1 v))
)
)
)
(setq pointl (list x y z)
lin (cons pointl lin)
)
(setq u (+ u h))
)
(setq lin (reverse lin)
mas (cons lin mas)
)
(setq v (+ v h))
)
(setq mas (reverse mas))
(my3DMesh mas)
)

(command "erase" "all" "")
;//////////////////////////////////////////////////////////////
;//Визначення опрних точок поверхні                          //
;//////////////////////////////////////////////////////////////
;Палуба
(setq p1 (list 0 0 0)
p2 (list 7 7 0)
p3 (list 25 2 0)
p4 (list 25 0 0)
p5 (list 25 -2 0)
p6 (list 7 -7 0)
p7 (list 0 0 0)
p8 (list 0 0 0)
)
(setq l1 (list p1 p2 p3)
l2 (list p3 p4 p5)
l3 (list p7 p6 p5)
l4 (list p1 p8 p7)
)

(kyns l1 l2 l3 l4)
;Задній борт
(setq p11 (list 25 2 0)
p21 (list 25 3 -3)
p31 (list 25 0 -5)
p41 (list 25 -3 -3)
p51 (list 25 -2 0)
p61 (list 25 0 0)
p71 (list 25 2 0)
p81 (list 25 2 0)
)
(setq l11 (list p11 p21 p31)
l21 (list p31 p41 p51)
l31 (list p71 p61 p51)
l41 (list p11 p81 p71)
)
(kyns l11 l21 l31 l41)
;Лівий борт
(setq p12 (list 0 0 0)
p22 (list 7 -7 0)
p32 (list 25 -2 0)
p42 (list 25 -3 -3)
p52 (list 25 0 -5)
p62 (list 20 0 -10)
p72 (list 0 0 0)
p82 (list 0 0 0)
)
(setq l12 (list p12 p22 p32)
l22 (list p32 p42 p52)
l32 (list p72 p62 p52)
l42 (list p12 p82 p72)
)
(kyns l12 l22 l32 l42)

``````

The input data are the backbones of the Beauty 2 curves. According to the Kuns formula, the surface is built. The surface sheets shall be intertwined with each other, but somehow the points of the same surface shall be flooded into another surface, at the same time at other points each time.

• As the code worked correctly, the problem was in the building of the AutoCad. For the correct robot of downloaded Lisp, the function of "Snap cursor to 2D reference points" needs to be disconnected. In order to deactivate the function, prior to the construction of the facilities, command:

``````(command "osnap" "off")
``````

Robot of a program with a functionality (Figure 1). Robot of programme with deactivated function (Figure 2).

2

2

2

2

2

2

2

2

2

2

2

2

2

2

2