Message 1 of 6
Please help me fix this code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Please help me fix this code. The target will move the text to the line position directly above it. as shown in the picture below error run code
Command: MOVETEXTTOLINE
Select objects: Specify opposite corner: 6 found
Select objects: ; error: bad SSGET list
Command:
(defun c:MoveTextToLine ()
(setq ss (ssget '((0 . "TEXT,LINE,POLYLINE"))))
(if ss
(progn
(setq i 0)
(repeat (sslength ss)
(setq ent (ssname ss i))
(setq entdata (entget ent))
(setq enttype (cdr (assoc 0 entdata)))
(if (= enttype "TEXT")
(progn
(setq textpoint (cdr (assoc 10 entdata)))
(setq ss2 (ssget "X" (list '(0 . "LINE,POLYLINE") `(cons 10 (cons (car textpoint) (cdr textpoint))))))
(if ss2
(progn
(setq ent2 (ssname ss2 0))
(setq entdata2 (entget ent2))
(setq linepoint (cdr (assoc 10 entdata2)))
(setq newpoint (list (car textpoint) (cadr linepoint)))
(entmod (subst (cons 10 newpoint) (assoc 10 entdata) entdata))
)
)
)
)
(setq i (1+ i))
)
(ssdel ss)
)
)
(princ)
)