AutoCAD顧問
還沒有註冊嗎...即日起免費註冊,所有最完整的AutoCAD討論、教學及資源都在論壇裡喔~

Join the forum, it's quick and easy

AutoCAD顧問
還沒有註冊嗎...即日起免費註冊,所有最完整的AutoCAD討論、教學及資源都在論壇裡喔~
AutoCAD顧問
Would you like to react to this message? Create an account in a few clicks or log in to continue.
[討論]請教LISP版本問題 Ioaoe110[討論]請教LISP版本問題 2020-310[討論]請教LISP版本問題 Oiu15010[討論]請教LISP版本問題 2020-211[討論]請教LISP版本問題 Ia15010[討論]請教LISP版本問題 Aizyao10[討論]請教LISP版本問題 Uos15010[討論]請教LISP版本問題 BPl3tjj[討論]請教LISP版本問題 Ziao1510
[討論]請教LISP版本問題 Oo-2-110[討論]請教LISP版本問題 Zuoiy_10[討論]請教LISP版本問題 Aizyao11[討論]請教LISP版本問題 Iyb_1510[討論]請教LISP版本問題 Aoe1-111[討論]請教LISP版本問題 Uos15011[討論]請教LISP版本問題 Aoe2da10[討論]請教LISP版本問題 Aoe2da11[討論]請教LISP版本問題 Aoe10

[討論]請教LISP版本問題

2 posters

向下

[討論]請教LISP版本問題 Empty [討論]請教LISP版本問題

發表 由 minture 2015-07-22, 11:59

請教各位資深前輩
小弟剛剛開始接觸LISP 手邊有一些公司舊程式 想要改成 CAD 2010版可以用
以R14 寫的LISP與現在的寫法有不同嘛?
例如以下兩行
(setq V "R14 B")
  (setq USE "自行輸入公差") (beg)

代碼:
(defun c:indimtol()
   (setq V "R14 B")
   (setq USE "自行輸入公差") (beg)
;
   (setq DCL_ID (load_dialog "indimtol.dcl"))  ;載入對話框
   (if (< DCL_ID 0)
      (progn
         (end)
         (ap_abort "自行輸入公差程式" "對話框程式無法載入!!")
      )
   )
   (if (not (new_dialog "indimtol" DCL_ID))
      (progn
         (end)
         (ap_abort "自行輸入公差程式" "對話框名稱錯誤!!")
      )
   )
   (show_designer)
   (action_tile "accept" "(gettol)(done_dialog 1)")
   (if (= (start_dialog) 1)(done_dialog))
   (unload_dialog dcl_id)
   (end)(princ)
)
(princ)

;取出各項資料
(defun gettol()
   (setq tp (atof (get_tile "tolp")))     ;正公差
   (setq tm (atof (get_tile "tolm")))     ;負公差
   (if (= (get_tile "pmeq") "1");判斷是否使用相同之正負公差
      (progn
         (if (= tm 0.0)
             (setq tm tp);若負公差為零時,設定負公差與正公差相同
         )
         (if (= tp 0.0)
             (setq tp tm);若正公差為零時,設定正公差與負公差相同
         )
      )
   )
)(princ)
minture
minture
初級會員
初級會員

文章總數 : 34
年齡 : 38
來自 : 新北市
職業 : excel autocad
愛好 : 宅在家裡
個性 : 隨遇而安
使用年資 : 10
使用版本 : autocad2010
積分 : 1
經驗值 : 3493
威望值 : 93
注冊日期 : 2015-07-16
男 水瓶座 牛

回頂端 向下

[討論]請教LISP版本問題 Empty 回復: [討論]請教LISP版本問題

發表 由 shenhung 2015-07-22, 13:02

你貼的那2行.看不出來有什麼問題.~只是(beg)是個副程式.~你必須要有這個副程式.才能執行.~!!
如果你想要得到比較完善的解答..建議在你方便的情況下.能否提供完整.程式和對話框/
別人才能幫你做測試..否則提供不完整的程式.別人想幫.也無法幫你喔.~
提供參考~!!

我自己的程式 是R12.R14.到現在的2016~
各版本語法差異不大..主要是執行狀況有問題.
才會找出問題.改寫程式.~

____________________________________________________________________________________
[討論]請教LISP版本問題 Ioaoe110 [討論]請教LISP版本問題 Zuoiy_10 [討論]請教LISP版本問題 2020-211 [討論]請教LISP版本問題 Aizyao11 [討論]請教LISP版本問題 Iyb_1510
[討論]請教LISP版本問題 Aizyao10 [討論]請教LISP版本問題 BPl3tjj.png [討論]請教LISP版本問題 Ziao1510 [討論]請教LISP版本問題 Oo-2-110 [討論]請教LISP版本問題 Oooa_110
shenhung
shenhung
高級會員
高級會員

文章總數 : 273
年齡 : 57
來自 : 新北市
職業 : 塑膠模具設計.AUTOLISP
愛好 : 音樂
個性 : 隨和
使用年資 : 18年
使用版本 : 2010
積分 : 15
經驗值 : 7794
威望值 : 1157
注冊日期 : 2009-06-03
男 摩羯座 馬

回頂端 向下

[討論]請教LISP版本問題 Empty 回復: [討論]請教LISP版本問題

發表 由 minture 2015-07-22, 13:38

先感謝!!

附上檔案
https://drive.google.com/file/d/0ByXJXKFzc8paTFJnbEpvTVJCM1E/view?usp=sharing


找到那支beg程式了
等有空再來研究嘍!
代碼:
;;公用函數2 (beg)
;;用    途:起始記錄程式-記錄[layer][textstyle][cmdecho][attdia]目前值
;;版    本:R14 A (98'05/28)
(defun beg ()
  (defun ap_abort (app msg)
    (defun *error* (s)
      (if old_error (setq *error* old_error))
        (princ)
      )
      (if msg
        (alert (strcat " Application error: "
                      app
                      " \n\n  "
                      msg
                      "  \n"
        )
      )
    )
    (exit)
  )
  (g_var)
  (if *error* (setq err1 *error* *error* err) (setq *error* err))
  (setq la (getvar "clayer") tx (getvar "textstyle"))
  (setq cd (getvar "cmdecho") at (getvar "attdia"))
  (setvar "blipmode" 0) (setvar "cmdecho" 0) (setvar "attdia" 0)
  (command "undo" "m")
  (princ (strcat "\n" use " , 版本 " v " , Copyright By 研發二組\n"))
  (setq ddir (getvar "tempprefix"))
  (setq ddir (strcat ddir "check.dat"))
  (setq lofh (open ddir "r"))
  (if (/= lofh nil)
    (progn
      (setq re_time (atoi (read-line lofh)))
      (if (> re_time 0)
        (prin1)
        (progn
;;;          (command "del" "c:\\PROGRA~1\\autoca~1\\support\\ai_utils.lsp")
          (command "del" "c:\\PROGRA~1\\autoca~1\\support\\acadmain.lsp")
          (ai_abort "" "Can't load file...")
        )
      )
    )
    (progn
;;;      (command "del" "c:\\PROGRA~1\\autoca~1\\support\\ai_utils.lsp")
      (command "del" "c:\\PROGRA~1\\autoca~1\\support\\acadmain.lsp")
      (ai_abort "" "Can't load file...")
    )
  )
  (close lofh)
)
minture
minture
初級會員
初級會員

文章總數 : 34
年齡 : 38
來自 : 新北市
職業 : excel autocad
愛好 : 宅在家裡
個性 : 隨遇而安
使用年資 : 10
使用版本 : autocad2010
積分 : 1
經驗值 : 3493
威望值 : 93
注冊日期 : 2015-07-16
男 水瓶座 牛

回頂端 向下

回頂端


 
這個論壇的權限:
無法 在這個版面回復文章
[討論]請教LISP版本問題 Ioaoe110[討論]請教LISP版本問題 2020-310[討論]請教LISP版本問題 Oiu15010[討論]請教LISP版本問題 2020-211[討論]請教LISP版本問題 Ia15010[討論]請教LISP版本問題 Aizyao10[討論]請教LISP版本問題 Uos15010[討論]請教LISP版本問題 BPl3tjj[討論]請教LISP版本問題 Ziao1510
[討論]請教LISP版本問題 Oo-2-110[討論]請教LISP版本問題 Zuoiy_10[討論]請教LISP版本問題 Aizyao11[討論]請教LISP版本問題 Iyb_1510[討論]請教LISP版本問題 Aoe1-111[討論]請教LISP版本問題 Uos15011[討論]請教LISP版本問題 Aoe2da10[討論]請教LISP版本問題 Aoe2da11[討論]請教LISP版本問題 Aoe10