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.
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Ioaoe110[已解決]求~~文字數字加總計算的lsp? - 頁 2 2020-310[已解決]求~~文字數字加總計算的lsp? - 頁 2 Oiu15010[已解決]求~~文字數字加總計算的lsp? - 頁 2 2020-211[已解決]求~~文字數字加總計算的lsp? - 頁 2 Ia15010[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aizyao10[已解決]求~~文字數字加總計算的lsp? - 頁 2 Uos15010[已解決]求~~文字數字加總計算的lsp? - 頁 2 BPl3tjj[已解決]求~~文字數字加總計算的lsp? - 頁 2 Ziao1510
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Oo-2-110[已解決]求~~文字數字加總計算的lsp? - 頁 2 Zuoiy_10[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aizyao11[已解決]求~~文字數字加總計算的lsp? - 頁 2 Iyb_1510[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aoe1-111[已解決]求~~文字數字加總計算的lsp? - 頁 2 Uos15011[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aoe2da10[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aoe2da11[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aoe10

[已解決]求~~文字數字加總計算的lsp?

+31
sireny238
Tina Yen
zxc2525123
linxyz168
winnie
Yulunwei
yuting120
monkeyx2
白金之星
阿之
ltea57055
pc200098
jess198109
cheyuan1983
regina
tooth525
阿強
惡魔紫
wwsh3
YU HSIANG
YLCHEN
ysl yang
Tiger&蘋果爸
tarpon
王小美
NaNa
bruce79
lsj
ginse0727
iccs
35 posters

1頁(共2頁) 1, 2  下一步

向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty [已解決]求~~文字數字加總計算的lsp?

發表 由 iccs 2010-09-05, 21:32

主題回顧 :

小弟是從事水電工程繪圖的~一直有管料統計的困擾,請問大家,是否有文字數字加總計算的lsp呢? 簡述如下圖:
[已解決]求~~文字數字加總計算的lsp? - 頁 2 50200305

是否有那種當我框選文字(文字內容為數字時),lsp能自動幫我加總總和(300+2580+87148+65550=?)的程式呢? 感謝大家~


iccs 在 2010-09-06, 19:22 作了第 1 次修改
iccs
iccs
初級會員
初級會員

文章總數 : 50
年齡 : 42
來自 : 高雄
職業 : 消防設計
愛好 : 電腦、電影、上網
個性 : 龜毛
使用年資 : 10年
使用版本 : AutoCAD 2016
積分 : 1
經驗值 : 5636
威望值 : 21
注冊日期 : 2009-04-28
串連貼紙成功 男 金牛座 雞

回頂端 向下


[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 惡魔紫 2011-09-21, 14:50

感謝分享

之前一直用計算機算

現在終於可以直接在CAD上算

惡魔紫
惡魔紫
初級會員
初級會員

文章總數 : 30
年齡 : 46
來自 : 台中
職業 : 機械製圖
愛好 : 游泳.線上遊戲
個性 : 愛玩
使用年資 : 5
使用版本 : 2012
積分 : 1
經驗值 : 4721
威望值 : 24
注冊日期 : 2011-08-19
藍鵲15號
男 處女座 蛇

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 阿強 2012-02-01, 15:58

剛好有需要~謝謝大大分享~
阿強
阿強
一般會員
一般會員

文章總數 : 9
年齡 : 46
來自 : 台北
職業 : 服務
愛好 : 上網
個性 : 沉默
經驗值 : 5366
威望值 : 9
注冊日期 : 2009-08-13
男 巨蟹座 蛇

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty [分享]文字計算程式更新

發表 由 ginse0727 2012-02-14, 12:47

依lsj前輩的建議內容,再將程式內容精簡,

另外新增計算單位設定,及計算完的結果,可以回貼所選的文字裡.

代碼:

;文字數值計算加總
(defun c:tea(/ i num sum);/ en ds i endata num sum #dd)
  (prompt "\n框選統計數值:")
  (setq ds (ssget '((0 . "*text"))))
  (setq #dd(getint "\n小數位數<0>:"))
  (if (null #dd) (setq #dd 0))
  (setq   i 0 sum 0 numlist '())
  (repeat (sslength ds)
    (setq en (ssname ds i))
    (setq endata (entget en))
    (setq num (cdr(assoc 1 endata)))
    (setq sum (+ (atof num) sum))
    (setq i (1+ i))
    )
  (returntea sum #dd)
  (prin1)
  )

;回填計算值至文字中
(defun returntea(#sum #dd)
  (setq newval(cons 1 (rtos #sum 2 #dd)))
  (setq en (entsel "\n選取總合貼附:"))   ;;;選取欲貼上計算值的text
  (if (null en)
    (alert (strcat "選取數值總合=" (rtos #sum 2 #dd)))
    (progn
      (setq endata (entget (car en)))
      (setq oldval (assoc 1 endata))
      (setq endata (subst newval oldval endata))
      (entmod endata)
      )
    )
  )
ginse0727
ginse0727
高級會員
高級會員

文章總數 : 256
年齡 : 49
來自 : 台北巿
職業 : 帷幕牆
愛好 : 電玩,漫畫,網路小說
個性 : 宅男/正直/死腦筋
使用年資 : 退伍後工作迄今,10年以上
使用版本 : 2012
積分 : 14
經驗值 : 6590
威望值 : 500
發帖精華 : 1
注冊日期 : 2010-07-13
經典問與答讀者 藍鵲61號
2011聚會勳章 男 獅子座 虎

tch0903 likes this post

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 tooth525 2012-02-15, 10:14

很高興高手雲集,那請問是否有"計算機"呢?請問新板
有嗎?我的2004沒有~以前我寫了單鍵"+"能計算
但不能先乘除後加減至少省去找計算機的麻煩...

代碼:
(DEFUN C:+(/ wd da db no0 no1 non ns naa nab)
  (setq wd (getstring "\nNo.>>: "))
  (setq da nil db nil no0 1 naa nil non (strlen wd) ns 1 no1 0)
  (if (= d1 nil) (setq d1 0))
  (while  (< no0 (+ non 2))
      (setq naa (substr wd no0 1))
      (if (or (= "+" naa) (= "-" naa) (= "*" naa) (= "/" naa)(= """" naa))
          (progn
          (if da
              (progn
                  (setq db (atof (substr wd ns no1)))
                  (cond ((= "+" nab)
                        (setq d1 (+ da db))
                        )
                        ((= "-" nab)
                        (setq d1 (- da db))
                        )
                        ((= "*" nab)
                        (setq d1 (* da db))
                        )
                        ((= "/" nab)
                        (setq d1 (/ da db))
                        )
                  ) (setq da d1)
              );progn yes da
              (if (= no0 1) (setq da d1) (setq da (atof (substr wd ns no1))))
          );if da
          (setq no1 -1 ns (+ no0 1) nab naa)
          );progn
      );if
      (setq no1 (+ no1 1) no0 (+ no0 1))
  );while
  (Grtext 22 (RTOS D1 2 6))
  (COMMAND "OFFSET" (ABS D1) "");順便把OFFSET值也改了
  (prompt "\    = ") (eval d1)
)
tooth525
tooth525
初級會員
初級會員

文章總數 : 43
年齡 : 59
來自 : 彰化
職業 : CNC線切割
愛好 : 看影集,唱唱歌
個性 : 溫合/樂觀/善於分析
使用年資 : 30年
使用版本 : 2004
積分 : 2
經驗值 : 4934
威望值 : 143
注冊日期 : 2011-08-03
經典問與答讀者 男 白羊座 蛇

otisgogo likes this post

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 tooth525 2012-02-15, 10:37

請問若有符號與數量時該怎麼改呢
[img][已解決]求~~文字數字加總計算的lsp? - 頁 2 Suml[/img]
tooth525
tooth525
初級會員
初級會員

文章總數 : 43
年齡 : 59
來自 : 彰化
職業 : CNC線切割
愛好 : 看影集,唱唱歌
個性 : 溫合/樂觀/善於分析
使用年資 : 30年
使用版本 : 2004
積分 : 2
經驗值 : 4934
威望值 : 143
注冊日期 : 2011-08-03
經典問與答讀者 男 白羊座 蛇

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 ginse0727 2012-02-16, 12:46

tooth525 寫到:請問若有符號與數量時該怎麼改呢
[img][已解決]求~~文字數字加總計算的lsp? - 頁 2 Suml[/img]

您的問題,我覺得應該是要從字串處理上著手,就我的功力而論,感覺處理上還算有些困難,
不好意思,因為現在家裡有小BABY,每天空閒的時間很有限,等比較有空時我會來研究一下,
當然論壇上的高手很多,說不定很快的就有前輩幫您解了,不過建議您新開一篇專欄來問,
看到問題的人才會比較多哦!
ginse0727
ginse0727
高級會員
高級會員

文章總數 : 256
年齡 : 49
來自 : 台北巿
職業 : 帷幕牆
愛好 : 電玩,漫畫,網路小說
個性 : 宅男/正直/死腦筋
使用年資 : 退伍後工作迄今,10年以上
使用版本 : 2012
積分 : 14
經驗值 : 6590
威望值 : 500
發帖精華 : 1
注冊日期 : 2010-07-13
經典問與答讀者 藍鵲61號
2011聚會勳章 男 獅子座 虎

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 tooth525 2012-03-08, 13:43

tooth525 寫到:請問若有符號與數量時該怎麼改呢
[img][已解決]求~~文字數字加總計算的lsp? - 頁 2 Suml[/img]
改好了
代碼:
(DEFUN C:++()
(setq s1 (ssget) sslen (sslength s1) I (1- sslen) d1 0 d2 0)
(while (>= I 0)
 (setq s2 (ssname s1 I)
      ent (cdr (assoc 1 (entget s2)))     
 ) 
 (progn 
  (setq wd ent)
  (if (= "$" (substr wd 1 1))
      (setq wd (substr wd 2))
  ) 
  (prompt "  取得: ")(princ wd)
  (c+++)
  (prompt "=")(princ d1)
  (setq d2 (+ d1 d2))
  (setq I (1- I))
 );p
);w
  (prompt "  合計= ")(princ d2)
  (setq inspt (getpoint "\nESC結束或寫入點: "))
  (command "text" inspt "0" (strcat "$" (rtos d2 2 0)))
  (prin1)
)
(DEFUN C+++(/ da db no0 no1 non ns naa nab)
  (setq da nil db nil no0 1 naa nil non (strlen wd) ns 1 no1 0)
  (setq d1 (atof wd));add
    (while  (< no0 (+ non 2))
      (setq naa (substr wd no0 1))
      (if (or (= "+" naa) (= "-" naa) (= "*" naa) (= "X" naa) (= "x" naa) (= "/" naa)(= """" naa))
          (progn
          (if da
              (progn
                  (setq db (atof (substr wd ns no1)))      
        (cond ((= "+" nab)
                        (setq d1 (+ da db))
                        )
                        ((= "-" nab)
                        (setq d1 (- da db))
                        )
         ((= "X" nab)
                        (setq d1 (* da db))
                        )
                        ((= "x" nab)
                        (setq d1 (* da db))
                        )
         ((= "*" nab)
                        (setq d1 (* da db))
                        )
                        ((= "/" nab)
                        (setq d1 (/ da db))
                        )
                  )
        (setq da d1)
              );progn yes da
              (if (= no0 1) (setq da d1) (setq da (atof (substr wd ns no1))))
          );if da
          (setq no1 -1 ns (+ no0 1) nab naa)
          );progn
      );if
      (setq no1 (+ no1 1) no0 (+ no0 1))
  );while 
)
tooth525
tooth525
初級會員
初級會員

文章總數 : 43
年齡 : 59
來自 : 彰化
職業 : CNC線切割
愛好 : 看影集,唱唱歌
個性 : 溫合/樂觀/善於分析
使用年資 : 30年
使用版本 : 2004
積分 : 2
經驗值 : 4934
威望值 : 143
注冊日期 : 2011-08-03
經典問與答讀者 男 白羊座 蛇

abc705220 and hongren24 like this post

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 regina 2014-07-22, 15:34

非常實用的程式,可以節省不少工作時間 嘻嘻 太感謝了
regina
regina
專屬會員
專屬會員

文章總數 : 62
年齡 : 48
來自 : 臺中市
職業 : 鋼筋施工圖
愛好 : 吸收新知
個性 : 內斂
使用年資 : 8年
使用版本 : 2013
經驗值 : 5470
威望值 : -3
注冊日期 : 2009-10-24
顧問外掛程式 經典問與答讀者 女 水瓶座 龍

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 cheyuan1983 2015-03-14, 20:39

正好需要數字加總的程式,非常謝謝分享!!

____________________________________________________________________________________

cheyuan1983
cheyuan1983
一般會員
一般會員

文章總數 : 19
年齡 : 41
來自 : Taipei
職業 : 工程師
愛好 : 爬山.攝影.旅遊
個性 : 隨和
使用年資 : 新手初學
使用版本 : 新手初學
積分 : 1
經驗值 : 4358
威望值 : 6
注冊日期 : 2012-07-14
經典問與答讀者 藍鵲535號
男 水瓶座 狗

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 jess198109 2015-08-27, 11:43

熱情 太方便了~無限感激

____________________________________________________________________________________

jess198109
jess198109
贊助會員
贊助會員

文章總數 : 45
年齡 : 42
來自 : 台中
職業 : 待業中
愛好 : 繪圖
個性 : 內斂
使用年資 : 3
使用版本 : 2007
經驗值 : 5039
威望值 : 6
注冊日期 : 2011-01-04
藍鵲503號
女 處女座 雞

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 pc200098 2017-01-05, 23:20

tooth525 寫到:
tooth525 寫到:請問若有符號與數量時該怎麼改呢
[已解決]求~~文字數字加總計算的lsp? - 頁 2 <a href=[已解決]求~~文字數字加總計算的lsp? - 頁 2 Suml" />
改好了
代碼:
(DEFUN C:++()
(setq s1 (ssget) sslen (sslength s1) I (1- sslen) d1 0 d2 0)
(while (>= I 0)
 (setq s2 (ssname s1 I)
       ent (cdr (assoc 1 (entget s2)))      
 )  
 (progn  
   (setq wd ent)
   (if (= "$" (substr wd 1 1))
       (setq wd (substr wd 2))
   )  
   (prompt "  取得: ")(princ wd)
   (c+++)
   (prompt "=")(princ d1)
   (setq d2 (+ d1 d2))
   (setq I (1- I))
 );p
);w
  (prompt "  合計= ")(princ d2)
  (setq inspt (getpoint "\nESC結束或寫入點: "))
  (command "text" inspt "0" (strcat "$" (rtos d2 2 0)))
  (prin1)
)
(DEFUN C+++(/ da db no0 no1 non ns naa nab)
   (setq da nil db nil no0 1 naa nil non (strlen wd) ns 1 no1 0)
   (setq d1 (atof wd));add
     (while  (< no0 (+ non 2))
       (setq naa (substr wd no0 1))
       (if (or (= "+" naa) (= "-" naa) (= "*" naa) (= "X" naa) (= "x" naa) (= "/" naa)(= """" naa))
          (progn
           (if da
               (progn
                  (setq db (atof (substr wd ns no1)))
  (cond ((= "+" nab)
                         (setq d1 (+ da db))
                        )
                        ((= "-" nab)
                         (setq d1 (- da db))
                        )
 ((= "X" nab)
                         (setq d1 (* da db))
                        )
                        ((= "x" nab)
                         (setq d1 (* da db))
                        )
 ((= "*" nab)
                         (setq d1 (* da db))
                        )
                        ((= "/" nab)
                         (setq d1 (/ da db))
                        )
                  )
  (setq da d1)
               );progn yes da
               (if (= no0 1) (setq da d1) (setq da (atof (substr wd ns no1))))
           );if da
          (setq no1 -1 ns (+ no0 1) nab naa)
          );progn
       );if
       (setq no1 (+ no1 1) no0 (+ no0 1))
   );while  
)

回應tooth525大,因您改好的代碼在插入文字時因沒指定文字高度,所以插入文字功能被迫中斷
我改好讓使用者在插入文字時自訂文字高度,並整理排列
有需要的拿去使用吧~

代碼:
(Defun C:++()
  (setq s1 (ssget) sslen (sslength s1) I (1- sslen) d1 0 d2 0)
  (while (>= I 0)
    (setq s2 (ssname s1 I)
  ent (cdr (assoc 1 (entget s2)))
  );setq
    (progn
      (setq wd ent)
      (if (= "$" (substr wd 1 1))
      (setq wd (substr wd 2))
 );if
  (prompt "  取得: ")(princ wd)(c+++)(prompt "=")(princ d1)
  (setq d2 (+ d1 d2))
  (setq I (1- I)
 );setq
      );progn
    );while
  (prompt "  合計= ")
  (princ d2)
  (setq inspt1 (getpoint "\nESC結束或寫入點: "))
  (setq texthigh (getreal "\n請輸入文字高度:"))
  (command "text" inspt1 texthigh "0" (rtos d2 2 0))
  (prin1)
  );Defun

(Defun C+++(/ da db no0 no1 non ns naa nab)
  (setq da nil db nil no0 1 naa nil non (strlen wd) ns 1 no1 0)
  (setq d1 (atof wd));add
    (while  (< no0 (+ non 2))
      (setq naa (substr wd no0 1))
      (if (or (= "+" naa) (= "|" naa)  (= "-" naa) (= "*" naa) (= "X" naa) (= "x" naa) (= "/" naa) (= """" naa))
          (progn (if da (progn (setq db (atof (substr wd ns no1)
      )
     )
  (cond
    ((= "+" nab)(setq d1 (+ da db)))
    ((= "|" nab)(setq d1 (+ da db)))
    ((= "-" nab)(setq d1 (- da db)))
    ((= "X" nab)(setq d1 (* da db)))
    ((= "x" nab)(setq d1 (* da db)))
    ((= "*" nab)(setq d1 (* da db)))
    ((= "/" nab)(setq d1 (/ da db)))
    )
  (setq da d1)
  );progn yes da
   (if (= no0 1) (setq da d1) (setq da (atof (substr wd ns no1))))
   );if da
    (setq no1 -1 ns (+ no0 1) nab naa)
    );progn
 );if
      (setq no1 (+ no1 1) no0 (+ no0 1))
      );while
  );Defun

____________________________________________________________________________________
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Ioaoe110 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Zuoiy_10 [已解決]求~~文字數字加總計算的lsp? - 頁 2 2020-211 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Aizyao11 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Iyb_1510
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aizyao10 [已解決]求~~文字數字加總計算的lsp? - 頁 2 BPl3tjj.png [已解決]求~~文字數字加總計算的lsp? - 頁 2 Ziao1510 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Oo-2-110 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Oooa_110
pc200098
pc200098
初級會員
初級會員

文章總數 : 49
年齡 : 38
來自 : 台南市
職業 : 機械製圖
愛好 : 電玩
個性 : 執著
使用年資 : 12
使用版本 : 2013&2016
積分 : 1
經驗值 : 5049
威望值 : 53
注冊日期 : 2011-03-10
男 天秤座 牛

ailoveu911 and Alan_Tsai like this post

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 ltea57055 2017-08-19, 01:35

終於看到有關運算的lsp了
不過我想要的是相乘的... 暈倒
算線切割面積用的
ltea57055
ltea57055
初級會員
初級會員

文章總數 : 54
年齡 : 31
來自 : 台灣嘉義
職業 : 模具工程師
愛好 : 玩遊戲,看影片、漫畫
個性 : 休閒過生活
使用年資 : 8年
使用版本 : 2005/2016
AutoCAD基礎篇等級 : 10星級
積分 : 1
經驗值 : 2707
威望值 : 84
注冊日期 : 2017-08-17
男 摩羯座 猴

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 阿之 2019-02-15, 17:54

文字數字加總計算的lsp無法下載...

工作遇到瓶頸... 頭暈目眩

請問可以分享嗎 感動

____________________________________________________________________________________
[已解決]求~~文字數字加總計算的lsp? - 頁 2 01310 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Acad1810
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Acad2010 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Acad1810
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Acad1211 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Acad1311 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Acad1511
[已解決]求~~文字數字加總計算的lsp? - 頁 2 07810
阿之
阿之
一般會員
一般會員

文章總數 : 21
年齡 : 49
來自 : 桃園
職業 : 繪圖
愛好 : 跑步
個性 : 三八
使用年資 : 10
使用版本 : 2010
經驗值 : 3352
威望值 : 0
注冊日期 : 2015-04-24
女 獅子座 虎

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 白金之星 2019-05-23, 13:40

很實用 謝謝

____________________________________________________________________________________
[已解決]求~~文字數字加總計算的lsp? - 頁 2 SegmentationLine31
avatar
白金之星
初級會員
初級會員

文章總數 : 243
年齡 : 46
來自 : 台北
職業 : 工頭
愛好 : AutoCad
個性 : 樂觀
使用年資 : 7
使用版本 : 2008
積分 : 4
經驗值 : 5845
威望值 : 9
未回應主題 : 您有一筆未回應
注冊日期 : 2008-09-22
男 白羊座 蛇

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 monkeyx2 2019-07-25, 17:30

愛你唷~啾咪
monkeyx2
monkeyx2
一般會員
一般會員

文章總數 : 5
年齡 : 32
來自 : 澳門
職業 : 電機
愛好 : autocad
個性 : autocad
使用年資 : 0
使用版本 : 2018
經驗值 : 2072
威望值 : 0
注冊日期 : 2018-08-16
男 雙魚座 猴

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 yuting120 2019-11-22, 10:05

非常實用,感謝分享~~
yuting120
yuting120
一般會員
一般會員

文章總數 : 14
年齡 : 45
來自 : 宜蘭
職業 : 建築設計
愛好 : 編織
個性 : 安靜
使用年資 : 10
使用版本 : 2012
經驗值 : 1970
威望值 : 12
注冊日期 : 2019-01-14
女 天秤座 馬

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 Yulunwei 2020-05-07, 04:50

爬了很多舊文發現很多好用的工具來去試用,謝謝分享
Yulunwei
Yulunwei
一般會員
一般會員

文章總數 : 14
年齡 : 33
來自 : 台北
職業 : 營造
愛好 : 郊遊
個性 : 熱情
使用年資 : 5
使用版本 : 2021
經驗值 : 2282
威望值 : 36
注冊日期 : 2018-03-26
男 射手座 馬

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 winnie 2021-01-31, 17:41

謝謝分享!

____________________________________________________________________________________
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Ioaoe110 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Zuoiy_10 [已解決]求~~文字數字加總計算的lsp? - 頁 2 2020-211 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Aizyao11 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Iyb_1510
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aizyao10 [已解決]求~~文字數字加總計算的lsp? - 頁 2 BPl3tjj.png [已解決]求~~文字數字加總計算的lsp? - 頁 2 Ziao1510 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Oo-2-110 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Oooa_110
winnie
winnie
專屬會員
專屬會員

文章總數 : 81
年齡 : 43
來自 : 台北縣
職業 : 工程業
愛好 : 文書
個性 : 溫和
使用年資 : 一年
使用版本 : 2008
經驗值 : 5604
威望值 : 6
注冊日期 : 2009-11-25
2D基礎函授 顧問外掛程式 經典問與答讀者 女 白羊座 猴

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 linxyz168 2021-12-02, 17:20

謝謝分享 數字加總很實用的程式。
linxyz168
linxyz168
專屬會員
專屬會員

文章總數 : 57
年齡 : 46
來自 : 新北市
職業 : 設計
愛好 : 看電影/打球
個性 : 隨和
使用年資 : 12年
使用版本 : 2011
經驗值 : 4297
威望值 : 12
注冊日期 : 2013-03-31
男 射手座 蛇

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 請問一下 如引用這lsp時 執行要輸入指令為?? 不是很懂lsp..

發表 由 linxyz168 2021-12-02, 18:34

pc200098 寫到:
tooth525 寫到:
tooth525 寫到:請問若有符號與數量時該怎麼改呢
[img]
改好了
代碼:
(DEFUN C:++()
(setq s1 (ssget) sslen (sslength s1) I (1- sslen) d1 0 d2 0)
(while (>= I 0)
 (setq s2 (ssname s1 I)
       ent (cdr (assoc 1 (entget s2)))      
 )  
 (progn  
   (setq wd ent)
   (if (= "$" (substr wd 1 1))
       (setq wd (substr wd 2))
   )  
   (prompt "  取得: ")(princ wd)
   (c+++)
   (prompt "=")(princ d1)
   (setq d2 (+ d1 d2))
   (setq I (1- I))
 );p
);w
  (prompt "  合計= ")(princ d2)
  (setq inspt (getpoint "\nESC結束或寫入點: "))
  (command "text" inspt "0" (strcat "$" (rtos d2 2 0)))
  (prin1)
)
(DEFUN C+++(/ da db no0 no1 non ns naa nab)
   (setq da nil db nil no0 1 naa nil non (strlen wd) ns 1 no1 0)
   (setq d1 (atof wd));add
     (while  (< no0 (+ non 2))
       (setq naa (substr wd no0 1))
       (if (or (= "+" naa) (= "-" naa) (= "*" naa) (= "X" naa) (= "x" naa) (= "/" naa)(= """" naa))
          (progn
           (if da
               (progn
                  (setq db (atof (substr wd ns no1)))
  (cond ((= "+" nab)
                         (setq d1 (+ da db))
                        )
                        ((= "-" nab)
                         (setq d1 (- da db))
                        )
 ((= "X" nab)
                         (setq d1 (* da db))
                        )
                        ((= "x" nab)
                         (setq d1 (* da db))
                        )
 ((= "*" nab)
                         (setq d1 (* da db))
                        )
                        ((= "/" nab)
                         (setq d1 (/ da db))
                        )
                  )
  (setq da d1)
               );progn yes da
               (if (= no0 1) (setq da d1) (setq da (atof (substr wd ns no1))))
           );if da
          (setq no1 -1 ns (+ no0 1) nab naa)
          );progn
       );if
       (setq no1 (+ no1 1) no0 (+ no0 1))
   );while  
)

回應tooth525大,因您改好的代碼在插入文字時因沒指定文字高度,所以插入文字功能被迫中斷
我改好讓使用者在插入文字時自訂文字高度,並整理排列
有需要的拿去使用吧~

代碼:
(Defun C:++()
  (setq s1 (ssget) sslen (sslength s1) I (1- sslen) d1 0 d2 0)
  (while (>= I 0)
    (setq s2 (ssname s1 I)
  ent (cdr (assoc 1 (entget s2)))
  );setq
    (progn
      (setq wd ent)
      (if (= "$" (substr wd 1 1))
      (setq wd (substr wd 2))
 );if
  (prompt "  取得: ")(princ wd)(c+++)(prompt "=")(princ d1)
  (setq d2 (+ d1 d2))
  (setq I (1- I)
 );setq
      );progn
    );while
  (prompt "  合計= ")
  (princ d2)
  (setq inspt1 (getpoint "\nESC結束或寫入點: "))
  (setq texthigh (getreal "\n請輸入文字高度:"))
  (command "text" inspt1 texthigh "0" (rtos d2 2 0))
  (prin1)
  );Defun

(Defun C+++(/ da db no0 no1 non ns naa nab)
  (setq da nil db nil no0 1 naa nil non (strlen wd) ns 1 no1 0)
  (setq d1 (atof wd));add
    (while  (< no0 (+ non 2))
      (setq naa (substr wd no0 1))
      (if (or (= "+" naa) (= "|" naa)  (= "-" naa) (= "*" naa) (= "X" naa) (= "x" naa) (= "/" naa) (= """" naa))
          (progn (if da (progn (setq db (atof (substr wd ns no1)
      )
     )
  (cond
    ((= "+" nab)(setq d1 (+ da db)))
    ((= "|" nab)(setq d1 (+ da db)))
    ((= "-" nab)(setq d1 (- da db)))
    ((= "X" nab)(setq d1 (* da db)))
    ((= "x" nab)(setq d1 (* da db)))
    ((= "*" nab)(setq d1 (* da db)))
    ((= "/" nab)(setq d1 (/ da db)))
    )
  (setq da d1)
  );progn yes da
   (if (= no0 1) (setq da d1) (setq da (atof (substr wd ns no1))))
   );if da
    (setq no1 -1 ns (+ no0 1) nab naa)
    );progn
 );if
      (setq no1 (+ no1 1) no0 (+ no0 1))
      );while
  );Defun
linxyz168
linxyz168
專屬會員
專屬會員

文章總數 : 57
年齡 : 46
來自 : 新北市
職業 : 設計
愛好 : 看電影/打球
個性 : 隨和
使用年資 : 12年
使用版本 : 2011
經驗值 : 4297
威望值 : 12
注冊日期 : 2013-03-31
男 射手座 蛇

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 Tiger&蘋果爸 2021-12-02, 22:28

linxyz168 寫到:請問一下 如引用這lsp時 執行要輸入指令為?? 不是很懂lsp..
代碼:
Defun C:++
程式碼中
把++改成你想要的指令名,然後重新載入即可使用。

____________________________________________________________________________________
👉[好康]🎁加入專屬B取得大補帖及看2D+3D影片(點我)👈
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Sesa2011 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Youtub11 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Oiea2011 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Oe20011 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Fbi20011 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Line2011
Tiger&蘋果爸
Tiger&蘋果爸
系統管理員
系統管理員

文章總數 : 21077
年齡 : 48
來自 : 台北市文山區
職業 : AutoCAD顧問
愛好 : 蹓狗/戶外活動/拍照/吸貓
個性 : 幽默/樂觀/善良
使用年資 : 20↑
使用版本 : AutoCAD 2022
經驗值 : 88422
威望值 : 16930
注冊日期 : 2008-04-23
2D基礎函授 2D進階函授 3D基礎函授 https://i.servimg.com/u/f11/19/71/67/71/2d3d10.png2D+3D線上 顧問外掛程式 經典問與答讀者 藍鵲1號
2009聚會勳章 2010聚會勳章 2011聚會勳章 2012聚會勳章 2013勳章-2D基礎 2014聚會勳章 2015聚會勳章 2016聚會勳章 串連貼紙成功 男 水瓶座 兔

http://mypaper.pchome.com.tw/kv1012tiger

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 zxc2525123 2022-01-05, 09:36

請問這個代碼要怎麼用? 沒有看到載點呢......
我看網路教學是把代碼貼到記事本 然後改副檔名 用AP載入
但我用了都失敗
求各位教學一下!
zxc2525123
zxc2525123
一般會員
一般會員

文章總數 : 6
年齡 : 29
來自 : 台中
職業 : 建築師
愛好 : 看電影
個性 : 內向
使用年資 : 8
使用版本 : 2020
經驗值 : 840
威望值 : 0
注冊日期 : 2022-01-04
男 水瓶座 豬

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 Tina Yen 2022-08-10, 17:18

請問....加總出來的總和能取小數後一位數嗎? 因為我使用時發現數量為整數, 請問該如何修改程式呢? 頭暈目眩
煩請前輩協助解惑...感激不盡
Tina Yen
Tina Yen
一般會員
一般會員

文章總數 : 11
年齡 : 36
來自 : 台中
職業 : 機電相關
愛好 : 閱讀,運動
個性 : 樂觀,隨和
使用年資 : 2年
使用版本 : 2016
經驗值 : 1890
威望值 : 24
注冊日期 : 2019-03-28
女 巨蟹座 兔

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 Tina Yen 2022-08-10, 17:27

zxc2525123 寫到:請問這個代碼要怎麼用? 沒有看到載點呢......
我看網路教學是把代碼貼到記事本 然後改副檔名 用AP載入
但我用了都失敗
求各位教學一下!

我看網路教學是把代碼貼到記事本 然後改副檔名 用AP載入--->對

但是,您在複製代碼後,需再次確認內容是否與前輩們提供的程式代碼一致喔,
因為我在做的時候是有跑出很多問號 (說是文字碼不同的關係),
所以我有把問號刪掉改用空格 (空白鍵)取代

或許您也可以再嘗試看看喔! 因為我這樣處理後,用AP載入是可以使用的:")
希望有協助到您
Tina Yen
Tina Yen
一般會員
一般會員

文章總數 : 11
年齡 : 36
來自 : 台中
職業 : 機電相關
愛好 : 閱讀,運動
個性 : 樂觀,隨和
使用年資 : 2年
使用版本 : 2016
經驗值 : 1890
威望值 : 24
注冊日期 : 2019-03-28
女 巨蟹座 兔

回頂端 向下

[已解決]求~~文字數字加總計算的lsp? - 頁 2 Empty 回復: [已解決]求~~文字數字加總計算的lsp?

發表 由 sireny238 2022-10-20, 17:23

最近弄到電力系統

需要數字的重複計算

反覆按計算機有點煩亂

試試小工具

____________________________________________________________________________________
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Ioaoe110 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Zuoiy_10 [已解決]求~~文字數字加總計算的lsp? - 頁 2 2020-211 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Aizyao11 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Iyb_1510
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aizyao10 [已解決]求~~文字數字加總計算的lsp? - 頁 2 BPl3tjj.png [已解決]求~~文字數字加總計算的lsp? - 頁 2 Ziao1510 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Oo-2-110 [已解決]求~~文字數字加總計算的lsp? - 頁 2 Oooa_110
sireny238
sireny238
一般會員
一般會員

文章總數 : 10
年齡 : 29
來自 : 台中市龍井區
職業 : 設備繪圖
愛好 : 繪圖
個性 : 內向慢熟
使用年資 : 1
使用版本 : 2018
經驗值 : 1071
威望值 : 0
注冊日期 : 2021-06-17
男 水瓶座 豬

回頂端 向下

1頁(共2頁) 1, 2  下一步

回頂端


 
這個論壇的權限:
無法 在這個版面回復文章
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Ioaoe110[已解決]求~~文字數字加總計算的lsp? - 頁 2 2020-310[已解決]求~~文字數字加總計算的lsp? - 頁 2 Oiu15010[已解決]求~~文字數字加總計算的lsp? - 頁 2 2020-211[已解決]求~~文字數字加總計算的lsp? - 頁 2 Ia15010[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aizyao10[已解決]求~~文字數字加總計算的lsp? - 頁 2 Uos15010[已解決]求~~文字數字加總計算的lsp? - 頁 2 BPl3tjj[已解決]求~~文字數字加總計算的lsp? - 頁 2 Ziao1510
[已解決]求~~文字數字加總計算的lsp? - 頁 2 Oo-2-110[已解決]求~~文字數字加總計算的lsp? - 頁 2 Zuoiy_10[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aizyao11[已解決]求~~文字數字加總計算的lsp? - 頁 2 Iyb_1510[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aoe1-111[已解決]求~~文字數字加總計算的lsp? - 頁 2 Uos15011[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aoe2da10[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aoe2da11[已解決]求~~文字數字加總計算的lsp? - 頁 2 Aoe10