这是VL代码,但很容易转换为VBA。它使用properties函数获得与您可以获得“layer”“Color”“width”等相同的co ORD。希望对您有所帮助
- (defun getcoords (ent)
- (vlax-safearray->list
- (vlax-variant-value
- (vlax-get-property
- (vlax-ename->vla-object ent)
- "Coordinates"
- )
- )
- )
- )
- (defun co-ords2xy (I numb 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 co-ords (getcoords (car (entsel "\nplease pick pline"))))
- (co-ords2xy)
- (princ co-ordsxy)
|