马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
 - ; converts mline to pline note uses mline vertices does not take
- ; into account top or bottom offset
- ; By Alan H Aug 2017
- (defun c:tt (/ co-ords ent co-ordsxy xy oldsnap)
- (setq oldsnap (getvar "osmode"))
- (setq ss (ssget (list (cons 0 "Mline")))) ; pick only mlines
- (if (/= ss nil)
- (progn
- (repeat (setq x (sslength ss))
- (setq ent (ssname ss (setq x (- x 1)))) ; get mlines
- (setq co-ords (vlax-safearray->list
- (vlax-variant-value
- (vlax-get-property
- (vlax-ename->vla-object ent) ; get co-ordinates of mline
- "Coordinates"
- )
- )
- )
- ) ; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
- (setq numb (/ (length co-ords) 3)) ; mlines have a z value hence / 3
- (setq I 0)
- (repeat numb
- (setq xy (list (nth i co-ords) (nth (+ I 1) co-ords)))
- (setq co-ordsxy (cons xy co-ordsxy)) ; make a list of co-ordinates
- (setq I (+ I 3))
- )
- (setvar "osmode" 0)
- (command "_pline")
- (while (= (getvar "cmdactive") 1)
- (repeat (setq y (length co-ordsxy))
- (command (nth (setq y (- y 1)) co-ordsxy)) ; read list of points
- )
- (command "")
- )
- (setq co-ordsxy nil) ; reset to do again
- (command "erase" ent "")
- )
- )
- )
- (setvar "osmode" oldsnap) ; reset snap mode
- )
|