只需将*文本更改为插入,然后尝试此操作
- ; get text with closed pline example
- (defun getcoords (ent)
- (vlax-safearray->list
- (vlax-variant-value
- (vlax-get-property
- (vlax-ename->vla-object ent)
- "Coordinates"
- )
- )
- )
- )
- (defun co-ords2xy (/ xy)
- ; 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) 2))
- (setq I 0)
- (repeat numb
- (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
- (setq co-ordsxy (cons xy co-ordsxy))
- (setq I (+ I 2))
- )
- )
- ; program starts here
- (setq plist (ssget (list (cons 0 "lwpolyline"))))
- (setq numb (sslength plist))
- (setq J 0)
- (repeat numb
- (setq co-ords (getcoords (ssname plist J)))
- (co-ords2xy)
- (setq ss (ssget "WP" co-ordsxy (list (cons 0 "*text")))) ; selection set of text within polygon
- (princ (sslength ss)) ; this is howmany texts etc
- (setq co-ordsxy nil)
- (setq J (+ J 1))
- (setq ss nil)
- ) ; end repeat
|