知識社群登入
位置: AutoCAD開放式教學 > 討論區 > 討論
AutoLISP for plot-sin
1樓
; file: plot-sin.lsp

; y= sin(x), x= 0 to pi

(setq x1 0.0 x2 pi no 16
      dx (/ (- x2 x1) no))

; for x= x1 to x2 step dx do ...
(setq x x1 x2 (+ x2 (/ dx 10.0)))

(command "spline")
(while (<= x x2)
  (setq y (sin x))
  (command (list x y))

  (setq x (+ x dx))
  ); end of while()
(command "" "" "")
; end of file