选择对象时只需启动一个选项,即围栏“F”尝试移动F绘制接触对象的临时线。可以使用现有柱网的坐标将其用作围栏点。所以使用ssget,但使用“F”选项。看最后一行代码。
- ;An example with two pts
- (setq ss (ssget "F" (list pt1 pt2))).
- ; pline co-ords example
- ; By Alan H
- (defun getcoords (ent)
- (vlax-safearray->list
- (vlax-variant-value
- (vlax-get-property
- (vlax-ename->vla-object ent)
- "Coordinates"
- )
- )
- )
- )
- (defun co-ords2xy ()
- ; 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 len (length co-ords))
- (setq numb (/ len 2)) ; even and odd check required
- (setq I 0)
- (repeat numb
- (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
- ; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) 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) ; list of 2d points making pline
- ; try this
- (setq ss (ssget "F" co-ordsxy))
|