明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: 不死猫

[【不死猫】] 更新!!掀开“桌子”,从CAD中挖掘出全部Lisp函数,普通及内部函数变量10000+

    [复制链接]
发表于 2022-8-15 14:16 | 显示全部楼层
我等菜鸟的福音,太需要这样的资料了
发表于 2022-8-15 14:21 | 显示全部楼层
谢谢猫老师,感谢分享。
发表于 2022-8-15 14:25 | 显示全部楼层
谢谢猫老师,感谢分享。
发表于 2022-8-15 14:33 | 显示全部楼层
感谢猫老师,先回复再看看
发表于 2022-8-15 14:34 | 显示全部楼层
先顶后看,感谢分享
发表于 2022-8-15 14:38 | 显示全部楼层
本帖最后由 自贡黄明儒 于 2022-9-17 13:55 编辑

谢谢猫老师,感谢分享。


;;[功能]去掉之字符串小数点后字符
命令: (tranf 'filename-non-extension)
T
命令: (filename-non-extension "D:\\1.txt")
"D:\\1"
命令: (filename-non-extension "D:\\1.txt.txt")
"D:\\1.txt"

;;[功能]文件名分成三部分
(tranf 'as:fnsplitl)
(as:fnsplitl "D:\\0000\\1.txt");==>("D:\\0000\\" "1" ".txt")
(fnsplitl "D:\\0000\\1.txt.txt");==>("D:\\0000\\" "1.txt" ".txt")
;;参考as:fnsplitl

;;[功能]lisp编辑器无法再编辑??
(tranf 'sys-top);==>T
(sys-top)

;;[功能]盘符序列号
(tranf 'FIND_SERIALNUMBER);;==>T
(FIND_SERIALNUMBER "c:")
(FIND_SERIALNUMBER "D:\\")

;get-logical-drives
;;[功能]盘符
(tranf "get-logical-drives")
(get-logical-drives)


(tranf "_read-nb")
(tranf "_write-nb-str")
;;;(setq fname (findfile "D:\\0000\\1.lsp"))
;;;(setq f (open fname "r"))
;;;(setq str (_read-nb 64000000 f))      
;;;(close f)

;;[功能]文件大小(多少字节),同vl-file-size
(tranf "file-size")
(file-size "D:\\0000\\1.txt")

(tranf "file-mod-time")
(tranf "file-read-only-p")
(tranf "file-readable-p")
(file-mod-time "D:\\0000\\1.txt");不知这个时间怎么搞
(file-read-only-p "D:\\0000\\1.txt");只读为T
(file-readable-p "D:\\0000\\1.txt");可读

(tranf "member-if")
(tranf "member-if-not")
(member-if 'numberp '("a" 1 "a" 1))
(member-if 'numberp '("a" "a" 1 "a" 1));==>(1 "a" 1)

(tranf "merge")
(merge '(1 2) '(4 5) +);==>(4 5 1 2)
(merge '((1) 2) '((3)(3)) 'append);==>((3) (3) (1) 2)

;;(if (member item list) list (cons item list))
(tranf "adjoin")
(adjoin 2 '(3 5));==>(2 3 5)
(adjoin 2 '(3 5 2));==>(3 5 2)

;;不好用,只能三个参数,最后一个须是表
(tranf "acons")
(acons 1 2 '(3));==>((1 . 2) 3)

(tranf "butlast")
(butlast '(1 2 3 4));==>(1 2 3)

;;类似VBS中的写法了
(tranf "funcall")
(funcall '+ 1 2 3)
(funcall + 1 2 3);==>6

(tranf "reduce")
(reduce '+ '(1 2 3) 4);==>10

(tranf "make-list")
(make-list 5 4);==>(4 4 4 4 4)
(make-list 5);==>(nil nil nil nil nil)

;;相当于append
(tranf "nconc")
(nconc '(1 2) '(2) 3);==>(1 2 2 . 3)前面必须是表
(nconc '(1 2) '(2) '(3 4));>>(1 2 2 3 4)
(nconc '(1 2) '(1 2));(1 2 1 2)

;;只能两个参数表;前面一个表倒置了
(tranf "nreconc")
(nreconc '(1 2) '(3 4));==>(2 1 3 4)
(nreconc '(1 2) 3);==>(2 1 . 3)

;;只能是点对中搜索,按后一个元素搜索
(tranf "rassoc")
(rassoc 'a '((a . b) (b . c) (c . a) (z . a)));==>(C . A)按后一个元素搜索
(rassoc 3 '((1 . 2) (3 . 2) (4 . 3) (5 . 3)));(4 . 3)
(assoc 3 '((1 2) (3 2) (4 3) (5 3)));==>(3 2)这个可以是表

;;换第一个元素
(tranf "rplaca")
(rplaca '(1 2 3 4) 5);==>(5 2 3 4)

;;(cons (car x) lst)
(tranf "rplacd")
(rplacd '(3 2 3 4) 5);==>(3 . 5)取第一个元素组成点对
(rplacd '(3 2 3 4) '(5 0 1));(3 5 0 1)

(tranf "string->list")
(string->list "A自");(65 215 212)同(VL-STRING->LIST "A自") "12自贡3"

(tranf "string-append")
(string-append "A自" "3" "3");"A自33",相当于strcat

(tranf "string-by-char-to-list")
(string-by-char-to-list "AAb3b3自" (ascii "b"));("AA" "3" "3自")
;;不支持中文
(string-by-char-to-list "AAb自3b自3自" (ascii "自"));("AAb" "?b" "?" "

;;首字母大写
(tranf "string-capitalize")
(string-capitalize "hello,world");"Hello,World"
(string-capitalize "hello,world")

;;大写(不如strcase好用)
(tranf "string-upcase")
(string-upcase "hello,world自");"HELLO,WORLD自"
(strcase "hEllo,world自" t);"hello,world自"

;;计数
(tranf "string-count")
(string-count (ascii "b") "自ababc");2 "b"的数量

(tranf "string-downcase")
(string-downcase "Hello,World");"hello,world"

;;(VL-STRING->LIST "Hello,World");(72 101 108 108 111 44 87 111 114 108 100)
(tranf "string-elt");字符串中的位移。第一个字符的位移为 0
(string-elt "Hello,World" 2);108

(tranf "string-elt<-")
(setq a "hello")
(string-elt<- a 65 2);此时a 变成了"heAlo"

;;猜不出
(tranf "string-expand-clip")
(string-expand-clip "Hello,World")

;;是否有前缀
(tranf "string-has-prefix-p")
(string-has-prefix-p "hello" "he");T 区分大小写

(tranf "string-left-trim")
(string-left-trim "he" "hello");"llo" 同VL-STRING-LEFT-TRIM

;;字符串长度
(tranf "string-length")
(string-length "hello");5
(string-length "hello自");7 看来中文还是按2个长度计算的。
(strlength "hello自")

;;不好猜
(tranf "string<")
(string< "Atxt" "bbb");t
(string< "aaaaaaa" "bb" "bbb");t

;;是否字符串
(tranf "stringp")
(stringp "2Atxt");t
(stringp 2);nil
(stringp (car(entsel)));nil

;;字符串是否相同
(tranf "string=")
(string= "2Atxt" "2Atxt" "2Atxt");t
(string= "ABC" "abc");nil 区分大小写

;;[功能]只能比较字符串,不区分大小写
(tranf "string-equal")
(string-equal ".Fas" ".fas" ".fAs");===>T
(string-equal ".fas" "a.Fas");===>nil

;;前后剪切
(tranf "string-trim")
(string-trim  " .F" " .Fa sF ");" .Fas " 同VL-STRING-TRIM
(VL-STRING-TRIM  " .F" " .Fa sF ")
(tranf "string-right-trim")

;;字符串填充
(tranf "string-fill")
(setq a "abc")
(string-fill a 65);!a==>"AAA"
;;(chr 65)==>"A"

;;string-key-value
;;string-lessp
;;string-mismatch
;;string-position
;;string-psubst
;;string-resource
;;string-search
;;string-subseq
;;string-subst
;;string-translate



发表于 2022-8-15 14:39 | 显示全部楼层
来学习学习
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-20 23:34 , Processed in 0.822381 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表