明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3522|回复: 16

一些不错的函数

  [复制链接]
发表于 2005-2-6 14:56 | 显示全部楼层 |阅读模式
;| 1 (deg->rad angle): input angle in degrees as a real or int, returns angle in radians as real
eg (setq a (deg->rad 180)) = 3.14 2 (rad->deg angle): input angle in radians as a real or int, returns angle in degrees as real
eg (setq a (rad->deg (/ pi 2.0))) = 90 3 (tan angle): input angle in radians, returns tangent of angle as real
eg (setq a (tan (/ pi 4))) = 1.0 4 (asin real): input real, returns arcsine of number in radians
eg (setq a (asin 0.5)) = 0.523 5 (acos real): input real, returns arcosine of number in radians
eg (setq a (acos 0.5)) = 10.0472
nine general AutoCAD functions : 6 (3d->2d 3d point) returns a 2d point
eg (setq a (3d->2d '(0 0 0))) = (0 0) 7 (2d->3d 2d point level) returns a 3d point with z value equal to level or 0.0 if nil
eg (setq a (2d->3d '(0 0) 0)) = (0 0 0) 8 (stringp val): input a value, returns true if value is a string else nil
eg (stringp "Hello") = true 9 (intp atom): returns T if atom is an integer
eg (intp 1) = true 10 (realp atom): returns T if atom is a real number
eg (realp 1.0) = true 11 (c:lbo): changes layer of select object to objects colour 12 (c:ca): like the align command but copies the object(s) 13 (c:blktxt): converts text representing a number into a block
Nine list manipulation tools : 14 (vl-remove-last list): input list, removes last element from list
eg (setq a (vl-remove-last '(1 2 3))) = (1 2) 15 (strl_sort list): input list of strings, similar to (acad_strlsort) but sorts numbers numerically
eg (strl_sort '("b" "a" "10" "1")) = ("1" "10" "a" "b") 16 (remove atom list): similar to (vl-remove) but only removes first occurance of atom in list
eg (remove 1 '(1 1 2 1)) = (1 2 1) 17 (nth-remove nth list): removes nth element from list
eg (nth-remove (0 '(1 2 3))) = (2 3) 18 (vl-add atom nth list): adds atom as nth element of list
eg (vl-add 2 1 '(3 3)) = (3 2 3) 19 (sublist start length list): returns a number of elements after start position from a list
eg (sublist 1 2 '(1 2 3 4 5)) = (2 3) 20 (remlist start length list): removes a number of elements after start position from a list
eg (remlist 1 2 '(1 2 3 4 5)) = (1 4 5) 21 (list->string delim list): input deliminator as string, list, converts elements of list to a deliminated string
eg (list->string "*" '("1" "2")) = "1*2" 22 (strconv list): converts elements of list into strings
eg (strconv '(1 2.5 "h")) = ("1" "2.5" "h")
Eleven String functions : 23 (ltrim string): input string, removes any spaces from the beginning of the string
eg (ltrim " trim ") = "trim " 24 (rtrim string): input string, removes any spaces from the end of the string
eg (rtrim " trim ") = " trim" 25 (trim string): input string, removes spaces from beginning and end of string
eg (trim " trim ") = "trim" 26 (string->list string): input string, returns the string a list using spaces a delimineater
eg (string->list "Hello World") = ("Hello" "World") 27 (mid string string): input two strings, returns first string if it is found within second string else nil
eg (mid "to" "AutoCAD") = "to"
28 (replace oldstring newstring string): replaces occurrences of oldstring in string with newstring
eg (replace "\t" " " "Line one\tLine two") = "Line one Line two" 29 (stringtype string): returns data type of contents of the string
eg (strtype "1.5") = "REAL" 30 (right string int): returns number of characters from right of string
eg (right "AutoCAD" 3) = "CAD" 31 (left string int): returns number of characters from left of string
eg (left "Hello" 4) = "Hell" 32 (multiline string int): returns string as a list of strings, each element being no longer than int but finishing with a full word if possible
eg (multiline "Hello New World" 3) = ("Hel" "lo " "Wor" "ld") 33 (stringcase string int): changes string case 0 or nil Upper Case, 1 Lower Case, 2 Initail Character Upper Case rest Lower
eg (stringcase "hello world" 2) = "Hello World"
Two Selection Set Functions : 34 (sslist pickset): input selectionsel, returns list of selected entities
eg (sslist (ssget)) = (<Entity name: 40061d70> <Entity name: 40061d68>) 35 (foreachss string quoted function): iterates through entities in a selection set
eg (foreachss "i" (ssget) '(entdel i)) - this will delete all of the selected entities
|;

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2005-2-7 10:11 | 显示全部楼层
函数f_string?


(defun c:blktxt        ()        ....


                                                         ...(entget i)-------!?
发表于 2005-2-7 16:19 | 显示全部楼层
一些“很”不错的函数:对字符串、表的操作功能极强!支持!
发表于 2005-2-7 16:25 | 显示全部楼层
好,但最好用点中文注释,象我这样E文不好的人看起来很费力
发表于 2005-2-12 09:23 | 显示全部楼层
非常好,谢谢!xiang
发表于 2005-4-10 19:54 | 显示全部楼层
不错啊
发表于 2007-1-29 14:17 | 显示全部楼层

非常感谢

发表于 2007-1-29 17:01 | 显示全部楼层

非常感谢楼主提供哦

发表于 2007-1-29 23:20 | 显示全部楼层

非常好  长知识了!我还想知道 这从那来的?

发表于 2007-1-30 19:34 | 显示全部楼层

非常感谢

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-19 09:42 , Processed in 0.309286 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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