马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
 - (defun XD::Text:PointAtIndex (e inx / base box box1 box2 cur ed ed1 i lastpt
- len p2 pos prev tf txt typ v xdir
- )
- (if (setq txt (xdrx_getpropertyvalue e "textstring"))
- (progn
- (setq ed (entget e)
- box(xdrx_text_box e)
- ydir (mapcar '- (nth 2 box)(nth 1 box))
- )
- (setq len (xdrx_string_length txt))
- (if (>= inx len)
- (setq inx (1- len))
- )
- (if (< inx 0)
- (setq inx 0)
- )
- (setq tf t
- i 0
- )
- (setq box2 (xdrx_text_box e)
- base (car box2)
- lastpt base
- xdir (xd::entity:xdir e)
- )
- (while (and
- tf
- (<= i inx)
- )
- (setq prev (xdrx_string_mid txt 0 (1+ i)))
- (setq ed (subst
- (cons 1 prev)
- (assoc 1 ed)
- ed
- )
- )
- (setq cur (xdrx_string_mid txt i 1)
- ed1 (subst
- (cons 1 cur)
- (assoc 1 ed)
- ed
- )
- box1 (textbox ed1)
- )
- (setq box (textbox ed)
- v (mapcar
- '-
- (cadr box)
- (car box)
- )
- p2 (if (< i (1- len))
- (mapcar
- '+
- base
- (xdrx_vector_product xdir (+ (caar box1) (car v))
- )
- )
- (cadr box2)
- )
- )
- (if (= i inx)
- (setq pos (list lastpt p2 (mapcar '+ p2 ydir)(mapcar '+ lastpt ydir)))
- )
- (setq lastpt p2
- i (1+ i)
- )
- )
- )
- )
- pos
- )
|