本帖最后由 lee50310 于 2021-3-20 14:02 编辑
原發文帖
部份程式碼
- ;----------------------------------------------------------------------------------------
- ;例: 執行 (filter_Value "pt124")
- ; 回應: "124"
- ;
- ;字串過濾數字部份
- (defun filter_Val (s)
- (vl-list->string
- (vl-remove-if
- '(lambda (x) (or (< x 48) (> x 57)))
- (vl-string->list s)
- )
- )
- )
- ;--------------------------------------------------------------------------------------------------------------------------------------------
- ;例: 執行 (filter_Value "pt124")
- ; 回應: "pt"
- ;
- ;字串過濾文字部份
- (defun filter_txt (s)
- (vl-list->string
- (vl-remove-if
- '(lambda (x) (not (or (< x 48) (> x 57))))
- (vl-string->list s)
- )
- )
- )
- ;--------------------------------------------------------------------------------------------------------------------------------------------
-
- ;依串列點繪線
- (defun dew_line(e1 / tea)
-
- (setq n(-(length e1) 1) jb 1 i 0 line_lst nil)
- (setq p1(cadr(nth i e1)))
-
- (repeat n
- (setq txt_no (strcat (itoa jb) "-" (itoa (+ jb 1)))) ;接合序號 例: jb=1,2,3... , txt_no= "1-2" ,"2-3","3-4"....
- (setq p2(cadr (nth (setq i(1+ i)) e1)))
- (setq obj2 (red_line p1 p2))
- (setq line_lst (cons (cons txt_no obj2) line_lst)) ;line_lst= (("1-2" . <圖元名稱: 316e58a0>)("2-3" . <圖元名稱: 417e32e5>) .....)
- (setq p1 p2)
- (setq jb (1+ jb))
- )
- (setq line_lst(reverse line_lst))
- )
- ;--------------------------------------------------------------------------------------------------------------------------------------------
|