- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I need to select objects according to polyline area (only closed polylines).
My polylines has got an area from 1.6 to 1.8. I have this lisp from lee mac.
;; Select Similar Area - Lee Mac
;; Prompts the user to select a source polyline and
;; selects all polylines in the active layout with a similar area.
(defun c:ssarea ( / ent inc sel src )
(if
(and
(setq src
(LM:SelectIf "\nSelect Source Polyline: "
'(lambda ( x ) (wcmatch (cdr (assoc 0 (entget x))) "*POLYLINE"))
)
)
(setq sel
(ssget "_X"
(list '(0 . "*POLYLINE")
(if (= 1 (getvar 'cvport))
(cons 410 (getvar 'ctab))
'(410 . "Model")
)
)
)
)
(setq src (vla-get-area (vlax-ename->vla-object src)))
)
(repeat (setq inc (sslength sel))
(setq ent (ssname sel (setq inc (1- inc))))
(if (not (equal src (vla-get-area (vlax-ename->vla-object ent)) 1e-3))
(ssdel ent sel)
)
)
)
(sssetfirst nil sel)
(princ)
)
;; Select If - Lee Mac
;; Continuously prompts the user for a selection
;; until a given predicate function is validated
(defun LM:SelectIf ( msg prd / e )
(setq prd (eval prd))
(while
(progn (setvar 'ERRNO 0) (setq e (car (entsel msg)))
(cond
( (= 7 (getvar 'ERRNO))
(princ "\nMissed, try again.")
)
( (eq 'ENAME (type e))
(if (and prd (null (prd e)))
(princ "\nInvalid Object.")
)
)
)
)
)
e
)
(vl-load-com) (princ)
1. What should be the precision value to get polyline from area 1.6 to 1.8.
I set the precision in units to 0 I am getting upto area=2.
2. When I am using this LISP open lines are also getting selected. I need only the closed ones.
Cheers,
Vinay Vijayakumaran
Solved! Go to Solution.