幫忙編寫個lisp語言程式(簡單的數字加減)

時間 2025-02-05 02:15:18

1樓:

;;已為你寫好程式,功能比你要求的還要好。

print "圖號修改(型如gcgs2010-165-19,若為多行文字請先炸開),命令:thxg")

defun c:thxg(/ all endno aa bb cc wz tha thh thq th srz)

if (null xzz) (setq xzz 0))

setq srz(getint (strcat "輸入修正值<" itoa xzz) "

if (not (null srz)) setq xzz srz))

setq all (ssget(list (cons 0 "text"))

if all (setq nn (sslength all)))

print (strcat "設定的修改值為:" itoa xzz)))

setq endno 0)

while (and (setq aa (ssname all endno))

setq bb (entget aa))

setq cc(cdr(assoc 1 bb)))

setq wz(rinstr cc "-

setq tha(substr cc (+wz 1) (strlen cc) wz -1)))

setq thh(itoa (+atoi tha) xzz)))

setq thq (substr cc 1 wz))

setq th(strcat thq thh))

setq bb (subst (cons 1 th) (assoc 1 bb) bb))

entmod bb)

print (strcat cc "已修改為" th))

setq endno (+endno 1))

print)

defun rinstr(str cset / len i aa)

if (>strlen str) 0)

prognsetq i (strlen str))

setq aa(substr str (strlen str) 1))

while (and (/aa cset) (i 1))

setq i(1- i))

setq aa(substr str i 1))

setq i i)

2樓:甘曦之

defun c:gbh()

princ "請選擇要修改的圖紙編號:")setq bhj(ssget (list(cons 0 "text"))

princ "請選輸入修改圖紙編號常數:")setq xs(getint))

setq bhs(sslength bhj))setq ll(1- bhs))

while (>ll -1)

setq e(ssname bhj ll))setq q(entget e))

setq bhwb(cdr(assoc 1 q)))setq bhwbcd(strlen bhwb))setq bhwbxhcd (1- bhwbcd))while (>bhwbxhcd 0)

setq zf(substr bhwb bhwbxhcd 1))if (=zf "-progn(setq zfc1(substr bhwb (1+ bhwbxhcd)))setq zfc2(substr bhwb 1 bhwbxhcd))(setq bhwbxhcd 0)))

setq bhwbxhcd(1- bhwbxhcd))setq zfc1(+ xs (atoi zfc1)))setq zfc(strcat zfc2 (itoa zfc1)))setq b1 (cons '1 zfc))setq q(subst b1(assoc 1 q)q))entmod q)

setq ll(1- ll))

反上述**複製到記事本,儲存字尾名為".lsp"檔案,在cad中載入,命令名為"gbh"

幫忙用perl編寫個程式

自己寫吧,遇到什麼困難可以討論,打字不是我的強項 perl是指令碼語言還是什麼語言?perl 一般被稱為 實用報表提取語言 practicalextraction andreportlanguage 雖然有時被稱做 病態折中垃圾列表器 pathologicallyeclectic rubbish li...

用c語言編寫簡單計算器程式,用c語言編寫一個簡單計算器程式

問明 include stdio h 計算器 voidmenu 自定義的選單介面 printf n printf 請輸入你的選擇 n printf 1 n printf 2 n printf 3 n printf 4 n printf n intmain inti 0 intj 0 intnum 0...

C 編寫個圖書管理系統程式,C 編寫個圖書管理系統程式

這個由於你給的分太少,估計每人會給你做的。我給你一個做參照吧,基本功能都已經實現了,並且在vc6上已經編譯執行確認 include include include include 輸入 輸出檔案流類 using namespace std const int maxr 100 最多的讀者 const...