[linshiyin2]大地 16:41:05
一串字符串,怎么读取其中的数字呢,例子:"ju//idj/21.34abc"
[236004]张牙舞爪 16:43:48
转成ASCCI码
48-58
[夏生生][x_s_s_1]生无可恋 16:44:15
;;;判断字符串是否为实数
(defun Number? (string /)
(if (and (distof string)
(atof string)
(= (distof string) (atof string))
)
string
)
)
有小数点不负责
[236004]张牙舞爪 16:44:39
如果有汉字呢,
比哪:中国3.88北京999
[夏生生][x_s_s_1]生无可恋 16:45:04
也没问题
[236004]张牙舞爪 16:45:16
试下
[夏生生][x_s_s_1]生无可恋 16:45:44
利用Number? 挨个放血
[夏生生][x_s_s_1]生无可恋 16:46:22
;;;从尾部查找数字
(defun serch_number_e (string / n st str)
(setq st "")
(if (null (Number? string))
(while (and (setq n (strlen string))
(Number? (setq str (substr string n)))
)
(setq st (strcat str st))
(setq string (substr string 1 (1- n)))
)
(setq st string)
)
st
)
;;;从头部查找数字
(defun serch_number_s (string / st str)
(setq st "")
(while (Number? (setq str (substr string 1 1)))
(setq st (strcat st str))
(setq string (substr string 2))
)
st
)
[236004]张牙舞爪 16:46:32
(Number? "中国3.88北京00.99")
用不了
[小伟jeny]小伟 16:46:38
师傅
[夏生生][x_s_s_1]生无可恋 16:46:54
[qqimg]oldimg/{62B9F98D-842D-C1F8-4AE5-0FF6A47260DD}.jpg[/qqimg]
[小伟jeny]小伟 16:47:00
ent怎么变成varient?
[236004]张牙舞爪 16:47:00
还是转 ACSSII码好些
用VLAX
StEf 16:47:35
maptrim这个命令如何移植到普通点的cad版本中????
有知道的么??
[夏生生][x_s_s_1]生无可恋 16:47:56
ent不能变成varient吧不懂
[236004]张牙舞爪 16:47:58
((Vlax-Ename->Vla-Object (car (entsel)))
[夏生生][x_s_s_1]生无可恋 16:48:16
那是变成object
不是变成安全数组
[236004]张牙舞爪 16:48:32
估计他是问这个吧
StEf 16:49:01
有知道的么??
[236004]张牙舞爪 16:49:16
[qqimg]oldimg/{DDD84D0E-AC71-10FF-A6DA-EB262052F828}.jpg[/qqimg]
[夏生生][x_s_s_1]生无可恋 16:49:51
[qqimg]oldimg/{62B9F98D-842D-C1F8-4AE5-0FF6A47260DD}.jpg[/qqimg]
这个只是判断单个字符串是否为数值
[小伟jeny]小伟 16:50:16
不是这个
[夏生生][x_s_s_1]生无可恋 16:51:01
vlax-variant和vlax-safearray族的看看有无你需要的
[夏生生][x_s_s_1]生无可恋 16:53:10
你变为安全数组要干吗?
[小伟jeny]小伟 16:53:26
sendcommand
[阿然][阿然] 16:53:40
;;;列表转数组 by Xran
;;;参数lst datatype
;;;datatype有以下几种
;;;vlax-vbInteger (2) 整数型
;;;vlax-vbLong (3) 长整数型
;;;vlax-vbSingle (4) 单精度浮点数
;;;vlax-vbDouble (5) 双精度浮点数
;;;vlax-vbString (8) 字符串
;;;vlax-vbObject (9) 对象
;;;vlax-vbBoolean (11) 布尔值
;;;vlax-vbVariant (12) 变体
;;;例 xr:lst->array lst 12)
;;; (xr:lst->array lst vlax-vbvariant)
(defun Xr:lst->Array (Lst datatype / arraySpace sArray)
(setq arraySpace
(vlax-make-safearray
datatype ; 元素类型
(cons 0
(1- (length Lst))
) ; 数组维数
)
)
(setq sArray (vlax-safearray-fill arraySpace Lst))
)
[小伟jeny]小伟 16:54:04
vlax-variant提示no function
[夏生生][x_s_s_1]生无可恋 16:54:37
我是叫你看这个族的函数是否有你需要的
[linshiyin2]大地 16:55:45
有小数点啊
关键就是小数点,并且字符串中只有一组数字
[小伟jeny]小伟 16:56:14
没有
[夏生生][x_s_s_1]生无可恋 16:56:16
有小数点就把小数点加到函数里面去就是了啊
[小伟jeny]小伟 16:56:42
我是要把图元名转成vb的变体
[夏生生][x_s_s_1]生无可恋 16:58:30
;;;判断字符串是否为实数
(defun Number? (string /)
(if (or (= "." str)
(and (distof string)
(atof string)
(= (distof string) (atof string))
)
)
string
)
)
;;;从尾部查找数字
(defun serch_number_e (string / n st str)
(setq st "")
(if (null (Number? string))
(while (and (setq n (strlen string))
(Number? (setq str (substr string n)))
)
(setq st (strcat str st))
(setq string (substr string 1 (1- n)))
)
(setq st string)
)
st
)
(SETQ STR "N=52774.123,M=12345.43")
(serch_number_e(SUBSTR STR 1 (VL-STRING-SEARCH "," STR)))
;;-->"52774.123"
(serch_number_e STR)
;;-->"12345.43"
[夏生生][x_s_s_1]生无可恋 16:59:36
[qqimg]oldimg/{CA1B82C7-84BB-DE5A-A5F2-571B90206252}.jpg[/qqimg]把阿然那个看懂了你就懂了
[linshiyin2]大地 16:59:40
收下,看看满意不
[夏生生][x_s_s_1]生无可恋 16:59:59
先要vlax-make-safearray
估计大地满意不了
自己要适当改改,你行的
[夏生生][x_s_s_1]生无可恋 17:01:20
[qqimg]oldimg/{E021204F-A6A7-F249-1D01-3A8A5B6C457C}.jpg[/qqimg]
[夏生生][x_s_s_1]生无可恋 17:02:40
就是(vlax-safearray->list (vlax-variant-value Variant))的逆向
[小伟jeny]小伟 17:02:51
先要vlax-make-safearray 这不是变数组了么
[夏生生][x_s_s_1]生无可恋 17:03:30
还是没搞懂你要干啥
send what command
[woky57]WOKY 17:04:06
加个判断
[偏爱云~小吴] 17:05:45
阿然的哪个为什么显示no function
好高深
[阿然][阿然] 17:06:47
先说明ent转vb变体以后要干嘛,才能知道用什么函数来转换
[夏生生][x_s_s_1]生无可恋 17:07:29
就是
[阿然][阿然] 17:07:42
vla里面好像没有单独使用一个variant变量的情况,都要用数组
[linshiyin2]大地 17:09:36
字符串取数字,挨个取出放血
[小伟jeny]小伟 17:17:10
我详细的说一下我的目的 |