PDA

View Full Version : Lisp - create spline


CF_Lum
10-28-2004, 03:04 AM
Is it possible to create spline using lisp code? Actually, later i will be reading in the point from a text file & draw the spline.
I create the following code but it isn't work!


(sd-defdialog 'draw_spline
:dialog-title "Draw Spline"
:variables

'((POINT_LIST) ;internal non displayed variable
(NEW_POINT ;internal input variable
:value-type :point-2d
:toggle-type :invisible
:prompt-text "Pick a point"
:after-input (push-point new_point))
)
:local-functions
'((PUSH-POINT (a-new-point)
(setq POINT_LIST (cons a-new-point POINT_LIST))
))
:prompt-variable 'new_point
:ok-action
'(progn
(print POINT_LIST)
(sd-call-cmds (BSPLINE_INT POINT_LIST complete))
)
); sd-defdialog


Anyone can help?

dorothea
10-28-2004, 09:56 PM
Hello Lum,

There are two things you have to change.
First: remove the 'complete' from the command sequence. sd-call-cmds implies that you want positive termination of the action.
Second: the way you pass the parameter to bspline_int is wrong. Type into command line
(trace bspline_int)
and call your dialog. Look at the output in the console window. You'll see that the dialog bspline_int gets a list of points as input. But it expects single points. For this purpose there exists the function 'apply' in LISP. Your code should look like this:
(sd-call-cmds (apply 'BSPLINE_INT POINT_LIST))

Now check again the output in the console window. You'll see that the points are passed point by point.

Dorothea

CF_Lum
10-28-2004, 11:04 PM
Hi Dorothea,

Thanks a lot!:D