PDA

View Full Version : Pass a list of points to Spline command


bowtle
2009-07-22, 04:56 AM
I am trying to write a lisp routine that will create offset 3d polylines and splines.

I pick a series of points to define the vertices and calculate the co-ordinates of the offset vertices.

I can draw a 3d polyline, but can not get it to work for the spline, I think it is because the spline command is expecting tangents to be specified.

I used the following for the 3DPoly .. ss_L is a list of 3D points


(command "._3Dpoly" )
(foreach Pt ss_L (command Pt ) )
(command)


I have tried various combinations for the Spline but cant figure it out.

Any help would be greatly appreciated.

kpblc2000
2009-07-22, 07:52 AM
(defun make-spline (point-list)
(command "_.spline")
(foreach point point-list
(command "_none" point)
) ;_ end of foreach
(while (/= (getvar "cmdactive") 0)
(command "")
) ;_ end of while
) ;_ end of defun

;; testing
(defun test (/ pt lst)
(while (= (type (setq pt (vl-catch-all-apply
(function
(lambda ()
(getpoint "\nPick point <Cancel> : ")
) ;_ end of lambda
) ;_ end of function
) ;_ end of vl-catch-all-apply
) ;_ end of setq
) ;_ end of type
'list
) ;_ end of =
(setq lst (cons pt lst))
) ;_ end of while
(make-spline (reverse lst))
) ;_ end of defun

bowtle
2009-07-22, 11:44 AM
Thanks kpblc, that works fantastic

I finally worked out another way, not as elegant as yours, but it worked


(command "._Spline" )
(foreach Pt ss_R (command Pt )) (command "" tan_first tan_last "")



Thanks again