Re: [心得] 讓fortran 叫 AutoCAD 自動畫圖的方法

看板Fortran作者 (sjgau)時間15年前 (2008/09/09 12:11), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/4 (看更多)
指令: area 指定第一個角點或 [物件(O)/加(A)/減(S)]: o 選取物件: 面積 = 1.984885,周長 = 6.619935 以上,是 AutoLISP 程式 叫AutoCAD 自動畫出 sin() curve 後,叫 AutoCAD 計算曲線下面的面積 所得到的答案,可以作為 下面 check 之用。 AutoLISP 程式列表如下: ; file: plot-sin.lsp ; plot y= sin(x), from x1 to x2, step dx ; dx= (x2 - x1)/no ; no= ??? (setq x1 (getreal "\n x1=? (ex. 0.1) ") x2 (getreal "\n x2=? (ex. 3.0) ") no (getint "\n no=? (ex. 16) ")) ; for x= x1 to x2 step dx (setq dx (/ (- x2 x1) no) x2 (+ x2 (/ dx 10.0))) (setq x x1) (command "spline") (while (<= x x2) (setq y (sin x)) (command (list x y)) (setq x (+ x dx)) ); end while() (command "" "" "") (command "zoom" "e") (princ) ; end of file ※ 引述《sjgau (sjgau)》之銘言: : 先定義問題 和 過程 以及中間點的 檢查方法 : plot y= sin(x), from x1 to x2, step dx : dx= (x2 - x1)/no : 限定 x1 < x2, : x1, x2 >= 0, 而且 <= pi : pi= 4.0*atan(1.0) : no >= 10, 而且 <= 100 : 產生 (x, y) 的數據資料 放入 陣列之內 : 使用 辛普森積分 得到曲線下的面積 : 應該 大於 0, 小於 2.0, --> A1 : 將來 叫AutoCAD 自動畫圖以後 : 會得到面積 --> A2 : 兩者應該一致 : OK, 請大家 拭目以待 : 有興趣的 幫忙推一下 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.231.148.190
文章代碼(AID): #18nVTuvn (Fortran)
文章代碼(AID): #18nVTuvn (Fortran)