I'm not too sure which would be faster:
- sending a selection set to the erase command
- entdel each entity in turn
- vla-Delete each entity
- vla-Erase a vla selection set (probably this one, but then the rest of the code doesn't perform too well)
<clip>
IMHO vla-Erase a vla selection set is slower.
The real problem is to test it:
;no vlax-curve-...
(defun C:ALE_ShortLongestPLByLyr05 ( / VlaObj SelSet EntDat Countr EntNam LenVal LyrNam TmpLst InfLst)
(if (setq Countr 0 SelSet (ssget "_X" (list '(0 . "POLYLINE"))))
(progn
(setvar "HIGHLIGHT" 0)
(repeat (sslength SelSet)
(setq
EntNam (ssname SelSet Countr) EntDat (entget EntNam)
VlaObj (vlax-ename->vla-object EntNam)
LenVal (vla-get-length VlaObj)
LyrNam (cdr (assoc 8 EntDat))
Countr (1+ Countr)
)
(cond
( (not (setq TmpLst (assoc LyrNam InfLst)))
(setq InfLst (cons (list LyrNam EntNam LenVal EntNam LenVal) InfLst))
)
( (> LenVal (nth 4 TmpLst))
(setq InfLst (subst (list (car TmpLst) (cadr TmpLst) (caddr TmpLst) EntNam LenVal) TmpLst InfLst))
)
( (< LenVal (caddr TmpLst))
(setq InfLst (subst (list (car TmpLst) EntNam LenVal (cadddr TmpLst) (nth 4 TmpLst)) TmpLst InfLst))
)
)
)
)
)
(command "_.ERASE" SelSet "")
(foreach ForElm InfLst (entdel (cadr ForElm)) (entdel (cadddr ForElm)))
)
(repeat 10
(time-it '(C:ALE_ShortLongestPLByLyr05))
(command "_.OOPS")
(gc)
)
Program running time: 936 msecs.
Program running time: 406 msecs.
Program running time: 593 msecs.
Program running time: 390 msecs.
Program running time: 312 msecs.
Program running time: 328 msecs.
Program running time: 312 msecs.
Program running time: 406 msecs.
Program running time: 312 msecs.
Program running time: 312 msecs.