當前位置:編程學習大全網 - 編程軟體 - 模具CAD的LISP程序畫函數曲線。幫幫忙~

模具CAD的LISP程序畫函數曲線。幫幫忙~

阿基米德螺旋線

用autolisp編程可以實現.

(command "pline" )

(setq n 0)

(repeat 1000

(command (polar (list 0 0) (/ n 57.3) n))

(setq n (1+ n))

)

(command)

彈簧和螺紋(三維)

1、打開CAD後,找工具/AUTOLISP/VISUAL LISP編輯器,打開.點新建文件

2、然後輸入

(defun c:luoxuan

(/)

(setq b1 (getpoint "請指定螺旋線基點: "))

(setq r (getreal "請輸入螺紋平均半徑: "))

(setq disp (getreal "請輸入螺紋節距: "))

(setq n (getint "請輸入每圈細化段數: "))

(setq delta (/ (* 2.0 pi) n))

(setq j (/ disp n))

(setq bb (caddr b1))

(setq ang 0)

(setq jj 0)

(Command "UCS" "o" b1)

(Command "3dpoly" (list r 0 0))

(repeat n

(setq jj(+ jj 1)

(setq ang(+ delta ang))

(setq pt2(list (* r (cos ang)) (* r (sin ang)) (+ 0 (* j jj))))

(Command pt2)

)

(Command "")

)

存盤為luoxuan.lsp,關閉編輯器

3、要用時,點工具/AUTOLISP/加載,找到luoxuan.lsp文件將其加載,關閉對話框.在命令行輸入luoxuan回車,就開始了螺旋線的繪制

我來補充

頂壹下(0)

  • 上一篇:有計算機編程底子,能學PLC嗎?還有觸摸屏
  • 下一篇:劉佩玉教授:什麽樣的學生適合參加NOIP競賽?
  • copyright 2024編程學習大全網